|
|
|
@ -28,7 +28,8 @@ import org.springframework.boot.test.context.SpringBootTest; |
|
|
|
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; |
|
|
|
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; |
|
|
|
import org.springframework.boot.test.context.TestConfiguration; |
|
|
|
import org.springframework.boot.test.context.TestConfiguration; |
|
|
|
import org.springframework.context.annotation.Bean; |
|
|
|
import org.springframework.context.annotation.Bean; |
|
|
|
import org.springframework.http.HttpHeaders; |
|
|
|
import org.springframework.http.HttpStatus; |
|
|
|
|
|
|
|
import org.springframework.http.ResponseEntity; |
|
|
|
|
|
|
|
|
|
|
|
import static org.assertj.core.api.Assertions.assertThat; |
|
|
|
import static org.assertj.core.api.Assertions.assertThat; |
|
|
|
|
|
|
|
|
|
|
|
@ -41,8 +42,9 @@ class MySpringBootTests { |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
void testRequest() { |
|
|
|
void testRequest() { |
|
|
|
HttpHeaders headers = this.template.getForEntity("/example", String.class).getHeaders(); |
|
|
|
ResponseEntity<String> response = this.template.getForEntity("/example", String.class); |
|
|
|
assertThat(headers.getLocation()).hasHost("other.example.com"); |
|
|
|
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK); |
|
|
|
|
|
|
|
// Other assertions to verify the response
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@TestConfiguration(proxyBeanMethods = false) |
|
|
|
@TestConfiguration(proxyBeanMethods = false) |
|
|
|
|