Fixes test
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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!");
|
||||
|
||||
Reference in New Issue
Block a user