use of org.springframework.boot.test.web.client.TestRestTemplate in project spring-boot by spring-projects.
the class HttpTunnelIntegrationTests method viaTunnel.
@Test
public void viaTunnel() throws Exception {
String url = "http://localhost:" + this.config.clientPort + "/hello";
ResponseEntity<String> entity = new TestRestTemplate().getForEntity(url, String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(entity.getBody()).isEqualTo("Hello World");
}
use of org.springframework.boot.test.web.client.TestRestTemplate in project spring-boot by spring-projects.
the class SampleJettySslApplicationTests method testHome.
@Test
public void testHome() throws Exception {
TestRestTemplate testRestTemplate = new TestRestTemplate(HttpClientOption.SSL);
ResponseEntity<String> entity = testRestTemplate.getForEntity("https://localhost:" + this.port, String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(entity.getBody()).isEqualTo("Hello World");
}
use of org.springframework.boot.test.web.client.TestRestTemplate in project spring-boot by spring-projects.
the class SampleActuatorUiApplicationPortTests method testMetrics.
@Test
public void testMetrics() throws Exception {
@SuppressWarnings("rawtypes") ResponseEntity<Map> entity = new TestRestTemplate().getForEntity("http://localhost:" + this.managementPort + "/metrics", Map.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.UNAUTHORIZED);
}
use of org.springframework.boot.test.web.client.TestRestTemplate in project spring-boot by spring-projects.
the class InsecureManagementPortAndPathSampleActuatorApplicationTests method testMissing.
@Test
public void testMissing() throws Exception {
ResponseEntity<String> entity = new TestRestTemplate().getForEntity("http://localhost:" + this.managementPort + "/admin/missing", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND);
assertThat(entity.getBody()).contains("\"status\":404");
}
use of org.springframework.boot.test.web.client.TestRestTemplate in project spring-boot by spring-projects.
the class InsecureManagementPortAndPathSampleActuatorApplicationTests method testMetrics.
@Test
public void testMetrics() throws Exception {
// makes sure some requests have been made
testHome();
@SuppressWarnings("rawtypes") ResponseEntity<Map> entity = new TestRestTemplate().getForEntity("http://localhost:" + this.managementPort + "/admin/metrics", Map.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
}
Aggregations