resp = restClient.get()
+ .uri("http://localhost:" + port + "/oups")
+ .accept(MediaType.TEXT_HTML)
+ .retrieve()
+ .onStatus(status -> true, (request, response) -> {
+ })
+ .toEntity(String.class);
assertThat(resp).isNotNull();
assertThat(resp.getStatusCode()).isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR);
assertThat(resp.getBody()).isNotNull();
// html:
- assertThat(resp.getBody()).containsSubsequence("", "", "Something happened...", "
", "",
- "Expected:", "controller", "used", "to", "showcase", "what", "happens", "when", "an", "exception", "is",
- "thrown", "
", "");
+ assertThat(resp.getBody()).contains("Something happened...");
// Not the whitelabel error page:
assertThat(resp.getBody()).doesNotContain("Whitelabel Error Page",
"This application has no explicit mapping for");
diff --git a/src/test/java/org/springframework/samples/petclinic/vet/VetControllerTests.java b/src/test/java/org/springframework/samples/petclinic/vet/VetControllerTests.java
index f295cd68..b8618c35 100644
--- a/src/test/java/org/springframework/samples/petclinic/vet/VetControllerTests.java
+++ b/src/test/java/org/springframework/samples/petclinic/vet/VetControllerTests.java
@@ -21,7 +21,7 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledInNativeImage;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
+import org.springframework.boot.webmvc.test.autoconfigure.WebMvcTest;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.http.MediaType;