Adapt to deprecation of NestedServletException

This commit is contained in:
Stephane Nicoll
2022-06-14 16:38:39 +02:00
parent 6894f561ce
commit b0f5fb51fc
7 changed files with 20 additions and 26 deletions

View File

@@ -16,6 +16,7 @@
package org.springframework.boot.test.autoconfigure.web.servlet.mockmvc;
import jakarta.servlet.ServletException;
import jakarta.validation.ConstraintViolationException;
import org.junit.jupiter.api.Test;
@@ -24,7 +25,6 @@ import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.web.servlet.error.ErrorAttributes;
import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.web.util.NestedServletException;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
@@ -70,8 +70,7 @@ class WebMvcTestAllControllersIntegrationTests {
@Test
void shouldRunValidationFailure() {
assertThatExceptionOfType(NestedServletException.class)
.isThrownBy(() -> this.mvc.perform(get("/three/invalid")))
assertThatExceptionOfType(ServletException.class).isThrownBy(() -> this.mvc.perform(get("/three/invalid")))
.withCauseInstanceOf(ConstraintViolationException.class);
}