Fixes test

This commit is contained in:
spencergibb
2022-10-10 14:28:10 -04:00
parent 733e9f3ee8
commit b18ea82607
2 changed files with 9 additions and 2 deletions

View File

@@ -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.server.LocalServerPort;
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.MediaType;
import org.springframework.http.ResponseEntity;
import static org.assertj.core.api.Assertions.assertThat;
@@ -46,8 +49,11 @@ public class WebfluxRefreshEndpointIntegrationTests {
@Test
public void webAccess() throws Exception {
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",
null, String.class);
request, String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
}

View File

@@ -71,7 +71,8 @@ public class RefreshEndpointIntegrationTests {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
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);
String message = template.getForObject("http://localhost:" + this.port + "/", String.class);
then(message).isEqualTo("Hello Dave!");