lundi 22 juillet 2019

Run RestTemplate class from command line

I have a Spring Boot REST application running on server. I wrote RestTemplate tests to test my endpoints in IDEA. Now, i would like to run my test using command line, while my application is running on localhost.

This is a part of my Test class.

@RunWith(MockitoJUnitRunner.class)
public class MessageReceiverResourceIT {

    private String BASE_URL = "https://127.0.0.1:8443/";
    private MessageReceiverResourceClient client;

    @Before
    public void init(){
        client = new MessageReceiverResourceClient(new RestTemplate());
    }

    @Test
    public void receiveFiscalMessages_validRequest(){
        String json = "something";

        client.postReceiveFiscalMessages(BASE_URL + "parkingtest", json);
    }
}

The idea behind this is when we running our application on a remote server, we would like to test the application running these RestTemplate test files from command line.

Aucun commentaire:

Enregistrer un commentaire