use of org.springframework.boot.test.web.client.TestRestTemplate in project java-function-invoker by projectriff.
the class FatJarPojoTests method init.
@Before
public void init() {
runner = new JavaFunctionInvokerApplication();
rest = new TestRestTemplate();
}
use of org.springframework.boot.test.web.client.TestRestTemplate in project spring-boot-admin by codecentric.
the class AdminApplicationTest method testReverseProxy.
@Test
public void testReverseProxy() {
String apiBaseUrl = "http://localhost:" + port + "/api/applications";
Map<String, String> application = new HashMap<>();
application.put("name", "TestApp");
application.put("managementUrl", "http://localhost:" + port);
application.put("serviceUrl", "http://localhost:" + port);
application.put("healthUrl", "http://localhost:" + port + "/health");
@SuppressWarnings("unchecked") ResponseEntity<Map<String, String>> entity = new TestRestTemplate().postForEntity(apiBaseUrl, application, (Class<Map<String, String>>) (Class<?>) Map.class);
@SuppressWarnings("rawtypes") ResponseEntity<Map> app = new TestRestTemplate().getForEntity(apiBaseUrl + "/" + entity.getBody().get("id"), Map.class);
assertEquals(HttpStatus.OK, app.getStatusCode());
assertEquals("TestApp", app.getBody().get("name"));
@SuppressWarnings("rawtypes") ResponseEntity<Map> info = new TestRestTemplate().getForEntity(apiBaseUrl + "/" + entity.getBody().get("id") + "/info", Map.class);
assertEquals(HttpStatus.OK, info.getStatusCode());
@SuppressWarnings("rawtypes") ResponseEntity<Map> health = new TestRestTemplate().getForEntity(apiBaseUrl + "/" + entity.getBody().get("id") + "/health", Map.class);
assertEquals(HttpStatus.OK, health.getStatusCode());
}
use of org.springframework.boot.test.web.client.TestRestTemplate in project spring-boot-admin by codecentric.
the class AdminApplicationTest method testGetApplications.
@Test
public void testGetApplications() {
@SuppressWarnings("rawtypes") ResponseEntity<List> entity = new TestRestTemplate().getForEntity("http://localhost:" + port + "/api/applications", List.class);
assertEquals(HttpStatus.OK, entity.getStatusCode());
}
use of org.springframework.boot.test.web.client.TestRestTemplate in project spring-boot by spring-projects.
the class EndpointMvcIntegrationTests method healthEndpointNotHidden.
@Test
public void healthEndpointNotHidden() throws InterruptedException {
String body = new TestRestTemplate().getForObject("http://localhost:" + this.port + "/health", String.class);
assertThat(body).isNotNull().contains("status");
assertThat(this.interceptor.invoked()).isTrue();
}
use of org.springframework.boot.test.web.client.TestRestTemplate in project spring-boot by spring-projects.
the class MustacheAutoConfigurationIntegrationTests method testHomePage.
@Test
public void testHomePage() throws Exception {
String body = new TestRestTemplate().getForObject("http://localhost:" + this.port, String.class);
assertThat(body.contains("Hello World")).isTrue();
}
Aggregations