Fix checkstyle violations

This commit is contained in:
Phillip Webb 2019-06-07 12:48:55 -07:00
parent 866e2b712e
commit fed11febec
2 changed files with 9 additions and 11 deletions

View File

@ -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")));
}

View File

@ -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")));
}