Browse Source

Fixes test

tls-versions
spencergibb 2 years ago
parent
commit
b18ea82607
No known key found for this signature in database
GPG Key ID: 7788A47380690861
  1. 8
      spring-cloud-context-webflux-integration-tests/src/test/java/org/springframework/cloud/context/integration/webflux/WebfluxRefreshEndpointIntegrationTests.java
  2. 3
      spring-cloud-context/src/test/java/org/springframework/cloud/context/scope/refresh/RefreshEndpointIntegrationTests.java

8
spring-cloud-context-webflux-integration-tests/src/test/java/org/springframework/cloud/context/integration/webflux/WebfluxRefreshEndpointIntegrationTests.java

@ -24,7 +24,10 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.boot.test.web.server.LocalServerPort;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
@ -46,8 +49,11 @@ public class WebfluxRefreshEndpointIntegrationTests {
@Test @Test
public void webAccess() throws Exception { public void webAccess() throws Exception {
TestRestTemplate template = new TestRestTemplate(); TestRestTemplate template = new TestRestTemplate();
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
HttpEntity request = new HttpEntity(headers);
ResponseEntity<String> entity = template.postForEntity("http://localhost:" + this.port + BASE_PATH + "/refresh", ResponseEntity<String> entity = template.postForEntity("http://localhost:" + this.port + BASE_PATH + "/refresh",
null, String.class); request, String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
} }

3
spring-cloud-context/src/test/java/org/springframework/cloud/context/scope/refresh/RefreshEndpointIntegrationTests.java

@ -71,7 +71,8 @@ public class RefreshEndpointIntegrationTests {
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON); headers.setContentType(MediaType.APPLICATION_JSON);
HttpEntity request = new HttpEntity(headers); HttpEntity request = new HttpEntity(headers);
ResponseEntity<String> refreshResponse = template.postForEntity("http://localhost:" + this.port + BASE_PATH + "/refresh", request, String.class); ResponseEntity<String> refreshResponse = template
.postForEntity("http://localhost:" + this.port + BASE_PATH + "/refresh", request, String.class);
assertThat(refreshResponse.getStatusCode()).isEqualTo(HttpStatus.OK); assertThat(refreshResponse.getStatusCode()).isEqualTo(HttpStatus.OK);
String message = template.getForObject("http://localhost:" + this.port + "/", String.class); String message = template.getForObject("http://localhost:" + this.port + "/", String.class);
then(message).isEqualTo("Hello Dave!"); then(message).isEqualTo("Hello Dave!");

Loading…
Cancel
Save