I am working with Springboot and Java 8
I have following url, that works pretty fine with postman:
"http://localhost:8888/gc/goods/getAll"
Now I have tried to write an automated test:
@Test
public void getAllGoodsRequest()
{
RestTemplate restTemplate = new RestTemplate();
Object test = restTemplate.getForObject("http://localhost:8888/gc/goods/getAll", Object.class);
}
While Postman gives me all data back, I get following error from my test:
org.springframework.web.client.ResourceAccessException: I/O error on GET request for "http://localhost:8888/gc/goods/getAll": Connection refused: connect; nested exception is java.net.ConnectException: Connection refused: connect
How do I request the Data correctly during testing?
Thanks for help!
Aucun commentaire:
Enregistrer un commentaire