I donβt know this will be an option, but in my case I used HttpClient to test my controllers with IntegrationTest
HttpClient httpClient = login(HTTP_SERVER_DOMAIN, " user1@gmail.com ", "password"); GetMethod getAllAdvicesMethod = new GetMethod(adviceGetURL); getAllAdvicesMethod .addRequestHeader("Content-Type", "application/json"); try { httpClient.executeMethod(getAllAdvicesMethod); } catch (HttpException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); }
You can use the Rest Template for Spring, and https://spring.io/blog/2009/03/27/rest-in-spring-3-resttemplate
source share