List of usage examples for org.springframework.http ResponseEntity getStatusCode
public HttpStatus getStatusCode()
From source file:com.cloudbees.jenkins.plugins.demo.actuator.EndpointsPropertiesSampleActuatorApplicationTests.java
@Test public void testCustomContextPath() throws Exception { ResponseEntity<String> entity = new TestRestTemplate() .getForEntity("http://localhost:" + this.port + "/admin/health", String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); String body = entity.getBody(); assertEquals("ok", body); }
From source file:com.crazyacking.learn.spring.actuator.NoManagementSampleActuatorApplicationTests.java
@Test public void testHome() { @SuppressWarnings("rawtypes") ResponseEntity<Map> entity = this.restTemplate.withBasicAuth("user", getPassword()).getForEntity("/", Map.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); @SuppressWarnings("unchecked") Map<String, Object> body = entity.getBody(); assertThat(body.get("message")).isEqualTo("Hello Phil"); }
From source file:com.somerledsolutions.pa11y.client.Pa11yRestClientImpl.java
@Override public HttpStatus runTask(String taskId, String url) { Map<String, String> params = new HashMap<String, String>(); params.put("host", url); params.put("id", taskId); String runTaskUrl = "{host}/tasks/{id}/run"; ResponseEntity<Object> objectResponseEntity = restTemplate.postForEntity(runTaskUrl, null, null, params); return objectResponseEntity.getStatusCode(); }
From source file:demo.EmbeddedIntegrationTests.java
@Test public void testSecure() throws IOException { ResponseEntity<String> body = new TestRestTemplate().getForEntity("http://127.0.0.1:" + port + "/", String.class); assertEquals("Wrong body: " + body, HttpStatus.UNAUTHORIZED, body.getStatusCode()); }
From source file:hello.SayHelloApplicationTests.java
@Test public void shouldReturn200WhenSendingRequestToGreeting() throws Exception { @SuppressWarnings("rawtypes") ResponseEntity<String> entity = this.testRestTemplate .getForEntity("http://localhost:" + this.port + "/greeting", String.class); then(entity.getStatusCode()).isEqualTo(HttpStatus.OK); then(entity.getBody()).isNotEmpty(); }
From source file:org.alliance.rebel.tomcat.NonAutoConfigurationSampleTomcatApplicationTests.java
@Test public void testHome() throws Exception { ResponseEntity<String> entity = new TestRestTemplate() .getForEntity("http://localhost:" + this.port + "/hello", String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertEquals("Hello World", entity.getBody()); }
From source file:sample.jersey.ApplicationTests.java
@Test public void contextLoads() { ResponseEntity<String> entity = restTemplate.getForEntity( "http://localhost:" + server.getEmbeddedServletContainer().getPort() + "/hello", String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); }
From source file:br.com.bancooriginal.notificacao.servlet.SampleServletApplicationTests.java
@Test public void testHome() throws Exception { ResponseEntity<String> entity = new TestRestTemplate("user", getPassword()) .getForEntity("http://localhost:" + this.port, String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertEquals("Hello World", entity.getBody()); }
From source file:com.onyxscheduler.OnyxSchedulerIT.java
@Test public void shouldFireMultipleHttpPostsWithCron() { String jobName = "cron"; String requestBody = buildCronJobRequestBodyFromNameAndCronExpression(jobName, CRON); ResponseEntity<String> response = scheduleJob(requestBody); assertThat(response.getStatusCode(), is(HttpStatus.CREATED)); pollingVerifyJobRequestWithAtLeastCount(2, jobName); }
From source file:de.pentasys.playground.springbootexample.EndpointsPropertiesSampleActuatorApplicationIT.java
@Test public void testCustomContextPath() throws Exception { ResponseEntity<String> entity = new TestRestTemplate() .getForEntity("http://localhost:" + this.port + "/admin/health", String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); String body = entity.getBody(); assertTrue(body.contains("\"status\" : \"UP\"")); }