diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/annotation/ControllerEndpointDiscovererTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/annotation/ControllerEndpointDiscovererTests.java index 8fefe5fdc2e..454428ba148 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/annotation/ControllerEndpointDiscovererTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/annotation/ControllerEndpointDiscovererTests.java @@ -39,7 +39,7 @@ import org.springframework.context.annotation.Import; import org.springframework.validation.annotation.Validated; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.assertj.core.api.Assertions.assertThatIllegalStateException; /** * Tests for {@link ControllerEndpointDiscoverer}. @@ -122,9 +122,8 @@ public class ControllerEndpointDiscovererTests { @Test public void getEndpointWhenEndpointHasOperationsShouldThrowException() { - this.contextRunner.withUserConfiguration(TestControllerWithOperation.class) - .run(assertDiscoverer((discoverer) -> assertThatExceptionOfType(IllegalStateException.class) - .isThrownBy(discoverer::getEndpoints) + this.contextRunner.withUserConfiguration(TestControllerWithOperation.class).run( + assertDiscoverer((discoverer) -> assertThatIllegalStateException().isThrownBy(discoverer::getEndpoints) .withMessageContaining("ControllerEndpoints must not declare operations"))); } diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/annotation/ServletEndpointDiscovererTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/annotation/ServletEndpointDiscovererTests.java index f93315f9c8e..a9abf349527 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/annotation/ServletEndpointDiscovererTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/annotation/ServletEndpointDiscovererTests.java @@ -48,7 +48,7 @@ import org.springframework.context.annotation.Import; import org.springframework.validation.annotation.Validated; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.assertj.core.api.Assertions.assertThatIllegalStateException; /** * Tests for {@link ServletEndpointDiscoverer}. @@ -105,30 +105,29 @@ public class ServletEndpointDiscovererTests { @Test public void getEndpointWhenEndpointHasOperationsShouldThrowException() { - this.contextRunner.withUserConfiguration(TestServletEndpointWithOperation.class) - .run(assertDiscoverer((discoverer) -> assertThatExceptionOfType(IllegalStateException.class) - .isThrownBy(discoverer::getEndpoints) + this.contextRunner.withUserConfiguration(TestServletEndpointWithOperation.class).run( + assertDiscoverer((discoverer) -> assertThatIllegalStateException().isThrownBy(discoverer::getEndpoints) .withMessageContaining("ServletEndpoints must not declare operations"))); } @Test public void getEndpointWhenEndpointNotASupplierShouldThrowException() { this.contextRunner.withUserConfiguration(TestServletEndpointNotASupplier.class) - .run(assertDiscoverer((discoverer) -> assertThatExceptionOfType(IllegalStateException.class) + .run(assertDiscoverer((discoverer) -> assertThatIllegalStateException() .isThrownBy(discoverer::getEndpoints).withMessageContaining("must be a supplier"))); } @Test public void getEndpointWhenEndpointSuppliesWrongTypeShouldThrowException() { this.contextRunner.withUserConfiguration(TestServletEndpointSupplierOfWrongType.class) - .run(assertDiscoverer((discoverer) -> assertThatExceptionOfType(IllegalStateException.class) + .run(assertDiscoverer((discoverer) -> assertThatIllegalStateException() .isThrownBy(discoverer::getEndpoints).withMessageContaining("must supply an EndpointServlet"))); } @Test public void getEndpointWhenEndpointSuppliesNullShouldThrowException() { this.contextRunner.withUserConfiguration(TestServletEndpointSupplierOfNull.class) - .run(assertDiscoverer((discoverer) -> assertThatExceptionOfType(IllegalStateException.class) + .run(assertDiscoverer((discoverer) -> assertThatIllegalStateException() .isThrownBy(discoverer::getEndpoints).withMessageContaining("must not supply null"))); }