diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/amqp/RabbitHealthIndicatorAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/amqp/RabbitHealthIndicatorAutoConfigurationTests.java index e5099f6088..d969823975 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/amqp/RabbitHealthIndicatorAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/amqp/RabbitHealthIndicatorAutoConfigurationTests.java @@ -40,14 +40,14 @@ public class RabbitHealthIndicatorAutoConfigurationTests { HealthIndicatorAutoConfiguration.class)); @Test - public void runShouldCreateIndicator() throws Exception { + public void runShouldCreateIndicator() { this.contextRunner.run((context) -> assertThat(context) .hasSingleBean(RabbitHealthIndicator.class) .doesNotHaveBean(ApplicationHealthIndicator.class)); } @Test - public void runWhenDisabledShouldNotCreateIndicator() throws Exception { + public void runWhenDisabledShouldNotCreateIndicator() { this.contextRunner.withPropertyValues("management.health.rabbit.enabled:false") .run((context) -> assertThat(context) .doesNotHaveBean(RabbitHealthIndicator.class) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/audit/AuditAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/audit/AuditAutoConfigurationTests.java index 0e5e474d7d..d27e6363ce 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/audit/AuditAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/audit/AuditAutoConfigurationTests.java @@ -46,7 +46,7 @@ public class AuditAutoConfigurationTests { private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); @Test - public void defaultConfiguration() throws Exception { + public void defaultConfiguration() { registerAndRefresh(AuditAutoConfiguration.class); assertThat(this.context.getBean(AuditEventRepository.class)).isNotNull(); assertThat(this.context.getBean(AuthenticationAuditListener.class)).isNotNull(); @@ -54,7 +54,7 @@ public class AuditAutoConfigurationTests { } @Test - public void ownAuditEventRepository() throws Exception { + public void ownAuditEventRepository() { registerAndRefresh(CustomAuditEventRepositoryConfiguration.class, AuditAutoConfiguration.class); assertThat(this.context.getBean(AuditEventRepository.class)) @@ -62,7 +62,7 @@ public class AuditAutoConfigurationTests { } @Test - public void ownAuthenticationAuditListener() throws Exception { + public void ownAuthenticationAuditListener() { registerAndRefresh(CustomAuthenticationAuditListenerConfiguration.class, AuditAutoConfiguration.class); assertThat(this.context.getBean(AbstractAuthenticationAuditListener.class)) @@ -70,7 +70,7 @@ public class AuditAutoConfigurationTests { } @Test - public void ownAuthorizationAuditListener() throws Exception { + public void ownAuthorizationAuditListener() { registerAndRefresh(CustomAuthorizationAuditListenerConfiguration.class, AuditAutoConfiguration.class); assertThat(this.context.getBean(AbstractAuthorizationAuditListener.class)) @@ -78,7 +78,7 @@ public class AuditAutoConfigurationTests { } @Test - public void ownAuditListener() throws Exception { + public void ownAuditListener() { registerAndRefresh(CustomAuditListenerConfiguration.class, AuditAutoConfiguration.class); assertThat(this.context.getBean(AbstractAuditListener.class)) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/audit/AuditEventsEndpointAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/audit/AuditEventsEndpointAutoConfigurationTests.java index 309e77c325..c345e348a0 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/audit/AuditEventsEndpointAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/audit/AuditEventsEndpointAutoConfigurationTests.java @@ -58,8 +58,7 @@ public class AuditEventsEndpointAutoConfigurationTests { } @Test - public void runWhenEnabledPropertyIsFalseShouldNotHaveEndpointOrExtensionBean() - throws Exception { + public void runWhenEnabledPropertyIsFalseShouldNotHaveEndpointOrExtensionBean() { this.contextRunner .withPropertyValues("management.endpoint.auditevents.enabled:false") .run((context) -> assertThat(context) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/beans/BeansEndpointAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/beans/BeansEndpointAutoConfigurationTests.java index 3fa11fb8c4..7a17887174 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/beans/BeansEndpointAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/beans/BeansEndpointAutoConfigurationTests.java @@ -42,8 +42,7 @@ public class BeansEndpointAutoConfigurationTests { } @Test - public void runWhenEnabledPropertyIsFalseShouldNotHaveEndpointBean() - throws Exception { + public void runWhenEnabledPropertyIsFalseShouldNotHaveEndpointBean() { this.contextRunner.withPropertyValues("management.endpoint.beans.enabled:false") .run((context) -> assertThat(context) .doesNotHaveBean(BeansEndpoint.class)); diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cassandra/CassandraHealthIndicatorAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cassandra/CassandraHealthIndicatorAutoConfigurationTests.java index 6bd030a6ee..b3ce8355f4 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cassandra/CassandraHealthIndicatorAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cassandra/CassandraHealthIndicatorAutoConfigurationTests.java @@ -44,14 +44,14 @@ public class CassandraHealthIndicatorAutoConfigurationTests { HealthIndicatorAutoConfiguration.class)); @Test - public void runShouldCreateIndicator() throws Exception { + public void runShouldCreateIndicator() { this.contextRunner.run((context) -> assertThat(context) .hasSingleBean(CassandraHealthIndicator.class) .doesNotHaveBean(ApplicationHealthIndicator.class)); } @Test - public void runWhenDisabledShouldNotCreateIndicator() throws Exception { + public void runWhenDisabledShouldNotCreateIndicator() { this.contextRunner.withPropertyValues("management.health.cassandra.enabled:false") .run((context) -> assertThat(context) .doesNotHaveBean(CassandraHealthIndicator.class) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/AccessLevelTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/AccessLevelTests.java index 50d6268bdf..3e1af9e259 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/AccessLevelTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/AccessLevelTests.java @@ -28,25 +28,25 @@ import static org.assertj.core.api.Assertions.assertThat; public class AccessLevelTests { @Test - public void accessToHealthEndpointShouldNotBeRestricted() throws Exception { + public void accessToHealthEndpointShouldNotBeRestricted() { assertThat(AccessLevel.RESTRICTED.isAccessAllowed("health")).isTrue(); assertThat(AccessLevel.FULL.isAccessAllowed("health")).isTrue(); } @Test - public void accessToInfoEndpointShouldNotBeRestricted() throws Exception { + public void accessToInfoEndpointShouldNotBeRestricted() { assertThat(AccessLevel.RESTRICTED.isAccessAllowed("info")).isTrue(); assertThat(AccessLevel.FULL.isAccessAllowed("info")).isTrue(); } @Test - public void accessToDiscoveryEndpointShouldNotBeRestricted() throws Exception { + public void accessToDiscoveryEndpointShouldNotBeRestricted() { assertThat(AccessLevel.RESTRICTED.isAccessAllowed("")).isTrue(); assertThat(AccessLevel.FULL.isAccessAllowed("")).isTrue(); } @Test - public void accessToAnyOtherEndpointShouldBeRestricted() throws Exception { + public void accessToAnyOtherEndpointShouldBeRestricted() { assertThat(AccessLevel.RESTRICTED.isAccessAllowed("env")).isFalse(); assertThat(AccessLevel.FULL.isAccessAllowed("")).isTrue(); } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/CloudFoundryAuthorizationExceptionTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/CloudFoundryAuthorizationExceptionTests.java index 46ae3be480..cc3c035a7f 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/CloudFoundryAuthorizationExceptionTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/CloudFoundryAuthorizationExceptionTests.java @@ -31,56 +31,55 @@ import static org.assertj.core.api.Assertions.assertThat; public class CloudFoundryAuthorizationExceptionTests { @Test - public void statusCodeForInvalidTokenReasonShouldBe401() throws Exception { + public void statusCodeForInvalidTokenReasonShouldBe401() { assertThat(createException(Reason.INVALID_TOKEN).getStatusCode()) .isEqualTo(HttpStatus.UNAUTHORIZED); } @Test - public void statusCodeForInvalidIssuerReasonShouldBe401() throws Exception { + public void statusCodeForInvalidIssuerReasonShouldBe401() { assertThat(createException(Reason.INVALID_ISSUER).getStatusCode()) .isEqualTo(HttpStatus.UNAUTHORIZED); } @Test - public void statusCodeForInvalidAudienceReasonShouldBe401() throws Exception { + public void statusCodeForInvalidAudienceReasonShouldBe401() { assertThat(createException(Reason.INVALID_AUDIENCE).getStatusCode()) .isEqualTo(HttpStatus.UNAUTHORIZED); } @Test - public void statusCodeForInvalidSignatureReasonShouldBe401() throws Exception { + public void statusCodeForInvalidSignatureReasonShouldBe401() { assertThat(createException(Reason.INVALID_SIGNATURE).getStatusCode()) .isEqualTo(HttpStatus.UNAUTHORIZED); } @Test - public void statusCodeForMissingAuthorizationReasonShouldBe401() throws Exception { + public void statusCodeForMissingAuthorizationReasonShouldBe401() { assertThat(createException(Reason.MISSING_AUTHORIZATION).getStatusCode()) .isEqualTo(HttpStatus.UNAUTHORIZED); } @Test - public void statusCodeForUnsupportedSignatureAlgorithmReasonShouldBe401() - throws Exception { + public void statusCodeForUnsupportedSignatureAlgorithmReasonShouldBe401() { assertThat(createException(Reason.UNSUPPORTED_TOKEN_SIGNING_ALGORITHM) .getStatusCode()).isEqualTo(HttpStatus.UNAUTHORIZED); } @Test - public void statusCodeForTokenExpiredReasonShouldBe401() throws Exception { + public void statusCodeForTokenExpiredReasonShouldBe401() { assertThat(createException(Reason.TOKEN_EXPIRED).getStatusCode()) .isEqualTo(HttpStatus.UNAUTHORIZED); } @Test - public void statusCodeForAccessDeniedReasonShouldBe403() throws Exception { + public void statusCodeForAccessDeniedReasonShouldBe403() { assertThat(createException(Reason.ACCESS_DENIED).getStatusCode()) .isEqualTo(HttpStatus.FORBIDDEN); } @Test - public void statusCodeForServiceUnavailableReasonShouldBe503() throws Exception { + public void statusCodeForServiceUnavailableReasonShouldBe503() { assertThat(createException(Reason.SERVICE_UNAVAILABLE).getStatusCode()) .isEqualTo(HttpStatus.SERVICE_UNAVAILABLE); } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/CloudFoundryEndpointFilterTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/CloudFoundryEndpointFilterTests.java index 9a5524cd89..35a9e32f5f 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/CloudFoundryEndpointFilterTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/CloudFoundryEndpointFilterTests.java @@ -43,19 +43,19 @@ public class CloudFoundryEndpointFilterTests { private CloudFoundryEndpointFilter filter; @Before - public void setUp() throws Exception { + public void setUp() { this.filter = new CloudFoundryEndpointFilter(); } @Test - public void matchIfDiscovererCloudFoundryShouldReturnFalse() throws Exception { + public void matchIfDiscovererCloudFoundryShouldReturnFalse() { CloudFoundryWebAnnotationEndpointDiscoverer discoverer = Mockito .mock(CloudFoundryWebAnnotationEndpointDiscoverer.class); assertThat(this.filter.match(null, discoverer)).isTrue(); } @Test - public void matchIfDiscovererNotCloudFoundryShouldReturnFalse() throws Exception { + public void matchIfDiscovererNotCloudFoundryShouldReturnFalse() { WebAnnotationEndpointDiscoverer discoverer = Mockito .mock(WebAnnotationEndpointDiscoverer.class); assertThat(this.filter.match(null, discoverer)).isFalse(); diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/CloudFoundryWebAnnotationEndpointDiscovererTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/CloudFoundryWebAnnotationEndpointDiscovererTests.java index 2f3881b6fc..b89c082b6a 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/CloudFoundryWebAnnotationEndpointDiscovererTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/CloudFoundryWebAnnotationEndpointDiscovererTests.java @@ -48,7 +48,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class CloudFoundryWebAnnotationEndpointDiscovererTests { @Test - public void discovererShouldAddSuppliedExtensionForHealthEndpoint() throws Exception { + public void discovererShouldAddSuppliedExtensionForHealthEndpoint() { load(TestConfiguration.class, (endpointDiscoverer) -> { Collection> endpoints = endpointDiscoverer .discoverEndpoints(); diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/TokenTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/TokenTests.java index 7a885e2939..d4670583bb 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/TokenTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/TokenTests.java @@ -36,14 +36,14 @@ public class TokenTests { public ExpectedException thrown = ExpectedException.none(); @Test - public void invalidJwtShouldThrowException() throws Exception { + public void invalidJwtShouldThrowException() { this.thrown .expect(AuthorizationExceptionMatcher.withReason(Reason.INVALID_TOKEN)); new Token("invalid-token"); } @Test - public void invalidJwtClaimsShouldThrowException() throws Exception { + public void invalidJwtClaimsShouldThrowException() { String header = "{\"alg\": \"RS256\", \"kid\": \"key-id\", \"typ\": \"JWT\"}"; String claims = "invalid-claims"; this.thrown @@ -53,7 +53,7 @@ public class TokenTests { } @Test - public void invalidJwtHeaderShouldThrowException() throws Exception { + public void invalidJwtHeaderShouldThrowException() { String header = "invalid-header"; String claims = "{\"exp\": 2147483647, \"iss\": \"http://localhost:8080/uaa/oauth/token\"}"; this.thrown @@ -63,7 +63,7 @@ public class TokenTests { } @Test - public void emptyJwtSignatureShouldThrowException() throws Exception { + public void emptyJwtSignatureShouldThrowException() { String token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ0b3B0YWwu" + "Y29tIiwiZXhwIjoxNDI2NDIwODAwLCJhd2Vzb21lIjp0cnVlfQ."; this.thrown @@ -72,7 +72,7 @@ public class TokenTests { } @Test - public void validJwt() throws Exception { + public void validJwt() { String header = "{\"alg\": \"RS256\", \"kid\": \"key-id\", \"typ\": \"JWT\"}"; String claims = "{\"exp\": 2147483647, \"iss\": \"http://localhost:8080/uaa/oauth/token\"}"; String content = Base64Utils.encodeToString(header.getBytes()) + "." @@ -89,8 +89,7 @@ public class TokenTests { } @Test - public void getSignatureAlgorithmWhenAlgIsNullShouldThrowException() - throws Exception { + public void getSignatureAlgorithmWhenAlgIsNullShouldThrowException() { String header = "{\"kid\": \"key-id\", \"typ\": \"JWT\"}"; String claims = "{\"exp\": 2147483647, \"iss\": \"http://localhost:8080/uaa/oauth/token\"}"; Token token = createToken(header, claims); @@ -100,7 +99,7 @@ public class TokenTests { } @Test - public void getIssuerWhenIssIsNullShouldThrowException() throws Exception { + public void getIssuerWhenIssIsNullShouldThrowException() { String header = "{\"alg\": \"RS256\", \"kid\": \"key-id\", \"typ\": \"JWT\"}"; String claims = "{\"exp\": 2147483647}"; Token token = createToken(header, claims); @@ -110,7 +109,7 @@ public class TokenTests { } @Test - public void getKidWhenKidIsNullShouldThrowException() throws Exception { + public void getKidWhenKidIsNullShouldThrowException() { String header = "{\"alg\": \"RS256\", \"typ\": \"JWT\"}"; String claims = "{\"exp\": 2147483647}"; Token token = createToken(header, claims); @@ -120,7 +119,7 @@ public class TokenTests { } @Test - public void getExpiryWhenExpIsNullShouldThrowException() throws Exception { + public void getExpiryWhenExpIsNullShouldThrowException() { String header = "{\"alg\": \"RS256\", \"kid\": \"key-id\", \"typ\": \"JWT\"}"; String claims = "{\"iss\": \"http://localhost:8080/uaa/oauth/token\"" + "}"; Token token = createToken(header, claims); diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/CloudFoundryWebFluxEndpointIntegrationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/CloudFoundryWebFluxEndpointIntegrationTests.java index dc4332e91a..6722ecb25f 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/CloudFoundryWebFluxEndpointIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/CloudFoundryWebFluxEndpointIntegrationTests.java @@ -78,7 +78,7 @@ public class CloudFoundryWebFluxEndpointIntegrationTests { ReactiveCloudFoundrySecurityService.class); @Test - public void operationWithSecurityInterceptorForbidden() throws Exception { + public void operationWithSecurityInterceptorForbidden() { given(tokenValidator.validate(any())).willReturn(Mono.empty()); given(securityService.getAccessLevel(any(), eq("app-id"))) .willReturn(Mono.just(AccessLevel.RESTRICTED)); @@ -90,7 +90,7 @@ public class CloudFoundryWebFluxEndpointIntegrationTests { } @Test - public void operationWithSecurityInterceptorSuccess() throws Exception { + public void operationWithSecurityInterceptorSuccess() { given(tokenValidator.validate(any())).willReturn(Mono.empty()); given(securityService.getAccessLevel(any(), eq("app-id"))) .willReturn(Mono.just(AccessLevel.FULL)); diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveCloudFoundryActuatorAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveCloudFoundryActuatorAutoConfigurationTests.java index 62124e8db2..d3cc6613ed 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveCloudFoundryActuatorAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveCloudFoundryActuatorAutoConfigurationTests.java @@ -83,7 +83,7 @@ public class ReactiveCloudFoundryActuatorAutoConfigurationTests { } @Test - public void cloudFoundryPlatformActive() throws Exception { + public void cloudFoundryPlatformActive() { setupContextWithCloudEnabled(); this.context.refresh(); CloudFoundryWebFluxEndpointHandlerMapping handlerMapping = getHandlerMapping(); @@ -100,7 +100,7 @@ public class ReactiveCloudFoundryActuatorAutoConfigurationTests { } @Test - public void cloudfoundryapplicationProducesActuatorMediaType() throws Exception { + public void cloudfoundryapplicationProducesActuatorMediaType() { setupContextWithCloudEnabled(); this.context.refresh(); WebTestClient webTestClient = WebTestClient.bindToApplicationContext(this.context) @@ -110,7 +110,7 @@ public class ReactiveCloudFoundryActuatorAutoConfigurationTests { } @Test - public void cloudFoundryPlatformActiveSetsApplicationId() throws Exception { + public void cloudFoundryPlatformActiveSetsApplicationId() { setupContextWithCloudEnabled(); this.context.refresh(); CloudFoundryWebFluxEndpointHandlerMapping handlerMapping = getHandlerMapping(); @@ -122,7 +122,7 @@ public class ReactiveCloudFoundryActuatorAutoConfigurationTests { } @Test - public void cloudFoundryPlatformActiveSetsCloudControllerUrl() throws Exception { + public void cloudFoundryPlatformActiveSetsCloudControllerUrl() { setupContextWithCloudEnabled(); this.context.refresh(); CloudFoundryWebFluxEndpointHandlerMapping handlerMapping = getHandlerMapping(); @@ -136,8 +136,7 @@ public class ReactiveCloudFoundryActuatorAutoConfigurationTests { } @Test - public void cloudFoundryPlatformActiveAndCloudControllerUrlNotPresent() - throws Exception { + public void cloudFoundryPlatformActiveAndCloudControllerUrlNotPresent() { TestPropertyValues .of("VCAP_APPLICATION:---", "vcap.application.application_id:my-app-id") .applyTo(this.context); @@ -155,7 +154,7 @@ public class ReactiveCloudFoundryActuatorAutoConfigurationTests { @Test @SuppressWarnings("unchecked") - public void cloudFoundryPathsIgnoredBySpringSecurity() throws Exception { + public void cloudFoundryPathsIgnoredBySpringSecurity() { setupContextWithCloudEnabled(); this.context.refresh(); WebFilterChainProxy chainProxy = this.context.getBean(WebFilterChainProxy.class); @@ -178,7 +177,7 @@ public class ReactiveCloudFoundryActuatorAutoConfigurationTests { } @Test - public void cloudFoundryPlatformInactive() throws Exception { + public void cloudFoundryPlatformInactive() { setupContext(); this.context.refresh(); assertThat(this.context.containsBean("cloudFoundryWebFluxEndpointHandlerMapping")) @@ -186,7 +185,7 @@ public class ReactiveCloudFoundryActuatorAutoConfigurationTests { } @Test - public void cloudFoundryManagementEndpointsDisabled() throws Exception { + public void cloudFoundryManagementEndpointsDisabled() { setupContextWithCloudEnabled(); TestPropertyValues .of("VCAP_APPLICATION=---", "management.cloudfoundry.enabled:false") @@ -197,8 +196,7 @@ public class ReactiveCloudFoundryActuatorAutoConfigurationTests { } @Test - public void allEndpointsAvailableUnderCloudFoundryWithoutEnablingWebIncludes() - throws Exception { + public void allEndpointsAvailableUnderCloudFoundryWithoutEnablingWebIncludes() { setupContextWithCloudEnabled(); this.context.register(TestConfiguration.class); this.context.refresh(); @@ -211,7 +209,7 @@ public class ReactiveCloudFoundryActuatorAutoConfigurationTests { } @Test - public void endpointPathCustomizationIsNotApplied() throws Exception { + public void endpointPathCustomizationIsNotApplied() { setupContextWithCloudEnabled(); this.context.register(TestConfiguration.class); this.context.refresh(); @@ -227,7 +225,7 @@ public class ReactiveCloudFoundryActuatorAutoConfigurationTests { } @Test - public void healthEndpointInvokerShouldBeCloudFoundryWebExtension() throws Exception { + public void healthEndpointInvokerShouldBeCloudFoundryWebExtension() { setupContextWithCloudEnabled(); this.context.register(HealthEndpointAutoConfiguration.class, HealthWebEndpointManagementContextConfiguration.class, diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveCloudFoundrySecurityInterceptorTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveCloudFoundrySecurityInterceptorTests.java index bc5b533b82..851ec6b5f3 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveCloudFoundrySecurityInterceptorTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveCloudFoundrySecurityInterceptorTests.java @@ -52,14 +52,14 @@ public class ReactiveCloudFoundrySecurityInterceptorTests { private ReactiveCloudFoundrySecurityInterceptor interceptor; @Before - public void setup() throws Exception { + public void setup() { MockitoAnnotations.initMocks(this); this.interceptor = new ReactiveCloudFoundrySecurityInterceptor( this.tokenValidator, this.securityService, "my-app-id"); } @Test - public void preHandleWhenRequestIsPreFlightShouldBeOk() throws Exception { + public void preHandleWhenRequestIsPreFlightShouldBeOk() { MockServerWebExchange request = MockServerWebExchange.from(MockServerHttpRequest .options("/a").header(HttpHeaders.ORIGIN, "http://example.com") .header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET").build()); @@ -69,8 +69,7 @@ public class ReactiveCloudFoundrySecurityInterceptorTests { } @Test - public void preHandleWhenTokenIsMissingShouldReturnMissingAuthorization() - throws Exception { + public void preHandleWhenTokenIsMissingShouldReturnMissingAuthorization() { MockServerWebExchange request = MockServerWebExchange .from(MockServerHttpRequest.get("/a").build()); StepVerifier.create(this.interceptor.preHandle(request, "/a")) @@ -80,8 +79,7 @@ public class ReactiveCloudFoundrySecurityInterceptorTests { } @Test - public void preHandleWhenTokenIsNotBearerShouldReturnMissingAuthorization() - throws Exception { + public void preHandleWhenTokenIsNotBearerShouldReturnMissingAuthorization() { MockServerWebExchange request = MockServerWebExchange.from(MockServerHttpRequest .get("/a").header(HttpHeaders.AUTHORIZATION, mockAccessToken()).build()); StepVerifier.create(this.interceptor.preHandle(request, "/a")) @@ -91,7 +89,7 @@ public class ReactiveCloudFoundrySecurityInterceptorTests { } @Test - public void preHandleWhenApplicationIdIsNullShouldReturnError() throws Exception { + public void preHandleWhenApplicationIdIsNullShouldReturnError() { this.interceptor = new ReactiveCloudFoundrySecurityInterceptor( this.tokenValidator, this.securityService, null); MockServerWebExchange request = MockServerWebExchange @@ -106,8 +104,7 @@ public class ReactiveCloudFoundrySecurityInterceptorTests { } @Test - public void preHandleWhenCloudFoundrySecurityServiceIsNullShouldReturnError() - throws Exception { + public void preHandleWhenCloudFoundrySecurityServiceIsNullShouldReturnError() { this.interceptor = new ReactiveCloudFoundrySecurityInterceptor( this.tokenValidator, null, "my-app-id"); MockServerWebExchange request = MockServerWebExchange.from(MockServerHttpRequest @@ -120,8 +117,7 @@ public class ReactiveCloudFoundrySecurityInterceptorTests { } @Test - public void preHandleWhenAccessIsNotAllowedShouldReturnAccessDenied() - throws Exception { + public void preHandleWhenAccessIsNotAllowedShouldReturnAccessDenied() { given(this.securityService.getAccessLevel(mockAccessToken(), "my-app-id")) .willReturn(Mono.just(AccessLevel.RESTRICTED)); given(this.tokenValidator.validate(any())).willReturn(Mono.empty()); @@ -136,7 +132,7 @@ public class ReactiveCloudFoundrySecurityInterceptorTests { } @Test - public void preHandleSuccessfulWithFullAccess() throws Exception { + public void preHandleSuccessfulWithFullAccess() { String accessToken = mockAccessToken(); given(this.securityService.getAccessLevel(accessToken, "my-app-id")) .willReturn(Mono.just(AccessLevel.FULL)); @@ -155,7 +151,7 @@ public class ReactiveCloudFoundrySecurityInterceptorTests { } @Test - public void preHandleSuccessfulWithRestrictedAccess() throws Exception { + public void preHandleSuccessfulWithRestrictedAccess() { String accessToken = mockAccessToken(); given(this.securityService.getAccessLevel(accessToken, "my-app-id")) .willReturn(Mono.just(AccessLevel.RESTRICTED)); diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveCloudFoundrySecurityServiceTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveCloudFoundrySecurityServiceTests.java index 18fa79c277..99dbe13349 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveCloudFoundrySecurityServiceTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveCloudFoundrySecurityServiceTests.java @@ -55,7 +55,7 @@ public class ReactiveCloudFoundrySecurityServiceTests { private WebClient.Builder builder; @Before - public void setup() throws Exception { + public void setup() { this.server = new MockWebServer(); this.builder = WebClient.builder().baseUrl(this.server.url("/").toString()); this.securityService = new ReactiveCloudFoundrySecurityService(this.builder, diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveTokenValidatorTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveTokenValidatorTests.java index f2555572b4..e12789540f 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveTokenValidatorTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveTokenValidatorTests.java @@ -85,7 +85,7 @@ public class ReactiveTokenValidatorTests { private static final Map VALID_KEYS = new ConcurrentHashMap<>(); @Before - public void setup() throws Exception { + public void setup() { MockitoAnnotations.initMocks(this); VALID_KEYS.put("valid-key", VALID_KEY); INVALID_KEYS.put("invalid-key", INVALID_KEY); diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundryActuatorAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundryActuatorAutoConfigurationTests.java index 454bc65ead..9ef59344cf 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundryActuatorAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundryActuatorAutoConfigurationTests.java @@ -98,7 +98,7 @@ public class CloudFoundryActuatorAutoConfigurationTests { } @Test - public void cloudFoundryPlatformActive() throws Exception { + public void cloudFoundryPlatformActive() { CloudFoundryWebEndpointServletHandlerMapping handlerMapping = getHandlerMapping(); assertThat(handlerMapping.getEndpointMapping().getPath()) .isEqualTo("/cloudfoundryapplication"); @@ -124,7 +124,7 @@ public class CloudFoundryActuatorAutoConfigurationTests { } @Test - public void cloudFoundryPlatformActiveSetsApplicationId() throws Exception { + public void cloudFoundryPlatformActiveSetsApplicationId() { CloudFoundryWebEndpointServletHandlerMapping handlerMapping = getHandlerMapping(); Object interceptor = ReflectionTestUtils.getField(handlerMapping, "securityInterceptor"); @@ -134,7 +134,7 @@ public class CloudFoundryActuatorAutoConfigurationTests { } @Test - public void cloudFoundryPlatformActiveSetsCloudControllerUrl() throws Exception { + public void cloudFoundryPlatformActiveSetsCloudControllerUrl() { CloudFoundryWebEndpointServletHandlerMapping handlerMapping = getHandlerMapping(); Object interceptor = ReflectionTestUtils.getField(handlerMapping, "securityInterceptor"); @@ -146,7 +146,7 @@ public class CloudFoundryActuatorAutoConfigurationTests { } @Test - public void skipSslValidation() throws Exception { + public void skipSslValidation() { TestPropertyValues.of("management.cloudfoundry.skipSslValidation:true") .applyTo(this.context); ConfigurationPropertySources.attach(this.context.getEnvironment()); @@ -163,8 +163,7 @@ public class CloudFoundryActuatorAutoConfigurationTests { } @Test - public void cloudFoundryPlatformActiveAndCloudControllerUrlNotPresent() - throws Exception { + public void cloudFoundryPlatformActiveAndCloudControllerUrlNotPresent() { TestPropertyValues .of("VCAP_APPLICATION:---", "vcap.application.application_id:my-app-id") .applyTo(this.context); @@ -180,7 +179,7 @@ public class CloudFoundryActuatorAutoConfigurationTests { } @Test - public void cloudFoundryPathsIgnoredBySpringSecurity() throws Exception { + public void cloudFoundryPathsIgnoredBySpringSecurity() { TestPropertyValues .of("VCAP_APPLICATION:---", "vcap.application.application_id:my-app-id") .applyTo(this.context); @@ -197,7 +196,7 @@ public class CloudFoundryActuatorAutoConfigurationTests { } @Test - public void cloudFoundryPlatformInactive() throws Exception { + public void cloudFoundryPlatformInactive() { this.context.refresh(); assertThat( this.context.containsBean("cloudFoundryWebEndpointServletHandlerMapping")) @@ -205,7 +204,7 @@ public class CloudFoundryActuatorAutoConfigurationTests { } @Test - public void cloudFoundryManagementEndpointsDisabled() throws Exception { + public void cloudFoundryManagementEndpointsDisabled() { TestPropertyValues .of("VCAP_APPLICATION=---", "management.cloudfoundry.enabled:false") .applyTo(this.context); @@ -215,8 +214,7 @@ public class CloudFoundryActuatorAutoConfigurationTests { } @Test - public void allEndpointsAvailableUnderCloudFoundryWithoutExposeAllOnWeb() - throws Exception { + public void allEndpointsAvailableUnderCloudFoundryWithoutExposeAllOnWeb() { this.context.register(TestConfiguration.class); this.context.refresh(); CloudFoundryWebEndpointServletHandlerMapping handlerMapping = getHandlerMapping(); @@ -228,7 +226,7 @@ public class CloudFoundryActuatorAutoConfigurationTests { } @Test - public void endpointPathCustomizationIsNotApplied() throws Exception { + public void endpointPathCustomizationIsNotApplied() { TestPropertyValues.of("management.endpoints.web.path-mapping.test=custom") .applyTo(this.context); this.context.register(TestConfiguration.class); @@ -246,7 +244,7 @@ public class CloudFoundryActuatorAutoConfigurationTests { } @Test - public void healthEndpointInvokerShouldBeCloudFoundryWebExtension() throws Exception { + public void healthEndpointInvokerShouldBeCloudFoundryWebExtension() { TestPropertyValues .of("VCAP_APPLICATION:---", "vcap.application.application_id:my-app-id", "vcap.application.cf_api:http://my-cloud-controller.com") diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundryMvcWebEndpointIntegrationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundryMvcWebEndpointIntegrationTests.java index 04faa3bf5e..174d44b193 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundryMvcWebEndpointIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundryMvcWebEndpointIntegrationTests.java @@ -73,7 +73,7 @@ public class CloudFoundryMvcWebEndpointIntegrationTests { CloudFoundrySecurityService.class); @Test - public void operationWithSecurityInterceptorForbidden() throws Exception { + public void operationWithSecurityInterceptorForbidden() { given(securityService.getAccessLevel(any(), eq("app-id"))) .willReturn(AccessLevel.RESTRICTED); load(TestEndpointConfiguration.class, @@ -84,7 +84,7 @@ public class CloudFoundryMvcWebEndpointIntegrationTests { } @Test - public void operationWithSecurityInterceptorSuccess() throws Exception { + public void operationWithSecurityInterceptorSuccess() { given(securityService.getAccessLevel(any(), eq("app-id"))) .willReturn(AccessLevel.FULL); load(TestEndpointConfiguration.class, diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundrySecurityInterceptorTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundrySecurityInterceptorTests.java index b83b522135..d1b4da936d 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundrySecurityInterceptorTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundrySecurityInterceptorTests.java @@ -53,7 +53,7 @@ public class CloudFoundrySecurityInterceptorTests { private MockHttpServletRequest request; @Before - public void setup() throws Exception { + public void setup() { MockitoAnnotations.initMocks(this); this.interceptor = new CloudFoundrySecurityInterceptor(this.tokenValidator, this.securityService, "my-app-id"); @@ -61,7 +61,7 @@ public class CloudFoundrySecurityInterceptorTests { } @Test - public void preHandleWhenRequestIsPreFlightShouldReturnTrue() throws Exception { + public void preHandleWhenRequestIsPreFlightShouldReturnTrue() { this.request.setMethod("OPTIONS"); this.request.addHeader(HttpHeaders.ORIGIN, "http://example.com"); this.request.addHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET"); @@ -70,14 +70,14 @@ public class CloudFoundrySecurityInterceptorTests { } @Test - public void preHandleWhenTokenIsMissingShouldReturnFalse() throws Exception { + public void preHandleWhenTokenIsMissingShouldReturnFalse() { SecurityResponse response = this.interceptor.preHandle(this.request, "/a"); assertThat(response.getStatus()) .isEqualTo(Reason.MISSING_AUTHORIZATION.getStatus()); } @Test - public void preHandleWhenTokenIsNotBearerShouldReturnFalse() throws Exception { + public void preHandleWhenTokenIsNotBearerShouldReturnFalse() { this.request.addHeader("Authorization", mockAccessToken()); SecurityResponse response = this.interceptor.preHandle(this.request, "/a"); assertThat(response.getStatus()) @@ -85,7 +85,7 @@ public class CloudFoundrySecurityInterceptorTests { } @Test - public void preHandleWhenApplicationIdIsNullShouldReturnFalse() throws Exception { + public void preHandleWhenApplicationIdIsNullShouldReturnFalse() { this.interceptor = new CloudFoundrySecurityInterceptor(this.tokenValidator, this.securityService, null); this.request.addHeader("Authorization", "bearer " + mockAccessToken()); @@ -95,8 +95,7 @@ public class CloudFoundrySecurityInterceptorTests { } @Test - public void preHandleWhenCloudFoundrySecurityServiceIsNullShouldReturnFalse() - throws Exception { + public void preHandleWhenCloudFoundrySecurityServiceIsNullShouldReturnFalse() { this.interceptor = new CloudFoundrySecurityInterceptor(this.tokenValidator, null, "my-app-id"); this.request.addHeader("Authorization", "bearer " + mockAccessToken()); @@ -106,7 +105,7 @@ public class CloudFoundrySecurityInterceptorTests { } @Test - public void preHandleWhenAccessIsNotAllowedShouldReturnFalse() throws Exception { + public void preHandleWhenAccessIsNotAllowedShouldReturnFalse() { String accessToken = mockAccessToken(); this.request.addHeader("Authorization", "bearer " + accessToken); given(this.securityService.getAccessLevel(accessToken, "my-app-id")) @@ -116,7 +115,7 @@ public class CloudFoundrySecurityInterceptorTests { } @Test - public void preHandleSuccessfulWithFullAccess() throws Exception { + public void preHandleSuccessfulWithFullAccess() { String accessToken = mockAccessToken(); this.request.addHeader("Authorization", "Bearer " + accessToken); given(this.securityService.getAccessLevel(accessToken, "my-app-id")) @@ -132,7 +131,7 @@ public class CloudFoundrySecurityInterceptorTests { } @Test - public void preHandleSuccessfulWithRestrictedAccess() throws Exception { + public void preHandleSuccessfulWithRestrictedAccess() { String accessToken = mockAccessToken(); this.request.addHeader("Authorization", "Bearer " + accessToken); given(this.securityService.getAccessLevel(accessToken, "my-app-id")) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundrySecurityServiceTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundrySecurityServiceTests.java index 5304465197..6be4bec67b 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundrySecurityServiceTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundrySecurityServiceTests.java @@ -64,7 +64,7 @@ public class CloudFoundrySecurityServiceTests { private MockRestServiceServer server; @Before - public void setup() throws Exception { + public void setup() { MockServerRestTemplateCustomizer mockServerCustomizer = new MockServerRestTemplateCustomizer(); RestTemplateBuilder builder = new RestTemplateBuilder(mockServerCustomizer); this.securityService = new CloudFoundrySecurityService(builder, CLOUD_CONTROLLER, @@ -73,7 +73,7 @@ public class CloudFoundrySecurityServiceTests { } @Test - public void skipSslValidationWhenTrue() throws Exception { + public void skipSslValidationWhenTrue() { RestTemplateBuilder builder = new RestTemplateBuilder(); this.securityService = new CloudFoundrySecurityService(builder, CLOUD_CONTROLLER, true); @@ -84,7 +84,7 @@ public class CloudFoundrySecurityServiceTests { } @Test - public void doNotskipSslValidationWhenFalse() throws Exception { + public void doNotskipSslValidationWhenFalse() { RestTemplateBuilder builder = new RestTemplateBuilder(); this.securityService = new CloudFoundrySecurityService(builder, CLOUD_CONTROLLER, false); @@ -95,7 +95,7 @@ public class CloudFoundrySecurityServiceTests { } @Test - public void getAccessLevelWhenSpaceDeveloperShouldReturnFull() throws Exception { + public void getAccessLevelWhenSpaceDeveloperShouldReturnFull() { String responseBody = "{\"read_sensitive_data\": true,\"read_basic_data\": true}"; this.server.expect(requestTo(CLOUD_CONTROLLER_PERMISSIONS)) .andExpect(header("Authorization", "bearer my-access-token")) @@ -107,8 +107,7 @@ public class CloudFoundrySecurityServiceTests { } @Test - public void getAccessLevelWhenNotSpaceDeveloperShouldReturnRestricted() - throws Exception { + public void getAccessLevelWhenNotSpaceDeveloperShouldReturnRestricted() { String responseBody = "{\"read_sensitive_data\": false,\"read_basic_data\": true}"; this.server.expect(requestTo(CLOUD_CONTROLLER_PERMISSIONS)) .andExpect(header("Authorization", "bearer my-access-token")) @@ -120,7 +119,7 @@ public class CloudFoundrySecurityServiceTests { } @Test - public void getAccessLevelWhenTokenIsNotValidShouldThrowException() throws Exception { + public void getAccessLevelWhenTokenIsNotValidShouldThrowException() { this.server.expect(requestTo(CLOUD_CONTROLLER_PERMISSIONS)) .andExpect(header("Authorization", "bearer my-access-token")) .andRespond(withUnauthorizedRequest()); @@ -130,7 +129,7 @@ public class CloudFoundrySecurityServiceTests { } @Test - public void getAccessLevelWhenForbiddenShouldThrowException() throws Exception { + public void getAccessLevelWhenForbiddenShouldThrowException() { this.server.expect(requestTo(CLOUD_CONTROLLER_PERMISSIONS)) .andExpect(header("Authorization", "bearer my-access-token")) .andRespond(withStatus(HttpStatus.FORBIDDEN)); @@ -140,8 +139,7 @@ public class CloudFoundrySecurityServiceTests { } @Test - public void getAccessLevelWhenCloudControllerIsNotReachableThrowsException() - throws Exception { + public void getAccessLevelWhenCloudControllerIsNotReachableThrowsException() { this.server.expect(requestTo(CLOUD_CONTROLLER_PERMISSIONS)) .andExpect(header("Authorization", "bearer my-access-token")) .andRespond(withServerError()); @@ -151,8 +149,7 @@ public class CloudFoundrySecurityServiceTests { } @Test - public void fetchTokenKeysWhenSuccessfulShouldReturnListOfKeysFromUAA() - throws Exception { + public void fetchTokenKeysWhenSuccessfulShouldReturnListOfKeysFromUAA() { this.server.expect(requestTo(CLOUD_CONTROLLER + "/info")) .andRespond(withSuccess("{\"token_endpoint\":\"http://my-uaa.com\"}", MediaType.APPLICATION_JSON)); @@ -174,7 +171,7 @@ public class CloudFoundrySecurityServiceTests { } @Test - public void fetchTokenKeysWhenNoKeysReturnedFromUAA() throws Exception { + public void fetchTokenKeysWhenNoKeysReturnedFromUAA() { this.server.expect(requestTo(CLOUD_CONTROLLER + "/info")).andRespond(withSuccess( "{\"token_endpoint\":\"" + UAA_URL + "\"}", MediaType.APPLICATION_JSON)); String responseBody = "{\"keys\": []}"; @@ -186,7 +183,7 @@ public class CloudFoundrySecurityServiceTests { } @Test - public void fetchTokenKeysWhenUnsuccessfulShouldThrowException() throws Exception { + public void fetchTokenKeysWhenUnsuccessfulShouldThrowException() { this.server.expect(requestTo(CLOUD_CONTROLLER + "/info")).andRespond(withSuccess( "{\"token_endpoint\":\"" + UAA_URL + "\"}", MediaType.APPLICATION_JSON)); this.server.expect(requestTo(UAA_URL + "/token_keys")) @@ -197,7 +194,7 @@ public class CloudFoundrySecurityServiceTests { } @Test - public void getUaaUrlShouldCallCloudControllerInfoOnlyOnce() throws Exception { + public void getUaaUrlShouldCallCloudControllerInfoOnlyOnce() { this.server.expect(requestTo(CLOUD_CONTROLLER + "/info")).andRespond(withSuccess( "{\"token_endpoint\":\"" + UAA_URL + "\"}", MediaType.APPLICATION_JSON)); String uaaUrl = this.securityService.getUaaUrl(); @@ -209,8 +206,7 @@ public class CloudFoundrySecurityServiceTests { } @Test - public void getUaaUrlWhenCloudControllerUrlIsNotReachableShouldThrowException() - throws Exception { + public void getUaaUrlWhenCloudControllerUrlIsNotReachableShouldThrowException() { this.server.expect(requestTo(CLOUD_CONTROLLER + "/info")) .andRespond(withServerError()); this.thrown.expect( diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/SkipSslVerificationHttpRequestFactoryTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/SkipSslVerificationHttpRequestFactoryTests.java index 8e3a474149..fa58e753d7 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/SkipSslVerificationHttpRequestFactoryTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/SkipSslVerificationHttpRequestFactoryTests.java @@ -55,7 +55,7 @@ public class SkipSslVerificationHttpRequestFactoryTests { } @Test - public void restCallToSelfSignedServerShouldNotThrowSslException() throws Exception { + public void restCallToSelfSignedServerShouldNotThrowSslException() { String httpsUrl = getHttpsUrl(); SkipSslVerificationHttpRequestFactory requestFactory = new SkipSslVerificationHttpRequestFactory(); RestTemplate restTemplate = new RestTemplate(requestFactory); diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/TokenValidatorTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/TokenValidatorTests.java index a4361ae4e6..2cad69e7b3 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/TokenValidatorTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/TokenValidatorTests.java @@ -89,7 +89,7 @@ public class TokenValidatorTests { .singletonMap("valid-key", VALID_KEY); @Before - public void setup() throws Exception { + public void setup() { MockitoAnnotations.initMocks(this); this.tokenValidator = new TokenValidator(this.securityService); } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/condition/ConditionsReportEndpointAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/condition/ConditionsReportEndpointAutoConfigurationTests.java index a95ceb9fc8..4b327cb943 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/condition/ConditionsReportEndpointAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/condition/ConditionsReportEndpointAutoConfigurationTests.java @@ -41,8 +41,7 @@ public class ConditionsReportEndpointAutoConfigurationTests { } @Test - public void runWhenEnabledPropertyIsFalseShouldNotHaveEndpointBean() - throws Exception { + public void runWhenEnabledPropertyIsFalseShouldNotHaveEndpointBean() { this.contextRunner .withPropertyValues("management.endpoint.conditions.enabled:false") .run((context) -> assertThat(context) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/condition/ConditionsReportEndpointTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/condition/ConditionsReportEndpointTests.java index 68eb15802a..546c92e5c5 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/condition/ConditionsReportEndpointTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/condition/ConditionsReportEndpointTests.java @@ -46,7 +46,7 @@ import static org.mockito.Mockito.mock; public class ConditionsReportEndpointTests { @Test - public void invoke() throws Exception { + public void invoke() { new ApplicationContextRunner().withUserConfiguration(Config.class) .run((context) -> { Report report = context.getBean(ConditionsReportEndpoint.class) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/context/ShutdownEndpointAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/context/ShutdownEndpointAutoConfigurationTests.java index 665207a1cf..46929f2ded 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/context/ShutdownEndpointAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/context/ShutdownEndpointAutoConfigurationTests.java @@ -43,8 +43,7 @@ public class ShutdownEndpointAutoConfigurationTests { } @Test - public void runWhenEnabledPropertyIsFalseShouldNotHaveEndpointBean() - throws Exception { + public void runWhenEnabledPropertyIsFalseShouldNotHaveEndpointBean() { this.contextRunner .withPropertyValues("management.endpoint.shutdown.enabled:false") .run((context) -> assertThat(context) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/context/properties/ConfigurationPropertiesReportEndpointAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/context/properties/ConfigurationPropertiesReportEndpointAutoConfigurationTests.java index f57788cb1f..827620ac26 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/context/properties/ConfigurationPropertiesReportEndpointAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/context/properties/ConfigurationPropertiesReportEndpointAutoConfigurationTests.java @@ -51,8 +51,7 @@ public class ConfigurationPropertiesReportEndpointAutoConfigurationTests { } @Test - public void runWhenEnabledPropertyIsFalseShouldNotHaveEndpointBean() - throws Exception { + public void runWhenEnabledPropertyIsFalseShouldNotHaveEndpointBean() { this.contextRunner .withPropertyValues("management.endpoint.configprops.enabled:false") .run((context) -> assertThat(context) @@ -60,7 +59,7 @@ public class ConfigurationPropertiesReportEndpointAutoConfigurationTests { } @Test - public void keysToSanitizeCanBeConfiguredViaTheEnvironment() throws Exception { + public void keysToSanitizeCanBeConfiguredViaTheEnvironment() { this.contextRunner.withUserConfiguration(Config.class) .withPropertyValues( "management.endpoint.configprops.keys-to-sanitize: .*pass.*, property") diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseHealthIndicatorAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseHealthIndicatorAutoConfigurationTests.java index d5b207048b..fe73b08544 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseHealthIndicatorAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/couchbase/CouchbaseHealthIndicatorAutoConfigurationTests.java @@ -44,14 +44,14 @@ public class CouchbaseHealthIndicatorAutoConfigurationTests { HealthIndicatorAutoConfiguration.class)); @Test - public void runShouldCreateIndicator() throws Exception { + public void runShouldCreateIndicator() { this.contextRunner.run((context) -> assertThat(context) .hasSingleBean(CouchbaseHealthIndicator.class) .doesNotHaveBean(ApplicationHealthIndicator.class)); } @Test - public void runWhenDisabledShouldNotCreateIndicator() throws Exception { + public void runWhenDisabledShouldNotCreateIndicator() { this.contextRunner.withPropertyValues("management.health.couchbase.enabled:false") .run((context) -> assertThat(context) .doesNotHaveBean(CouchbaseHealthIndicator.class) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/elasticsearch/ElasticsearchHealthIndicatorAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/elasticsearch/ElasticsearchHealthIndicatorAutoConfigurationTests.java index d1b0e39594..52ebfa2389 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/elasticsearch/ElasticsearchHealthIndicatorAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/elasticsearch/ElasticsearchHealthIndicatorAutoConfigurationTests.java @@ -47,7 +47,7 @@ public class ElasticsearchHealthIndicatorAutoConfigurationTests { HealthIndicatorAutoConfiguration.class)); @Test - public void runShouldCreateIndicator() throws Exception { + public void runShouldCreateIndicator() { this.contextRunner .withPropertyValues("spring.data.elasticsearch.cluster-nodes:localhost:0") .withSystemProperties("es.set.netty.runtime.available.processors=false") @@ -58,7 +58,7 @@ public class ElasticsearchHealthIndicatorAutoConfigurationTests { } @Test - public void runWhenUsingJestClientShouldCreateIndicator() throws Exception { + public void runWhenUsingJestClientShouldCreateIndicator() { this.contextRunner.withUserConfiguration(JestClientConfiguration.class) .withSystemProperties("es.set.netty.runtime.available.processors=false") .run((context) -> assertThat(context) @@ -68,7 +68,7 @@ public class ElasticsearchHealthIndicatorAutoConfigurationTests { } @Test - public void runWhenDisabledShouldNotCreateIndicator() throws Exception { + public void runWhenDisabledShouldNotCreateIndicator() { this.contextRunner .withPropertyValues("management.health.elasticsearch.enabled:false") .run((context) -> assertThat(context) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/ExposeExcludePropertyEndpointFilterTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/ExposeExcludePropertyEndpointFilterTests.java index d39bc3739f..88b3d8f5ae 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/ExposeExcludePropertyEndpointFilterTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/ExposeExcludePropertyEndpointFilterTests.java @@ -56,14 +56,14 @@ public class ExposeExcludePropertyEndpointFilterTests { } @Test - public void createWhenDiscovererTypeIsNullShouldThrowException() throws Exception { + public void createWhenDiscovererTypeIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Discoverer Type must not be null"); new ExposeExcludePropertyEndpointFilter<>(null, this.environment, "foo"); } @Test - public void createWhenEnvironmentIsNullShouldThrowException() throws Exception { + public void createWhenEnvironmentIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Environment must not be null"); new ExposeExcludePropertyEndpointFilter<>(TestEndpointDiscoverer.class, null, @@ -71,7 +71,7 @@ public class ExposeExcludePropertyEndpointFilterTests { } @Test - public void createWhenPrefixIsNullShouldThrowException() throws Exception { + public void createWhenPrefixIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Prefix must not be empty"); new ExposeExcludePropertyEndpointFilter(TestEndpointDiscoverer.class, @@ -79,7 +79,7 @@ public class ExposeExcludePropertyEndpointFilterTests { } @Test - public void createWhenPrefixIsEmptyShouldThrowException() throws Exception { + public void createWhenPrefixIsEmptyShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Prefix must not be empty"); new ExposeExcludePropertyEndpointFilter(TestEndpointDiscoverer.class, @@ -87,53 +87,49 @@ public class ExposeExcludePropertyEndpointFilterTests { } @Test - public void matchWhenExposeIsEmptyAndExcludeIsEmptyAndInDefaultShouldMatch() - throws Exception { + public void matchWhenExposeIsEmptyAndExcludeIsEmptyAndInDefaultShouldMatch() { setupFilter("", ""); assertThat(match("def")).isTrue(); } @Test - public void matchWhenExposeIsEmptyAndExcludeIsEmptyAndNotInDefaultShouldNotMatch() - throws Exception { + public void matchWhenExposeIsEmptyAndExcludeIsEmptyAndNotInDefaultShouldNotMatch() { setupFilter("", ""); assertThat(match("bar")).isFalse(); } @Test - public void matchWhenExposeMatchesAndExcludeIsEmptyShouldMatch() throws Exception { + public void matchWhenExposeMatchesAndExcludeIsEmptyShouldMatch() { setupFilter("bar", ""); assertThat(match("bar")).isTrue(); } @Test - public void matchWhenExposeDoesNotMatchAndExcludeIsEmptyShouldNotMatch() - throws Exception { + public void matchWhenExposeDoesNotMatchAndExcludeIsEmptyShouldNotMatch() { setupFilter("bar", ""); assertThat(match("baz")).isFalse(); } @Test - public void matchWhenExposeMatchesAndExcludeMatchesShouldNotMatch() throws Exception { + public void matchWhenExposeMatchesAndExcludeMatchesShouldNotMatch() { setupFilter("bar,baz", "baz"); assertThat(match("baz")).isFalse(); } @Test - public void matchWhenExposeMatchesAndExcludeDoesNotMatchShouldMatch() - throws Exception { + public void matchWhenExposeMatchesAndExcludeDoesNotMatchShouldMatch() { setupFilter("bar,baz", "buz"); assertThat(match("baz")).isTrue(); } @Test - public void matchWhenExposeMatchesWithDifferentCaseShouldMatch() throws Exception { + public void matchWhenExposeMatchesWithDifferentCaseShouldMatch() { setupFilter("bar", ""); assertThat(match("bAr")).isTrue(); } @Test - public void matchWhenDiscovererDoesNotMatchShouldMatch() throws Exception { + public void matchWhenDiscovererDoesNotMatchShouldMatch() { this.environment.setProperty("foo.expose", "bar"); this.environment.setProperty("foo.exclude", ""); this.filter = new ExposeExcludePropertyEndpointFilter<>( @@ -142,7 +138,7 @@ public class ExposeExcludePropertyEndpointFilterTests { } @Test - public void matchWhenIncludeIsAsteriskShouldMatchAll() throws Exception { + public void matchWhenIncludeIsAsteriskShouldMatchAll() { setupFilter("*", "buz"); assertThat(match("bar")).isTrue(); assertThat(match("baz")).isTrue(); @@ -150,7 +146,7 @@ public class ExposeExcludePropertyEndpointFilterTests { } @Test - public void matchWhenExcludeIsAsteriskShouldMatchNone() throws Exception { + public void matchWhenExcludeIsAsteriskShouldMatchNone() { setupFilter("bar,baz,buz", "*"); assertThat(match("bar")).isFalse(); assertThat(match("baz")).isFalse(); diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/condition/ConditionalOnEnabledEndpointTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/condition/ConditionalOnEnabledEndpointTests.java index aac943b227..9efeb38f9f 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/condition/ConditionalOnEnabledEndpointTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/condition/ConditionalOnEnabledEndpointTests.java @@ -41,7 +41,7 @@ public class ConditionalOnEnabledEndpointTests { private final ApplicationContextRunner contextRunner = new ApplicationContextRunner(); @Test - public void outcomeWhenEndpointEnabledPropertyIsTrueShouldMatch() throws Exception { + public void outcomeWhenEndpointEnabledPropertyIsTrueShouldMatch() { this.contextRunner.withPropertyValues("management.endpoint.foo.enabled=true") .withUserConfiguration( FooEndpointEnabledByDefaultFalseConfiguration.class) @@ -49,16 +49,14 @@ public class ConditionalOnEnabledEndpointTests { } @Test - public void outcomeWhenEndpointEnabledPropertyIsFalseShouldNotMatch() - throws Exception { + public void outcomeWhenEndpointEnabledPropertyIsFalseShouldNotMatch() { this.contextRunner.withPropertyValues("management.endpoint.foo.enabled=false") .withUserConfiguration(FooEndpointEnabledByDefaultTrueConfiguration.class) .run((context) -> assertThat(context).doesNotHaveBean("foo")); } @Test - public void outcomeWhenNoEndpointPropertyAndUserDefinedDefaultIsTrueShouldMatch() - throws Exception { + public void outcomeWhenNoEndpointPropertyAndUserDefinedDefaultIsTrueShouldMatch() { this.contextRunner .withPropertyValues("management.endpoints.enabled-by-default=true") .withUserConfiguration( @@ -67,8 +65,7 @@ public class ConditionalOnEnabledEndpointTests { } @Test - public void outcomeWhenNoEndpointPropertyAndUserDefinedDefaultIsFalseShouldNotMatch() - throws Exception { + public void outcomeWhenNoEndpointPropertyAndUserDefinedDefaultIsFalseShouldNotMatch() { this.contextRunner .withPropertyValues("management.endpoints.enabled-by-default=false") .withUserConfiguration(FooEndpointEnabledByDefaultTrueConfiguration.class) @@ -76,16 +73,14 @@ public class ConditionalOnEnabledEndpointTests { } @Test - public void outcomeWhenNoPropertiesAndAnnotationIsEnabledByDefaultShouldMatch() - throws Exception { + public void outcomeWhenNoPropertiesAndAnnotationIsEnabledByDefaultShouldMatch() { this.contextRunner .withUserConfiguration(FooEndpointEnabledByDefaultTrueConfiguration.class) .run((context) -> assertThat(context).hasBean("foo")); } @Test - public void outcomeWhenNoPropertiesAndAnnotationIsNotEnabledByDefaultShouldNotMatch() - throws Exception { + public void outcomeWhenNoPropertiesAndAnnotationIsNotEnabledByDefaultShouldNotMatch() { this.contextRunner .withUserConfiguration( FooEndpointEnabledByDefaultFalseConfiguration.class) @@ -93,8 +88,7 @@ public class ConditionalOnEnabledEndpointTests { } @Test - public void outcomeWhenNoPropertiesAndExtensionAnnotationIsEnabledByDefaultShouldMatch() - throws Exception { + public void outcomeWhenNoPropertiesAndExtensionAnnotationIsEnabledByDefaultShouldMatch() { this.contextRunner .withUserConfiguration( FooEndpointAndExtensionEnabledByDefaultTrueConfiguration.class) @@ -102,8 +96,7 @@ public class ConditionalOnEnabledEndpointTests { } @Test - public void outcomeWhenNoPropertiesAndExtensionAnnotationIsNotEnabledByDefaultShouldNotMatch() - throws Exception { + public void outcomeWhenNoPropertiesAndExtensionAnnotationIsNotEnabledByDefaultShouldNotMatch() { this.contextRunner .withUserConfiguration( FooEndpointAndExtensionEnabledByDefaultFalseConfiguration.class) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/DefaultEndpointPathProviderTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/DefaultEndpointPathProviderTests.java index 91492ca409..4358b10ecc 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/DefaultEndpointPathProviderTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/DefaultEndpointPathProviderTests.java @@ -48,32 +48,31 @@ public class DefaultEndpointPathProviderTests { } @Test - public void getPathsShouldReturnAllPaths() throws Exception { + public void getPathsShouldReturnAllPaths() { DefaultEndpointPathProvider provider = createProvider(""); assertThat(provider.getPaths()).containsOnly("/foo", "/bar"); } @Test - public void getPathsWhenHasContextPathShouldReturnAllPathsWithContext() - throws Exception { + public void getPathsWhenHasContextPathShouldReturnAllPathsWithContext() { DefaultEndpointPathProvider provider = createProvider("/actuator"); assertThat(provider.getPaths()).containsOnly("/actuator/foo", "/actuator/bar"); } @Test - public void getPathWhenEndpointIdIsKnownShouldReturnPath() throws Exception { + public void getPathWhenEndpointIdIsKnownShouldReturnPath() { DefaultEndpointPathProvider provider = createProvider(""); assertThat(provider.getPath("foo")).isEqualTo("/foo"); } @Test - public void getPathWhenEndpointIdIsUnknownShouldReturnNull() throws Exception { + public void getPathWhenEndpointIdIsUnknownShouldReturnNull() { DefaultEndpointPathProvider provider = createProvider(""); assertThat(provider.getPath("baz")).isNull(); } @Test - public void getPathWhenHasContextPathReturnPath() throws Exception { + public void getPathWhenHasContextPathReturnPath() { DefaultEndpointPathProvider provider = createProvider("/actuator"); assertThat(provider.getPath("foo")).isEqualTo("/actuator/foo"); } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/WebEndpointPropertiesTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/WebEndpointPropertiesTests.java index c4593b66ee..bcd824eca8 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/WebEndpointPropertiesTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/WebEndpointPropertiesTests.java @@ -28,13 +28,13 @@ import static org.assertj.core.api.Assertions.assertThat; public class WebEndpointPropertiesTests { @Test - public void defaultBasePathShouldBeApplication() throws Exception { + public void defaultBasePathShouldBeApplication() { WebEndpointProperties properties = new WebEndpointProperties(); assertThat(properties.getBasePath()).isEqualTo("/actuator"); } @Test - public void basePathShouldBeCleaned() throws Exception { + public void basePathShouldBeCleaned() { WebEndpointProperties properties = new WebEndpointProperties(); properties.setBasePath("/"); assertThat(properties.getBasePath()).isEqualTo(""); diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/env/EnvironmentEndpointAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/env/EnvironmentEndpointAutoConfigurationTests.java index 9e4a175212..27b1f036ab 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/env/EnvironmentEndpointAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/env/EnvironmentEndpointAutoConfigurationTests.java @@ -49,15 +49,14 @@ public class EnvironmentEndpointAutoConfigurationTests { } @Test - public void runWhenEnabledPropertyIsFalseShouldNotHaveEndpointBean() - throws Exception { + public void runWhenEnabledPropertyIsFalseShouldNotHaveEndpointBean() { this.contextRunner.withPropertyValues("management.endpoint.env.enabled:false") .run((context) -> assertThat(context) .doesNotHaveBean(EnvironmentEndpoint.class)); } @Test - public void keysToSanitizeCanBeConfiguredViaTheEnvironment() throws Exception { + public void keysToSanitizeCanBeConfiguredViaTheEnvironment() { this.contextRunner.withSystemProperties("dbPassword=123456", "apiKey=123456") .withPropertyValues("management.endpoint.env.keys-to-sanitize=.*pass.*") .run(validateSystemProperties("******", "123456")); diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/flyway/FlywayEndpointAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/flyway/FlywayEndpointAutoConfigurationTests.java index c7a7f48bd7..cc3671338a 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/flyway/FlywayEndpointAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/flyway/FlywayEndpointAutoConfigurationTests.java @@ -47,8 +47,7 @@ public class FlywayEndpointAutoConfigurationTests { } @Test - public void runWhenEnabledPropertyIsFalseShouldNotHaveEndpointBean() - throws Exception { + public void runWhenEnabledPropertyIsFalseShouldNotHaveEndpointBean() { this.contextRunner.withPropertyValues("management.endpoint.flyway.enabled:false") .run((context) -> assertThat(context) .doesNotHaveBean(FlywayEndpoint.class)); diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/HealthIndicatorAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/HealthIndicatorAutoConfigurationTests.java index 623204b643..8d263a2fe3 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/HealthIndicatorAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/HealthIndicatorAutoConfigurationTests.java @@ -47,24 +47,21 @@ public class HealthIndicatorAutoConfigurationTests { AutoConfigurations.of(HealthIndicatorAutoConfiguration.class)); @Test - public void runWhenNoOtherIndicatorsShouldCreateDefaultApplicationHealthIndicator() - throws Exception { + public void runWhenNoOtherIndicatorsShouldCreateDefaultApplicationHealthIndicator() { this.contextRunner .run((context) -> assertThat(context).getBean(HealthIndicator.class) .isInstanceOf(ApplicationHealthIndicator.class)); } @Test - public void runWhenHasDefinedIndicatorShouldNotCreateDefaultApplicationHealthIndicator() - throws Exception { + public void runWhenHasDefinedIndicatorShouldNotCreateDefaultApplicationHealthIndicator() { this.contextRunner.withUserConfiguration(CustomHealthIndicatorConfiguration.class) .run((context) -> assertThat(context).getBean(HealthIndicator.class) .isInstanceOf(CustomHealthIndicator.class)); } @Test - public void runWhenHasDefaultsDisabledAndNoSingleIndicatorEnabledShouldCreateDefaultApplicationHealthIndicator() - throws Exception { + public void runWhenHasDefaultsDisabledAndNoSingleIndicatorEnabledShouldCreateDefaultApplicationHealthIndicator() { this.contextRunner.withUserConfiguration(CustomHealthIndicatorConfiguration.class) .withPropertyValues("management.health.defaults.enabled:false") .run((context) -> assertThat(context).getBean(HealthIndicator.class) @@ -73,8 +70,7 @@ public class HealthIndicatorAutoConfigurationTests { } @Test - public void runWhenHasDefaultsDisabledAndSingleIndicatorEnabledShouldCreateEnabledIndicator() - throws Exception { + public void runWhenHasDefaultsDisabledAndSingleIndicatorEnabledShouldCreateEnabledIndicator() { this.contextRunner.withUserConfiguration(CustomHealthIndicatorConfiguration.class) .withPropertyValues("management.health.defaults.enabled:false", "management.health.custom.enabled:true") @@ -84,15 +80,14 @@ public class HealthIndicatorAutoConfigurationTests { } @Test - public void runShouldCreateOrderedHealthAggregator() throws Exception { + public void runShouldCreateOrderedHealthAggregator() { this.contextRunner .run((context) -> assertThat(context).getBean(HealthAggregator.class) .isInstanceOf(OrderedHealthAggregator.class)); } @Test - public void runWhenHasCustomOrderPropertyShouldCreateOrderedHealthAggregator() - throws Exception { + public void runWhenHasCustomOrderPropertyShouldCreateOrderedHealthAggregator() { this.contextRunner.withPropertyValues("management.health.status.order:UP,DOWN") .run((context) -> { OrderedHealthAggregator aggregator = context @@ -106,8 +101,7 @@ public class HealthIndicatorAutoConfigurationTests { } @Test - public void runWhenHasCustomHealthAggregatorShouldNotCreateOrderedHealthAggregator() - throws Exception { + public void runWhenHasCustomHealthAggregatorShouldNotCreateOrderedHealthAggregator() { this.contextRunner .withUserConfiguration(CustomHealthAggregatorConfiguration.class) .run((context) -> assertThat(context).getBean(HealthAggregator.class) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/HealthWebEndpointReactiveManagementContextConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/HealthWebEndpointReactiveManagementContextConfigurationTests.java index c75bb0d9d6..90d509f4f3 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/HealthWebEndpointReactiveManagementContextConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/HealthWebEndpointReactiveManagementContextConfigurationTests.java @@ -50,21 +50,20 @@ public class HealthWebEndpointReactiveManagementContextConfigurationTests { HealthWebEndpointManagementContextConfiguration.class); @Test - public void runShouldCreateExtensionBeans() throws Exception { + public void runShouldCreateExtensionBeans() { this.contextRunner.run((context) -> assertThat(context) .hasSingleBean(ReactiveHealthEndpointWebExtension.class)); } @Test - public void runWhenHealthEndpointIsDisabledShouldNotCreateExtensionBeans() - throws Exception { + public void runWhenHealthEndpointIsDisabledShouldNotCreateExtensionBeans() { this.contextRunner.withPropertyValues("management.endpoint.health.enabled:false") .run((context) -> assertThat(context) .doesNotHaveBean(ReactiveHealthEndpointWebExtension.class)); } @Test - public void runWithCustomHealthMappingShouldMapStatusCode() throws Exception { + public void runWithCustomHealthMappingShouldMapStatusCode() { this.contextRunner .withPropertyValues("management.health.status.http-mapping.CUSTOM=500") .run((context) -> { diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/HealthWebEndpointServletManagementContextConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/HealthWebEndpointServletManagementContextConfigurationTests.java index 1e4cef5221..42952aff02 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/HealthWebEndpointServletManagementContextConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/HealthWebEndpointServletManagementContextConfigurationTests.java @@ -43,21 +43,20 @@ public class HealthWebEndpointServletManagementContextConfigurationTests { HealthWebEndpointManagementContextConfiguration.class); @Test - public void runShouldCreateExtensionBeans() throws Exception { + public void runShouldCreateExtensionBeans() { this.contextRunner.run((context) -> assertThat(context) .hasSingleBean(HealthEndpointWebExtension.class)); } @Test - public void runWhenHealthEndpointIsDisabledShouldNotCreateExtensionBeans() - throws Exception { + public void runWhenHealthEndpointIsDisabledShouldNotCreateExtensionBeans() { this.contextRunner.withPropertyValues("management.endpoint.health.enabled:false") .run((context) -> assertThat(context) .doesNotHaveBean(HealthEndpointWebExtension.class)); } @Test - public void runWithCustomHealthMappingShouldMapStatusCode() throws Exception { + public void runWithCustomHealthMappingShouldMapStatusCode() { this.contextRunner .withPropertyValues("management.health.status.http-mapping.CUSTOM=500") .run((context) -> { diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/info/InfoEndpointAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/info/InfoEndpointAutoConfigurationTests.java index ef3fa568ca..96ef76fd63 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/info/InfoEndpointAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/info/InfoEndpointAutoConfigurationTests.java @@ -49,8 +49,7 @@ public class InfoEndpointAutoConfigurationTests { } @Test - public void runWhenEnabledPropertyIsFalseShouldNotHaveEndpointBean() - throws Exception { + public void runWhenEnabledPropertyIsFalseShouldNotHaveEndpointBean() { this.contextRunner.withPropertyValues("management.endpoint.info.enabled:false") .run((context) -> assertThat(context) .doesNotHaveBean(InfoEndpoint.class)); diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/WebFluxEndpointCorsIntegrationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/WebFluxEndpointCorsIntegrationTests.java index 5d751e9f89..d796f6e2e7 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/WebFluxEndpointCorsIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/WebFluxEndpointCorsIntegrationTests.java @@ -60,7 +60,7 @@ public class WebFluxEndpointCorsIntegrationTests { } @Test - public void corsIsDisabledByDefault() throws Exception { + public void corsIsDisabledByDefault() { WebTestClient client = createWebTestClient(); System.out.println(new ConditionEvaluationReportMessage( this.context.getBean(ConditionEvaluationReport.class))); @@ -106,7 +106,7 @@ public class WebFluxEndpointCorsIntegrationTests { } @Test - public void requestsWithDisallowedHeadersAreRejected() throws Exception { + public void requestsWithDisallowedHeadersAreRejected() { TestPropertyValues .of("management.endpoints.web.cors.allowed-origins:spring.example.org") .applyTo(this.context); @@ -120,7 +120,7 @@ public class WebFluxEndpointCorsIntegrationTests { } @Test - public void allowedHeadersCanBeConfigured() throws Exception { + public void allowedHeadersCanBeConfigured() { TestPropertyValues .of("management.endpoints.web.cors.allowed-origins:spring.example.org", "management.endpoints.web.cors.allowed-headers:Alpha,Bravo") @@ -136,7 +136,7 @@ public class WebFluxEndpointCorsIntegrationTests { } @Test - public void requestsWithDisallowedMethodsAreRejected() throws Exception { + public void requestsWithDisallowedMethodsAreRejected() { TestPropertyValues .of("management.endpoints.web.cors.allowed-origins:spring.example.org") .applyTo(this.context); @@ -149,7 +149,7 @@ public class WebFluxEndpointCorsIntegrationTests { } @Test - public void allowedMethodsCanBeConfigured() throws Exception { + public void allowedMethodsCanBeConfigured() { TestPropertyValues .of("management.endpoints.web.cors.allowed-origins:spring.example.org", "management.endpoints.web.cors.allowed-methods:GET,HEAD") @@ -190,7 +190,7 @@ public class WebFluxEndpointCorsIntegrationTests { .configureClient().baseUrl("https://spring.example.org").build(); } - private WebTestClient.ResponseSpec performAcceptedCorsRequest(String url) throws Exception { + private WebTestClient.ResponseSpec performAcceptedCorsRequest(String url) { return createWebTestClient() .options().uri(url) .header(HttpHeaders.ORIGIN, "spring.example.org") diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/jdbc/DataSourceHealthIndicatorAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/jdbc/DataSourceHealthIndicatorAutoConfigurationTests.java index 63bc6f3efd..2acbb61809 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/jdbc/DataSourceHealthIndicatorAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/jdbc/DataSourceHealthIndicatorAutoConfigurationTests.java @@ -63,8 +63,7 @@ public class DataSourceHealthIndicatorAutoConfigurationTests { } @Test - public void runWhenMultipleDataSourceBeansShouldCreateCompositeIndicator() - throws Exception { + public void runWhenMultipleDataSourceBeansShouldCreateCompositeIndicator() { this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class, DataSourceConfig.class).run((context) -> { assertThat(context).hasSingleBean(HealthIndicator.class); @@ -76,7 +75,7 @@ public class DataSourceHealthIndicatorAutoConfigurationTests { } @Test - public void runShouldFilterRoutingDataSource() throws Exception { + public void runShouldFilterRoutingDataSource() { this.contextRunner .withUserConfiguration(EmbeddedDataSourceConfiguration.class, RoutingDatasourceConfig.class) @@ -101,7 +100,7 @@ public class DataSourceHealthIndicatorAutoConfigurationTests { } @Test - public void runWhenDisabledShouldNotCreateIndicator() throws Exception { + public void runWhenDisabledShouldNotCreateIndicator() { this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class) .withPropertyValues("management.health.db.enabled:false") .run((context) -> assertThat(context) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/jms/JmsHealthIndicatorAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/jms/JmsHealthIndicatorAutoConfigurationTests.java index b98a2cd266..1ee1642e47 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/jms/JmsHealthIndicatorAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/jms/JmsHealthIndicatorAutoConfigurationTests.java @@ -41,14 +41,14 @@ public class JmsHealthIndicatorAutoConfigurationTests { HealthIndicatorAutoConfiguration.class)); @Test - public void runShouldCreateIndicator() throws Exception { + public void runShouldCreateIndicator() { this.contextRunner.run( (context) -> assertThat(context).hasSingleBean(JmsHealthIndicator.class) .doesNotHaveBean(ApplicationHealthIndicator.class)); } @Test - public void runWhenDisabledShouldNotCreateIndicator() throws Exception { + public void runWhenDisabledShouldNotCreateIndicator() { this.contextRunner.withPropertyValues("management.health.jms.enabled:false") .run((context) -> assertThat(context) .doesNotHaveBean(LdapHealthIndicator.class) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/ldap/LdapHealthIndicatorAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/ldap/LdapHealthIndicatorAutoConfigurationTests.java index 1e17410306..afaaf51e7a 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/ldap/LdapHealthIndicatorAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/ldap/LdapHealthIndicatorAutoConfigurationTests.java @@ -45,14 +45,14 @@ public class LdapHealthIndicatorAutoConfigurationTests { HealthIndicatorAutoConfiguration.class)); @Test - public void runShouldCreateIndicator() throws Exception { + public void runShouldCreateIndicator() { this.contextRunner.run( (context) -> assertThat(context).hasSingleBean(LdapHealthIndicator.class) .doesNotHaveBean(ApplicationHealthIndicator.class)); } @Test - public void runWhenDisabledShouldNotCreateIndicator() throws Exception { + public void runWhenDisabledShouldNotCreateIndicator() { this.contextRunner.withPropertyValues("management.health.ldap.enabled:false") .run((context) -> assertThat(context) .doesNotHaveBean(LdapHealthIndicator.class) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/liquibase/LiquibaseEndpointAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/liquibase/LiquibaseEndpointAutoConfigurationTests.java index aa06270d71..7e85b73a60 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/liquibase/LiquibaseEndpointAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/liquibase/LiquibaseEndpointAutoConfigurationTests.java @@ -47,8 +47,7 @@ public class LiquibaseEndpointAutoConfigurationTests { } @Test - public void runWhenEnabledPropertyIsFalseShouldNotHaveEndpointBean() - throws Exception { + public void runWhenEnabledPropertyIsFalseShouldNotHaveEndpointBean() { this.contextRunner .withPropertyValues("management.endpoint.liquibase.enabled:false") .run((context) -> assertThat(context) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/logging/LoggersEndpointAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/logging/LoggersEndpointAutoConfigurationTests.java index 10ec134c96..7a2c3bde8a 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/logging/LoggersEndpointAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/logging/LoggersEndpointAutoConfigurationTests.java @@ -47,8 +47,7 @@ public class LoggersEndpointAutoConfigurationTests { } @Test - public void runWhenEnabledPropertyIsFalseShouldNotHaveEndpointBean() - throws Exception { + public void runWhenEnabledPropertyIsFalseShouldNotHaveEndpointBean() { this.contextRunner.withPropertyValues("management.endpoint.loggers.enabled:false") .run((context) -> assertThat(context) .doesNotHaveBean(LoggersEndpoint.class)); diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/mail/MailHealthIndicatorAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/mail/MailHealthIndicatorAutoConfigurationTests.java index 50b5842fb9..c718403885 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/mail/MailHealthIndicatorAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/mail/MailHealthIndicatorAutoConfigurationTests.java @@ -41,14 +41,14 @@ public class MailHealthIndicatorAutoConfigurationTests { .withPropertyValues("spring.mail.host:smtp.example.com"); @Test - public void runShouldCreateIndicator() throws Exception { + public void runShouldCreateIndicator() { this.contextRunner.run( (context) -> assertThat(context).hasSingleBean(MailHealthIndicator.class) .doesNotHaveBean(ApplicationHealthIndicator.class)); } @Test - public void runWhenDisabledShouldNotCreateIndicator() throws Exception { + public void runWhenDisabledShouldNotCreateIndicator() { this.contextRunner.withPropertyValues("management.health.mail.enabled:false") .run((context) -> assertThat(context) .doesNotHaveBean(MailHealthIndicator.class) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/management/HeapDumpWebEndpointAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/management/HeapDumpWebEndpointAutoConfigurationTests.java index 7c452012fb..85f32129b8 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/management/HeapDumpWebEndpointAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/management/HeapDumpWebEndpointAutoConfigurationTests.java @@ -36,13 +36,13 @@ public class HeapDumpWebEndpointAutoConfigurationTests { HeapDumpWebEndpointAutoConfiguration.class); @Test - public void runShouldCreateIndicator() throws Exception { + public void runShouldCreateIndicator() { this.contextRunner.run((context) -> assertThat(context) .hasSingleBean(HeapDumpWebEndpoint.class)); } @Test - public void runWhenDisabledShouldNotCreateIndicator() throws Exception { + public void runWhenDisabledShouldNotCreateIndicator() { this.contextRunner .withPropertyValues("management.endpoint.heapdump.enabled:false") .run((context) -> assertThat(context) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/management/ThreadDumpEndpointAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/management/ThreadDumpEndpointAutoConfigurationTests.java index 369ed28029..f923435507 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/management/ThreadDumpEndpointAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/management/ThreadDumpEndpointAutoConfigurationTests.java @@ -42,8 +42,7 @@ public class ThreadDumpEndpointAutoConfigurationTests { } @Test - public void runWhenEnabledPropertyIsFalseShouldNotHaveEndpointBean() - throws Exception { + public void runWhenEnabledPropertyIsFalseShouldNotHaveEndpointBean() { this.contextRunner .withPropertyValues("management.endpoint.threaddump.enabled:false") .run((context) -> assertThat(context) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/mongo/MongoHealthIndicatorAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/mongo/MongoHealthIndicatorAutoConfigurationTests.java index c97b82077e..eb49b94262 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/mongo/MongoHealthIndicatorAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/mongo/MongoHealthIndicatorAutoConfigurationTests.java @@ -42,14 +42,14 @@ public class MongoHealthIndicatorAutoConfigurationTests { HealthIndicatorAutoConfiguration.class)); @Test - public void runShouldCreateIndicator() throws Exception { + public void runShouldCreateIndicator() { this.contextRunner.run( (context) -> assertThat(context).hasSingleBean(MongoHealthIndicator.class) .doesNotHaveBean(ApplicationHealthIndicator.class)); } @Test - public void runWhenDisabledShouldNotCreateIndicator() throws Exception { + public void runWhenDisabledShouldNotCreateIndicator() { this.contextRunner.withPropertyValues("management.health.mongo.enabled:false") .run((context) -> assertThat(context) .doesNotHaveBean(MongoHealthIndicator.class) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/neo4j/Neo4jHealthIndicatorAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/neo4j/Neo4jHealthIndicatorAutoConfigurationTests.java index 94996e9d35..0e0694d20a 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/neo4j/Neo4jHealthIndicatorAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/neo4j/Neo4jHealthIndicatorAutoConfigurationTests.java @@ -44,14 +44,14 @@ public class Neo4jHealthIndicatorAutoConfigurationTests { HealthIndicatorAutoConfiguration.class)); @Test - public void runShouldCreateIndicator() throws Exception { + public void runShouldCreateIndicator() { this.contextRunner.run( (context) -> assertThat(context).hasSingleBean(Neo4jHealthIndicator.class) .doesNotHaveBean(ApplicationHealthIndicator.class)); } @Test - public void runWhenDisabledShouldNotCreateIndicator() throws Exception { + public void runWhenDisabledShouldNotCreateIndicator() { this.contextRunner.withPropertyValues("management.health.neo4j.enabled:false") .run((context) -> assertThat(context) .doesNotHaveBean(Neo4jHealthIndicator.class) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/redis/RedisHealthIndicatorAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/redis/RedisHealthIndicatorAutoConfigurationTests.java index d617f54891..664219a913 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/redis/RedisHealthIndicatorAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/redis/RedisHealthIndicatorAutoConfigurationTests.java @@ -46,7 +46,7 @@ public class RedisHealthIndicatorAutoConfigurationTests { HealthIndicatorAutoConfiguration.class)); @Test - public void runShouldCreateIndicator() throws Exception { + public void runShouldCreateIndicator() { this.contextRunner.run( (context) -> assertThat(context).hasSingleBean(RedisHealthIndicator.class) .doesNotHaveBean(RedisReactiveHealthIndicator.class) @@ -54,7 +54,7 @@ public class RedisHealthIndicatorAutoConfigurationTests { } @Test - public void runWhenDisabledShouldNotCreateIndicator() throws Exception { + public void runWhenDisabledShouldNotCreateIndicator() { this.contextRunner.withPropertyValues("management.health.redis.enabled:false") .run((context) -> assertThat(context) .doesNotHaveBean(RedisHealthIndicator.class) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/redis/RedisReactiveHealthIndicatorConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/redis/RedisReactiveHealthIndicatorConfigurationTests.java index c307e24d3d..7a350dfc9c 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/redis/RedisReactiveHealthIndicatorConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/redis/RedisReactiveHealthIndicatorConfigurationTests.java @@ -41,7 +41,7 @@ public class RedisReactiveHealthIndicatorConfigurationTests { HealthIndicatorAutoConfiguration.class)); @Test - public void runShouldCreateIndicator() throws Exception { + public void runShouldCreateIndicator() { this.contextRunner.run((context) -> assertThat(context) .hasSingleBean(RedisReactiveHealthIndicatorConfiguration.class) .doesNotHaveBean(RedisHealthIndicator.class) @@ -49,7 +49,7 @@ public class RedisReactiveHealthIndicatorConfigurationTests { } @Test - public void runWhenDisabledShouldNotCreateIndicator() throws Exception { + public void runWhenDisabledShouldNotCreateIndicator() { this.contextRunner.withPropertyValues("management.health.redis.enabled:false") .run((context) -> assertThat(context) .doesNotHaveBean(RedisReactiveHealthIndicator.class) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/EndpointRequestTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/EndpointRequestTests.java index 5045baa740..e45f3ab46d 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/EndpointRequestTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/EndpointRequestTests.java @@ -42,44 +42,44 @@ import static org.assertj.core.api.Assertions.assertThat; public class EndpointRequestTests { @Test - public void toAnyEndpointShouldMatchEndpointPath() throws Exception { + public void toAnyEndpointShouldMatchEndpointPath() { RequestMatcher matcher = EndpointRequest.toAnyEndpoint(); assertMatcher(matcher).matches("/actuator/foo"); assertMatcher(matcher).matches("/actuator/bar"); } @Test - public void toAnyEndpointShouldNotMatchOtherPath() throws Exception { + public void toAnyEndpointShouldNotMatchOtherPath() { RequestMatcher matcher = EndpointRequest.toAnyEndpoint(); assertMatcher(matcher).doesNotMatch("/actuator/baz"); } @Test - public void toEndpointClassShouldMatchEndpointPath() throws Exception { + public void toEndpointClassShouldMatchEndpointPath() { RequestMatcher matcher = EndpointRequest.to(FooEndpoint.class); assertMatcher(matcher).matches("/actuator/foo"); } @Test - public void toEndpointClassShouldNotMatchOtherPath() throws Exception { + public void toEndpointClassShouldNotMatchOtherPath() { RequestMatcher matcher = EndpointRequest.to(FooEndpoint.class); assertMatcher(matcher).doesNotMatch("/actuator/bar"); } @Test - public void toEndpointIdShouldMatchEndpointPath() throws Exception { + public void toEndpointIdShouldMatchEndpointPath() { RequestMatcher matcher = EndpointRequest.to("foo"); assertMatcher(matcher).matches("/actuator/foo"); } @Test - public void toEndpointIdShouldNotMatchOtherPath() throws Exception { + public void toEndpointIdShouldNotMatchOtherPath() { RequestMatcher matcher = EndpointRequest.to("foo"); assertMatcher(matcher).doesNotMatch("/actuator/bar"); } @Test - public void excludeByClassShouldNotMatchExcluded() throws Exception { + public void excludeByClassShouldNotMatchExcluded() { RequestMatcher matcher = EndpointRequest.toAnyEndpoint() .excluding(FooEndpoint.class); assertMatcher(matcher).doesNotMatch("/actuator/foo"); @@ -87,7 +87,7 @@ public class EndpointRequestTests { } @Test - public void excludeByIdShouldNotMatchExcluded() throws Exception { + public void excludeByIdShouldNotMatchExcluded() { RequestMatcher matcher = EndpointRequest.toAnyEndpoint().excluding("foo"); assertMatcher(matcher).doesNotMatch("/actuator/foo"); assertMatcher(matcher).matches("/actuator/bar"); diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/session/SessionsEndpointAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/session/SessionsEndpointAutoConfigurationTests.java index 8939c2081e..fd03e5c887 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/session/SessionsEndpointAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/session/SessionsEndpointAutoConfigurationTests.java @@ -47,8 +47,7 @@ public class SessionsEndpointAutoConfigurationTests { } @Test - public void runWhenEnabledPropertyIsFalseShouldNotHaveEndpointBean() - throws Exception { + public void runWhenEnabledPropertyIsFalseShouldNotHaveEndpointBean() { this.contextRunner .withPropertyValues("management.endpoint.sessions.enabled:false") .run((context) -> assertThat(context) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/solr/SolrHealthIndicatorAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/solr/SolrHealthIndicatorAutoConfigurationTests.java index 8d98475e8c..0db7baefef 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/solr/SolrHealthIndicatorAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/solr/SolrHealthIndicatorAutoConfigurationTests.java @@ -40,14 +40,14 @@ public class SolrHealthIndicatorAutoConfigurationTests { HealthIndicatorAutoConfiguration.class)); @Test - public void runShouldCreateIndicator() throws Exception { + public void runShouldCreateIndicator() { this.contextRunner.run( (context) -> assertThat(context).hasSingleBean(SolrHealthIndicator.class) .doesNotHaveBean(ApplicationHealthIndicator.class)); } @Test - public void runWhenDisabledShouldNotCreateIndicator() throws Exception { + public void runWhenDisabledShouldNotCreateIndicator() { this.contextRunner.withPropertyValues("management.health.solr.enabled:false") .run((context) -> assertThat(context) .doesNotHaveBean(SolrHealthIndicator.class) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/system/DiskSpaceHealthIndicatorAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/system/DiskSpaceHealthIndicatorAutoConfigurationTests.java index 88554efc05..fd5407102e 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/system/DiskSpaceHealthIndicatorAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/system/DiskSpaceHealthIndicatorAutoConfigurationTests.java @@ -39,14 +39,14 @@ public class DiskSpaceHealthIndicatorAutoConfigurationTests { HealthIndicatorAutoConfiguration.class)); @Test - public void runShouldCreateIndicator() throws Exception { + public void runShouldCreateIndicator() { this.contextRunner.run((context) -> assertThat(context) .hasSingleBean(DiskSpaceHealthIndicator.class) .doesNotHaveBean(ApplicationHealthIndicator.class)); } @Test - public void runWhenDisabledShouldNotCreateIndicator() throws Exception { + public void runWhenDisabledShouldNotCreateIndicator() { this.contextRunner.withPropertyValues("management.health.diskspace.enabled:false") .run((context) -> assertThat(context) .doesNotHaveBean(DiskSpaceHealthIndicator.class) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/trace/TraceEndpointAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/trace/TraceEndpointAutoConfigurationTests.java index e959678421..2b8619ef6e 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/trace/TraceEndpointAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/trace/TraceEndpointAutoConfigurationTests.java @@ -42,8 +42,7 @@ public class TraceEndpointAutoConfigurationTests { } @Test - public void runWhenEnabledPropertyIsFalseShouldNotHaveEndpointBean() - throws Exception { + public void runWhenEnabledPropertyIsFalseShouldNotHaveEndpointBean() { this.contextRunner.withPropertyValues("management.endpoint.trace.enabled:false") .run((context) -> assertThat(context) .doesNotHaveBean(TraceEndpoint.class)); diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/trace/TraceRepositoryAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/trace/TraceRepositoryAutoConfigurationTests.java index 6473ce6cf6..5d7b507391 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/trace/TraceRepositoryAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/trace/TraceRepositoryAutoConfigurationTests.java @@ -35,7 +35,7 @@ import static org.mockito.Mockito.mock; public class TraceRepositoryAutoConfigurationTests { @Test - public void configuresInMemoryTraceRepository() throws Exception { + public void configuresInMemoryTraceRepository() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext( TraceRepositoryAutoConfiguration.class); assertThat(context.getBean(InMemoryTraceRepository.class)).isNotNull(); @@ -43,7 +43,7 @@ public class TraceRepositoryAutoConfigurationTests { } @Test - public void skipsIfRepositoryExists() throws Exception { + public void skipsIfRepositoryExists() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext( Config.class, TraceRepositoryAutoConfiguration.class); assertThat(context.getBeansOfType(InMemoryTraceRepository.class)).isEmpty(); diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/trace/TraceWebFilterAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/trace/TraceWebFilterAutoConfigurationTests.java index 2bf5bc39bb..fe398b86aa 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/trace/TraceWebFilterAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/trace/TraceWebFilterAutoConfigurationTests.java @@ -55,14 +55,14 @@ public class TraceWebFilterAutoConfigurationTests { } @Test - public void overrideTraceFilter() throws Exception { + public void overrideTraceFilter() { load(CustomTraceFilterConfig.class); WebRequestTraceFilter filter = this.context.getBean(WebRequestTraceFilter.class); assertThat(filter).isInstanceOf(TestWebRequestTraceFilter.class); } @Test - public void skipsFilterIfPropertyDisabled() throws Exception { + public void skipsFilterIfPropertyDisabled() { load("management.trace.filter.enabled:false"); assertThat(this.context.getBeansOfType(WebRequestTraceFilter.class).size()) .isEqualTo(0); diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/reactive/ReactiveManagementContextFactoryTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/reactive/ReactiveManagementContextFactoryTests.java index 78623ff38e..ef76afbeeb 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/reactive/ReactiveManagementContextFactoryTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/reactive/ReactiveManagementContextFactoryTests.java @@ -41,8 +41,7 @@ public class ReactiveManagementContextFactoryTests { private AnnotationConfigReactiveWebServerApplicationContext parent = new AnnotationConfigReactiveWebServerApplicationContext(); @Test - public void createManagementContextShouldCreateChildContextWithConfigClasses() - throws Exception { + public void createManagementContextShouldCreateChildContextWithConfigClasses() { this.parent.register(ParentConfiguration.class); this.parent.refresh(); AnnotationConfigReactiveWebServerApplicationContext childContext = (AnnotationConfigReactiveWebServerApplicationContext) this.factory diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementContextConfigurationImportSelectorTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementContextConfigurationImportSelectorTests.java index 25a8f90da5..dbe5bac193 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementContextConfigurationImportSelectorTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementContextConfigurationImportSelectorTests.java @@ -38,7 +38,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class ManagementContextConfigurationImportSelectorTests { @Test - public void selectImportsShouldOrderResult() throws Exception { + public void selectImportsShouldOrderResult() { String[] imports = new TestManagementContextConfigurationsImportSelector(C.class, A.class, D.class, B.class).selectImports( new StandardAnnotationMetadata(EnableChildContext.class)); @@ -47,8 +47,7 @@ public class ManagementContextConfigurationImportSelectorTests { } @Test - public void selectImportsFiltersChildOnlyConfigurationWhenUsingSameContext() - throws Exception { + public void selectImportsFiltersChildOnlyConfigurationWhenUsingSameContext() { String[] imports = new TestManagementContextConfigurationsImportSelector( ChildOnly.class, SameOnly.class, A.class).selectImports( new StandardAnnotationMetadata(EnableSameContext.class)); @@ -57,8 +56,7 @@ public class ManagementContextConfigurationImportSelectorTests { } @Test - public void selectImportsFiltersSameOnlyConfigurationWhenUsingChildContext() - throws Exception { + public void selectImportsFiltersSameOnlyConfigurationWhenUsingChildContext() { String[] imports = new TestManagementContextConfigurationsImportSelector( ChildOnly.class, SameOnly.class, A.class).selectImports( new StandardAnnotationMetadata(EnableChildContext.class)); diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/servlet/CompositeHandlerExceptionResolverTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/servlet/CompositeHandlerExceptionResolverTests.java index 12a0c63a36..66db0be125 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/servlet/CompositeHandlerExceptionResolverTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/servlet/CompositeHandlerExceptionResolverTests.java @@ -48,7 +48,7 @@ public class CompositeHandlerExceptionResolverTests { private MockHttpServletResponse response = new MockHttpServletResponse(); @Test - public void resolverShouldDelegateToOtherResolversInContext() throws Exception { + public void resolverShouldDelegateToOtherResolversInContext() { load(TestConfiguration.class); CompositeHandlerExceptionResolver resolver = (CompositeHandlerExceptionResolver) this.context .getBean(DispatcherServlet.HANDLER_EXCEPTION_RESOLVER_BEAN_NAME); @@ -58,7 +58,7 @@ public class CompositeHandlerExceptionResolverTests { } @Test - public void resolverShouldAddDefaultResolverIfNonePresent() throws Exception { + public void resolverShouldAddDefaultResolverIfNonePresent() { load(BaseConfiguration.class); CompositeHandlerExceptionResolver resolver = (CompositeHandlerExceptionResolver) this.context .getBean(DispatcherServlet.HANDLER_EXCEPTION_RESOLVER_BEAN_NAME); diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/amqp/RabbitHealthIndicatorTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/amqp/RabbitHealthIndicatorTests.java index 6977eacf75..8817f6282e 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/amqp/RabbitHealthIndicatorTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/amqp/RabbitHealthIndicatorTests.java @@ -63,14 +63,14 @@ public class RabbitHealthIndicatorTests { } @Test - public void createWhenRabbitTemplateIsNullShouldThrowException() throws Exception { + public void createWhenRabbitTemplateIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("RabbitTemplate must not be null"); new RabbitHealthIndicator(null); } @Test - public void healthWhenConnectionSucceedsShouldReturnUpWithVersion() throws Exception { + public void healthWhenConnectionSucceedsShouldReturnUpWithVersion() { Connection connection = mock(Connection.class); given(this.channel.getConnection()).willReturn(connection); given(connection.getServerProperties()) @@ -81,7 +81,7 @@ public class RabbitHealthIndicatorTests { } @Test - public void healthWhenConnectionFailsShouldReturnDown() throws Exception { + public void healthWhenConnectionFailsShouldReturnDown() { given(this.channel.getConnection()).willThrow(new RuntimeException()); Health health = new RabbitHealthIndicator(this.rabbitTemplate).health(); assertThat(health.getStatus()).isEqualTo(Status.DOWN); diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/audit/AuditEventTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/audit/AuditEventTests.java index b13e0bb470..5bcf5023af 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/audit/AuditEventTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/audit/AuditEventTests.java @@ -39,7 +39,7 @@ public class AuditEventTests { public ExpectedException thrown = ExpectedException.none(); @Test - public void nowEvent() throws Exception { + public void nowEvent() { AuditEvent event = new AuditEvent("phil", "UNKNOWN", Collections.singletonMap("a", (Object) "b")); assertThat(event.getData().get("a")).isEqualTo("b"); @@ -49,7 +49,7 @@ public class AuditEventTests { } @Test - public void convertStringsToData() throws Exception { + public void convertStringsToData() { AuditEvent event = new AuditEvent("phil", "UNKNOWN", "a=b", "c=d"); assertThat(event.getData().get("a")).isEqualTo("b"); assertThat(event.getData().get("c")).isEqualTo("d"); @@ -63,7 +63,7 @@ public class AuditEventTests { } @Test - public void nullTimestamp() throws Exception { + public void nullTimestamp() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Timestamp must not be null"); new AuditEvent(null, "phil", "UNKNOWN", @@ -71,7 +71,7 @@ public class AuditEventTests { } @Test - public void nullType() throws Exception { + public void nullType() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Type must not be null"); new AuditEvent("phil", null, Collections.singletonMap("a", (Object) "b")); diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/audit/AuditEventsEndpointWebIntegrationTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/audit/AuditEventsEndpointWebIntegrationTests.java index 42adce6bc2..c11b404abd 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/audit/AuditEventsEndpointWebIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/audit/AuditEventsEndpointWebIntegrationTests.java @@ -42,13 +42,13 @@ public class AuditEventsEndpointWebIntegrationTests { private static WebTestClient client; @Test - public void eventsWithoutParams() throws Exception { + public void eventsWithoutParams() { client.get().uri((builder) -> builder.path("/actuator/auditevents").build()) .exchange().expectStatus().isBadRequest(); } @Test - public void eventsWithDateAfter() throws Exception { + public void eventsWithDateAfter() { client.get() .uri((builder) -> builder.path("/actuator/auditevents") .queryParam("after", "2016-11-01T13:00:00%2B00:00").build()) @@ -57,7 +57,7 @@ public class AuditEventsEndpointWebIntegrationTests { } @Test - public void eventsWithPrincipalAndDateAfter() throws Exception { + public void eventsWithPrincipalAndDateAfter() { client.get() .uri((builder) -> builder.path("/actuator/auditevents") .queryParam("after", "2016-11-01T10:00:00%2B00:00") @@ -68,7 +68,7 @@ public class AuditEventsEndpointWebIntegrationTests { } @Test - public void eventsWithPrincipalDateAfterAndType() throws Exception { + public void eventsWithPrincipalDateAfterAndType() { client.get() .uri((builder) -> builder.path("/actuator/auditevents") .queryParam("after", "2016-11-01T10:00:00%2B00:00") diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/audit/InMemoryAuditEventRepositoryTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/audit/InMemoryAuditEventRepositoryTests.java index f9ed23c02b..b21f8e3522 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/audit/InMemoryAuditEventRepositoryTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/audit/InMemoryAuditEventRepositoryTests.java @@ -41,7 +41,7 @@ public class InMemoryAuditEventRepositoryTests { public ExpectedException thrown = ExpectedException.none(); @Test - public void lessThanCapacity() throws Exception { + public void lessThanCapacity() { InMemoryAuditEventRepository repository = new InMemoryAuditEventRepository(); repository.add(new AuditEvent("dave", "a")); repository.add(new AuditEvent("dave", "b")); @@ -52,7 +52,7 @@ public class InMemoryAuditEventRepositoryTests { } @Test - public void capacity() throws Exception { + public void capacity() { InMemoryAuditEventRepository repository = new InMemoryAuditEventRepository(2); repository.add(new AuditEvent("dave", "a")); repository.add(new AuditEvent("dave", "b")); @@ -64,7 +64,7 @@ public class InMemoryAuditEventRepositoryTests { } @Test - public void addNullAuditEvent() throws Exception { + public void addNullAuditEvent() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("AuditEvent must not be null"); InMemoryAuditEventRepository repository = new InMemoryAuditEventRepository(); @@ -72,7 +72,7 @@ public class InMemoryAuditEventRepositoryTests { } @Test - public void findByPrincipal() throws Exception { + public void findByPrincipal() { InMemoryAuditEventRepository repository = new InMemoryAuditEventRepository(); repository.add(new AuditEvent("dave", "a")); repository.add(new AuditEvent("phil", "b")); @@ -85,7 +85,7 @@ public class InMemoryAuditEventRepositoryTests { } @Test - public void findByPrincipalAndType() throws Exception { + public void findByPrincipalAndType() { InMemoryAuditEventRepository repository = new InMemoryAuditEventRepository(); repository.add(new AuditEvent("dave", "a")); repository.add(new AuditEvent("phil", "b")); @@ -98,7 +98,7 @@ public class InMemoryAuditEventRepositoryTests { } @Test - public void findByDate() throws Exception { + public void findByDate() { Calendar calendar = Calendar.getInstance(); calendar.set(2000, 1, 1, 0, 0, 0); calendar.set(Calendar.MILLISECOND, 0); diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/context/ShutdownEndpointTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/context/ShutdownEndpointTests.java index 36863089b6..f7e90535ec 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/context/ShutdownEndpointTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/context/ShutdownEndpointTests.java @@ -45,7 +45,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class ShutdownEndpointTests { @Test - public void shutdown() throws Exception { + public void shutdown() { ApplicationContextRunner contextRunner = new ApplicationContextRunner() .withUserConfiguration(EndpointConfig.class); contextRunner.run((context) -> { diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpointParentTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpointParentTests.java index 590de45af1..91bb8d9e6d 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpointParentTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpointParentTests.java @@ -37,7 +37,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class ConfigurationPropertiesReportEndpointParentTests { @Test - public void configurationPropertiesClass() throws Exception { + public void configurationPropertiesClass() { new ApplicationContextRunner().withUserConfiguration(Parent.class) .run((parent) -> { new ApplicationContextRunner() @@ -56,7 +56,7 @@ public class ConfigurationPropertiesReportEndpointParentTests { } @Test - public void configurationPropertiesBeanMethod() throws Exception { + public void configurationPropertiesBeanMethod() { new ApplicationContextRunner().withUserConfiguration(Parent.class) .run((parent) -> { new ApplicationContextRunner() diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpointProxyTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpointProxyTests.java index 099c383cbd..18527e1918 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpointProxyTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpointProxyTests.java @@ -48,7 +48,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class ConfigurationPropertiesReportEndpointProxyTests { @Test - public void testWithProxyClass() throws Exception { + public void testWithProxyClass() { ApplicationContextRunner contextRunner = new ApplicationContextRunner() .withUserConfiguration(Config.class, SqlExecutor.class); contextRunner.run((context) -> { diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpointSerializationTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpointSerializationTests.java index 4698754c10..3b2f39854d 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpointSerializationTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpointSerializationTests.java @@ -48,7 +48,7 @@ import static org.assertj.core.api.Assertions.entry; public class ConfigurationPropertiesReportEndpointSerializationTests { @Test - public void testNaming() throws Exception { + public void testNaming() { ApplicationContextRunner contextRunner = new ApplicationContextRunner() .withUserConfiguration(FooConfig.class) .withPropertyValues("foo.name:foo"); @@ -69,7 +69,7 @@ public class ConfigurationPropertiesReportEndpointSerializationTests { @Test @SuppressWarnings("unchecked") - public void testNestedNaming() throws Exception { + public void testNestedNaming() { ApplicationContextRunner contextRunner = new ApplicationContextRunner() .withUserConfiguration(FooConfig.class) .withPropertyValues("foo.bar.name:foo"); @@ -90,7 +90,7 @@ public class ConfigurationPropertiesReportEndpointSerializationTests { @Test @SuppressWarnings("unchecked") - public void testSelfReferentialProperty() throws Exception { + public void testSelfReferentialProperty() { ApplicationContextRunner contextRunner = new ApplicationContextRunner() .withUserConfiguration(SelfReferentialConfig.class) .withPropertyValues("foo.name:foo"); @@ -133,7 +133,7 @@ public class ConfigurationPropertiesReportEndpointSerializationTests { @Test @SuppressWarnings("unchecked") - public void testMap() throws Exception { + public void testMap() { ApplicationContextRunner contextRunner = new ApplicationContextRunner() .withUserConfiguration(MapConfig.class) .withPropertyValues("foo.map.name:foo"); @@ -155,7 +155,7 @@ public class ConfigurationPropertiesReportEndpointSerializationTests { } @Test - public void testEmptyMapIsNotAdded() throws Exception { + public void testEmptyMapIsNotAdded() { ApplicationContextRunner contextRunner = new ApplicationContextRunner() .withUserConfiguration(MapConfig.class); contextRunner.run((context) -> { @@ -175,7 +175,7 @@ public class ConfigurationPropertiesReportEndpointSerializationTests { @Test @SuppressWarnings("unchecked") - public void testList() throws Exception { + public void testList() { ApplicationContextRunner contextRunner = new ApplicationContextRunner() .withUserConfiguration(ListConfig.class) .withPropertyValues("foo.list[0]:foo"); @@ -195,7 +195,7 @@ public class ConfigurationPropertiesReportEndpointSerializationTests { } @Test - public void testInetAddress() throws Exception { + public void testInetAddress() { ApplicationContextRunner contextRunner = new ApplicationContextRunner() .withUserConfiguration(AddressedConfig.class) .withPropertyValues("foo.address:192.168.1.10"); @@ -216,7 +216,7 @@ public class ConfigurationPropertiesReportEndpointSerializationTests { @Test @SuppressWarnings("unchecked") - public void testInitializedMapAndList() throws Exception { + public void testInitializedMapAndList() { ApplicationContextRunner contextRunner = new ApplicationContextRunner() .withUserConfiguration(InitializedMapAndListPropertiesConfig.class) .withPropertyValues("foo.map.entryOne:true", "foo.list[0]:abc"); diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpointTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpointTests.java index 1f0d9d3ee1..76dd872933 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpointTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpointTests.java @@ -47,7 +47,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class ConfigurationPropertiesReportEndpointTests { @Test - public void configurationPropertiesAreReturned() throws Exception { + public void configurationPropertiesAreReturned() { load((context, properties) -> { assertThat(properties.getContextId()).isEqualTo(context.getId()); assertThat(properties.getBeans().size()).isGreaterThan(0); @@ -69,7 +69,7 @@ public class ConfigurationPropertiesReportEndpointTests { } @Test - public void defaultKeySanitization() throws Exception { + public void defaultKeySanitization() { load((context, properties) -> { Map nestedProperties = properties.getBeans() .get("testProperties").getProperties(); @@ -80,7 +80,7 @@ public class ConfigurationPropertiesReportEndpointTests { } @Test - public void customKeySanitization() throws Exception { + public void customKeySanitization() { load("property", (context, properties) -> { Map nestedProperties = properties.getBeans() .get("testProperties").getProperties(); @@ -91,7 +91,7 @@ public class ConfigurationPropertiesReportEndpointTests { } @Test - public void customPatternKeySanitization() throws Exception { + public void customPatternKeySanitization() { load(".*pass.*", (context, properties) -> { Map nestedProperties = properties.getBeans() .get("testProperties").getProperties(); @@ -103,7 +103,7 @@ public class ConfigurationPropertiesReportEndpointTests { @Test @SuppressWarnings("unchecked") - public void keySanitizationWithCustomPatternUsingCompositeKeys() throws Exception { + public void keySanitizationWithCustomPatternUsingCompositeKeys() { // gh-4415 load(Arrays.asList(".*\\.secrets\\..*", ".*\\.hidden\\..*"), (context, properties) -> { @@ -121,7 +121,7 @@ public class ConfigurationPropertiesReportEndpointTests { } @Test - public void mixedBoolean() throws Exception { + public void mixedBoolean() { load((context, properties) -> { Map nestedProperties = properties.getBeans() .get("testProperties").getProperties(); @@ -131,7 +131,7 @@ public class ConfigurationPropertiesReportEndpointTests { @Test @SuppressWarnings("unchecked") - public void listsAreSanitized() throws Exception { + public void listsAreSanitized() { load((context, properties) -> { Map nestedProperties = properties.getBeans() .get("testProperties").getProperties(); @@ -145,7 +145,7 @@ public class ConfigurationPropertiesReportEndpointTests { @Test @SuppressWarnings("unchecked") - public void listsOfListsAreSanitized() throws Exception { + public void listsOfListsAreSanitized() { load((context, properties) -> { Map nestedProperties = properties.getBeans() .get("testProperties").getProperties(); diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/elasticsearch/ElasticsearchHealthIndicatorTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/elasticsearch/ElasticsearchHealthIndicatorTests.java index f9ba59b115..e4a43d9845 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/elasticsearch/ElasticsearchHealthIndicatorTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/elasticsearch/ElasticsearchHealthIndicatorTests.java @@ -63,7 +63,7 @@ public class ElasticsearchHealthIndicatorTests { private ElasticsearchHealthIndicator indicator; @Before - public void setUp() throws Exception { + public void setUp() { MockitoAnnotations.initMocks(this); given(this.client.admin()).willReturn(this.admin); given(this.admin.cluster()).willReturn(this.cluster); diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/NamePatternFilterTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/NamePatternFilterTests.java index 473e7ca6d7..3e7a32660b 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/NamePatternFilterTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/NamePatternFilterTests.java @@ -32,7 +32,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class NamePatternFilterTests { @Test - public void nonRegex() throws Exception { + public void nonRegex() { MockNamePatternFilter filter = new MockNamePatternFilter(); assertThat(filter.getResults("not.a.regex")).containsEntry("not.a.regex", "not.a.regex"); @@ -40,7 +40,7 @@ public class NamePatternFilterTests { } @Test - public void nonRegexThatContainsRegexPart() throws Exception { + public void nonRegexThatContainsRegexPart() { MockNamePatternFilter filter = new MockNamePatternFilter(); assertThat(filter.getResults("*")).containsEntry("*", "*"); assertThat(filter.isGetNamesCalled()).isFalse(); diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/SanitizerTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/SanitizerTests.java index b9a1a3d13b..fbe10a4e47 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/SanitizerTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/SanitizerTests.java @@ -29,7 +29,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class SanitizerTests { @Test - public void defaults() throws Exception { + public void defaults() { Sanitizer sanitizer = new Sanitizer(); assertThat(sanitizer.sanitize("password", "secret")).isEqualTo("******"); assertThat(sanitizer.sanitize("my-password", "secret")).isEqualTo("******"); @@ -42,7 +42,7 @@ public class SanitizerTests { } @Test - public void regex() throws Exception { + public void regex() { Sanitizer sanitizer = new Sanitizer(".*lock.*"); assertThat(sanitizer.sanitize("verylOCkish", "secret")).isEqualTo("******"); assertThat(sanitizer.sanitize("veryokish", "secret")).isEqualTo("secret"); diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/annotation/AnnotationEndpointDiscovererTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/annotation/AnnotationEndpointDiscovererTests.java index 5efaf4ee2d..f835cce164 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/annotation/AnnotationEndpointDiscovererTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/annotation/AnnotationEndpointDiscovererTests.java @@ -193,7 +193,7 @@ public class AnnotationEndpointDiscovererTests { } @Test - public void specializedEndpointsAreFilteredFromRegular() throws Exception { + public void specializedEndpointsAreFilteredFromRegular() { load(TestEndpointsConfiguration.class, (context) -> { Map> endpoints = mapEndpoints( new TestAnnotationEndpointDiscoverer(context).discoverEndpoints()); @@ -202,7 +202,7 @@ public class AnnotationEndpointDiscovererTests { } @Test - public void specializedEndpointsAreNotFilteredFromSpecialized() throws Exception { + public void specializedEndpointsAreNotFilteredFromSpecialized() { load(TestEndpointsConfiguration.class, (context) -> { Map> endpoints = mapEndpoints( new SpecializedTestAnnotationEndpointDiscoverer(context) @@ -212,7 +212,7 @@ public class AnnotationEndpointDiscovererTests { } @Test - public void extensionsAreApplied() throws Exception { + public void extensionsAreApplied() { load(TestEndpointsConfiguration.class, (context) -> { Map> endpoints = mapEndpoints( new SpecializedTestAnnotationEndpointDiscoverer(context) @@ -225,7 +225,7 @@ public class AnnotationEndpointDiscovererTests { } @Test - public void filtersAreApplied() throws Exception { + public void filtersAreApplied() { load(TestEndpointsConfiguration.class, (context) -> { EndpointFilter filter = (info, discoverer) -> !(info.getId().equals("specialized")); diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/cache/CachingOperationInvokerAdvisorTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/cache/CachingOperationInvokerAdvisorTests.java index 9a587a5734..0e9948c574 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/cache/CachingOperationInvokerAdvisorTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/cache/CachingOperationInvokerAdvisorTests.java @@ -58,14 +58,14 @@ public class CachingOperationInvokerAdvisorTests { } @Test - public void applyWhenOperationIsNotReadShouldNotAddAdvise() throws Exception { + public void applyWhenOperationIsNotReadShouldNotAddAdvise() { OperationMethodInfo info = mockInfo(OperationType.WRITE, "get"); OperationInvoker advised = this.advisor.apply("foo", info, this.invoker); assertThat(advised).isSameAs(this.invoker); } @Test - public void applyWhenHasParametersShouldNotAddAdvise() throws Exception { + public void applyWhenHasParametersShouldNotAddAdvise() { OperationMethodInfo info = mockInfo(OperationType.READ, "getWithParameter", String.class); OperationInvoker advised = this.advisor.apply("foo", info, this.invoker); @@ -73,7 +73,7 @@ public class CachingOperationInvokerAdvisorTests { } @Test - public void applyWhenTimeToLiveReturnsNullShouldNotAddAdvise() throws Exception { + public void applyWhenTimeToLiveReturnsNullShouldNotAddAdvise() { OperationMethodInfo info = mockInfo(OperationType.READ, "get"); given(this.timeToLive.apply(any())).willReturn(null); OperationInvoker advised = this.advisor.apply("foo", info, this.invoker); @@ -82,7 +82,7 @@ public class CachingOperationInvokerAdvisorTests { } @Test - public void applyWhenTimeToLiveIsZeroShouldNotAddAdvise() throws Exception { + public void applyWhenTimeToLiveIsZeroShouldNotAddAdvise() { OperationMethodInfo info = mockInfo(OperationType.READ, "get"); given(this.timeToLive.apply(any())).willReturn(0L); OperationInvoker advised = this.advisor.apply("foo", info, this.invoker); @@ -91,7 +91,7 @@ public class CachingOperationInvokerAdvisorTests { } @Test - public void applyShouldAddCacheAdvise() throws Exception { + public void applyShouldAddCacheAdvise() { OperationMethodInfo info = mockInfo(OperationType.READ, "get"); given(this.timeToLive.apply(any())).willReturn(100L); OperationInvoker advised = this.advisor.apply("foo", info, this.invoker); diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/convert/ConversionServiceParameterMapperTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/convert/ConversionServiceParameterMapperTests.java index b9bdf81c4d..1d0dbb958b 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/convert/ConversionServiceParameterMapperTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/convert/ConversionServiceParameterMapperTests.java @@ -46,7 +46,7 @@ public class ConversionServiceParameterMapperTests { public ExpectedException thrown = ExpectedException.none(); @Test - public void mapParameterShouldDelegateToConversionService() throws Exception { + public void mapParameterShouldDelegateToConversionService() { DefaultFormattingConversionService conversionService = spy( new DefaultFormattingConversionService()); ConversionServiceParameterMapper mapper = new ConversionServiceParameterMapper( @@ -57,8 +57,7 @@ public class ConversionServiceParameterMapperTests { } @Test - public void mapParameterWhenConversionServiceFailsShouldThrowParameterMappingException() - throws Exception { + public void mapParameterWhenConversionServiceFailsShouldThrowParameterMappingException() { ConversionService conversionService = mock(ConversionService.class); RuntimeException error = new RuntimeException(); given(conversionService.convert(any(), any())).willThrow(error); @@ -76,15 +75,14 @@ public class ConversionServiceParameterMapperTests { } @Test - public void createShouldRegisterIsoOffsetDateTimeConverter() throws Exception { + public void createShouldRegisterIsoOffsetDateTimeConverter() { ConversionServiceParameterMapper mapper = new ConversionServiceParameterMapper(); Date mapped = mapper.mapParameter("2011-12-03T10:15:30+01:00", Date.class); assertThat(mapped).isNotNull(); } @Test - public void createWithConversionServiceShouldNotRegisterIsoOffsetDateTimeConverter() - throws Exception { + public void createWithConversionServiceShouldNotRegisterIsoOffsetDateTimeConverter() { ConversionService conversionService = new DefaultConversionService(); ConversionServiceParameterMapper mapper = new ConversionServiceParameterMapper( conversionService); diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/convert/IsoOffsetDateTimeConverterTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/convert/IsoOffsetDateTimeConverterTests.java index c6962add52..248c26c0e3 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/convert/IsoOffsetDateTimeConverterTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/convert/IsoOffsetDateTimeConverterTests.java @@ -32,14 +32,14 @@ import static org.assertj.core.api.Assertions.assertThat; public class IsoOffsetDateTimeConverterTests { @Test - public void convertShouldConvertIsoDate() throws Exception { + public void convertShouldConvertIsoDate() { IsoOffsetDateTimeConverter converter = new IsoOffsetDateTimeConverter(); Date date = converter.convert("2011-12-03T10:15:30+01:00"); assertThat(date).isNotNull(); } @Test - public void registerConverterShouldRegister() throws Exception { + public void registerConverterShouldRegister() { DefaultConversionService service = new DefaultConversionService(); IsoOffsetDateTimeConverter.registerConverter(service); Date date = service.convert("2011-12-03T10:15:30+01:00", Date.class); diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/jmx/EndpointMBeanTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/jmx/EndpointMBeanTests.java index 4c961eca94..cbbc30c43f 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/jmx/EndpointMBeanTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/jmx/EndpointMBeanTests.java @@ -266,8 +266,7 @@ public class EndpointMBeanTests { } @Test - public void invokeWithParameterMappingExceptionMapsToIllegalArgumentException() - throws Exception { + public void invokeWithParameterMappingExceptionMapsToIllegalArgumentException() { load(FooEndpoint.class, (discoverer) -> { ObjectName objectName = registerEndpoint(discoverer, "foo"); try { @@ -285,8 +284,7 @@ public class EndpointMBeanTests { } @Test - public void invokeWithMissingRequiredParameterExceptionMapsToIllegalArgumentException() - throws Exception { + public void invokeWithMissingRequiredParameterExceptionMapsToIllegalArgumentException() { load(RequiredParametersEndpoint.class, (discoverer) -> { ObjectName objectName = registerEndpoint(discoverer, "requiredparameters"); try { @@ -304,7 +302,7 @@ public class EndpointMBeanTests { } @Test - public void invokeWithMissingNullableParameter() throws Exception { + public void invokeWithMissingNullableParameter() { load(RequiredParametersEndpoint.class, (discoverer) -> { ObjectName objectName = registerEndpoint(discoverer, "requiredparameters"); try { diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/AbstractWebEndpointIntegrationTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/AbstractWebEndpointIntegrationTests.java index f2e6eb3c90..9c84621465 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/AbstractWebEndpointIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/AbstractWebEndpointIntegrationTests.java @@ -273,14 +273,13 @@ public abstract class AbstractWebEndpointIntegrationTests client.get() .uri("/requiredparameters").exchange().expectStatus().isBadRequest()); } @Test - public void readOperationWithMissingNullableParametersIsOk() throws Exception { + public void readOperationWithMissingNullableParametersIsOk() { load(RequiredParameterEndpointConfiguration.class, (client) -> client.get() .uri("/requiredparameters?foo=hello").exchange().expectStatus().isOk()); } diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/env/EnvironmentEndpointWebIntegrationTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/env/EnvironmentEndpointWebIntegrationTests.java index 1b7cbc5c92..5354de2f3a 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/env/EnvironmentEndpointWebIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/env/EnvironmentEndpointWebIntegrationTests.java @@ -45,20 +45,20 @@ public class EnvironmentEndpointWebIntegrationTests { } @Test - public void home() throws Exception { + public void home() { client.get().uri("/actuator/env").exchange().expectStatus().isOk().expectBody() .jsonPath("propertySources[?(@.name=='systemProperties')]").exists(); } @Test - public void sub() throws Exception { + public void sub() { client.get().uri("/actuator/env/foo").exchange().expectStatus().isOk() .expectBody().jsonPath("property.source").isEqualTo("test") .jsonPath("property.value").isEqualTo("bar"); } @Test - public void regex() throws Exception { + public void regex() { Map map = new HashMap<>(); map.put("food", null); EnvironmentEndpointWebIntegrationTests.context.getEnvironment() @@ -69,8 +69,7 @@ public class EnvironmentEndpointWebIntegrationTests { } @Test - public void nestedPathWhenPlaceholderCannotBeResolvedShouldReturnUnresolvedProperty() - throws Exception { + public void nestedPathWhenPlaceholderCannotBeResolvedShouldReturnUnresolvedProperty() { Map map = new HashMap<>(); map.put("my.foo", "${my.bar}"); context.getEnvironment().getPropertySources() @@ -82,7 +81,7 @@ public class EnvironmentEndpointWebIntegrationTests { } @Test - public void nestedPathWithSensitivePlaceholderShouldSanitize() throws Exception { + public void nestedPathWithSensitivePlaceholderShouldSanitize() { Map map = new HashMap<>(); map.put("my.foo", "${my.password}"); map.put("my.password", "hello"); @@ -94,7 +93,7 @@ public class EnvironmentEndpointWebIntegrationTests { } @Test - public void nestedPathForUnknownKeyShouldReturn404AndBody() throws Exception { + public void nestedPathForUnknownKeyShouldReturn404AndBody() { client.get().uri("/actuator/env/this.does.not.exist").exchange().expectStatus() .isNotFound().expectBody().jsonPath("property").doesNotExist() .jsonPath("propertySources[?(@.name=='test')]").exists() @@ -103,8 +102,7 @@ public class EnvironmentEndpointWebIntegrationTests { } @Test - public void nestedPathMatchedByRegexWhenPlaceholderCannotBeResolvedShouldReturnUnresolvedProperty() - throws Exception { + public void nestedPathMatchedByRegexWhenPlaceholderCannotBeResolvedShouldReturnUnresolvedProperty() { Map map = new HashMap<>(); map.put("my.foo", "${my.bar}"); context.getEnvironment().getPropertySources() @@ -117,8 +115,7 @@ public class EnvironmentEndpointWebIntegrationTests { } @Test - public void nestedPathMatchedByRegexWithSensitivePlaceholderShouldSanitize() - throws Exception { + public void nestedPathMatchedByRegexWithSensitivePlaceholderShouldSanitize() { Map map = new HashMap<>(); map.put("my.foo", "${my.password}"); map.put("my.password", "hello"); diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/flyway/FlywayEndpointTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/flyway/FlywayEndpointTests.java index 74e10d1ea7..2b6fcf65d9 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/flyway/FlywayEndpointTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/flyway/FlywayEndpointTests.java @@ -40,7 +40,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class FlywayEndpointTests { @Test - public void flywayReportIsProduced() throws Exception { + public void flywayReportIsProduced() { new ApplicationContextRunner().withUserConfiguration(Config.class) .run((context) -> assertThat( context.getBean(FlywayEndpoint.class).flywayReports()) diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/ApplicationHealthIndicatorTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/ApplicationHealthIndicatorTests.java index 10ea3809f5..61ed939d24 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/ApplicationHealthIndicatorTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/ApplicationHealthIndicatorTests.java @@ -28,7 +28,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class ApplicationHealthIndicatorTests { @Test - public void indicatesUp() throws Exception { + public void indicatesUp() { ApplicationHealthIndicator healthIndicator = new ApplicationHealthIndicator(); assertThat(healthIndicator.health().getStatus()).isEqualTo(Status.UP); } diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/CompositeHealthIndicatorFactoryTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/CompositeHealthIndicatorFactoryTests.java index 5f04057a4a..869e1abe1f 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/CompositeHealthIndicatorFactoryTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/CompositeHealthIndicatorFactoryTests.java @@ -33,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class CompositeHealthIndicatorFactoryTests { @Test - public void upAndUpIsAggregatedToUp() throws Exception { + public void upAndUpIsAggregatedToUp() { Map healthIndicators = new HashMap<>(); healthIndicators.put("up", () -> new Health.Builder().status(Status.UP).build()); healthIndicators.put("upAgain", @@ -43,7 +43,7 @@ public class CompositeHealthIndicatorFactoryTests { } @Test - public void upAndDownIsAggregatedToDown() throws Exception { + public void upAndDownIsAggregatedToDown() { Map healthIndicators = new HashMap<>(); healthIndicators.put("up", () -> new Health.Builder().status(Status.UP).build()); healthIndicators.put("down", @@ -53,7 +53,7 @@ public class CompositeHealthIndicatorFactoryTests { } @Test - public void unknownStatusMapsToUnknown() throws Exception { + public void unknownStatusMapsToUnknown() { Map healthIndicators = new HashMap<>(); healthIndicators.put("status", () -> new Health.Builder().status("FINE").build()); HealthIndicator healthIndicator = createHealthIndicator(healthIndicators); diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/CompositeHealthIndicatorTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/CompositeHealthIndicatorTests.java index dd09a358b2..af571da8f7 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/CompositeHealthIndicatorTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/CompositeHealthIndicatorTests.java @@ -62,7 +62,7 @@ public class CompositeHealthIndicatorTests { } @Test - public void createWithIndicators() throws Exception { + public void createWithIndicators() { Map indicators = new HashMap<>(); indicators.put("one", this.one); indicators.put("two", this.two); @@ -77,7 +77,7 @@ public class CompositeHealthIndicatorTests { } @Test - public void createWithIndicatorsAndAdd() throws Exception { + public void createWithIndicatorsAndAdd() { Map indicators = new HashMap<>(); indicators.put("one", this.one); indicators.put("two", this.two); @@ -95,7 +95,7 @@ public class CompositeHealthIndicatorTests { } @Test - public void createWithoutAndAdd() throws Exception { + public void createWithoutAndAdd() { CompositeHealthIndicator composite = new CompositeHealthIndicator( this.healthAggregator); composite.addHealthIndicator("one", this.one); diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/HealthEndpointWebIntegrationTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/HealthEndpointWebIntegrationTests.java index dc919d05a4..0f691544bb 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/HealthEndpointWebIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/HealthEndpointWebIntegrationTests.java @@ -42,14 +42,14 @@ public class HealthEndpointWebIntegrationTests { private static ConfigurableApplicationContext context; @Test - public void whenHealthIsUp200ResponseIsReturned() throws Exception { + public void whenHealthIsUp200ResponseIsReturned() { client.get().uri("/actuator/health").exchange().expectStatus().isOk().expectBody() .jsonPath("status").isEqualTo("UP").jsonPath("details.alpha.status") .isEqualTo("UP").jsonPath("details.bravo.status").isEqualTo("UP"); } @Test - public void whenHealthIsDown503ResponseIsReturned() throws Exception { + public void whenHealthIsDown503ResponseIsReturned() { context.getBean("alphaHealthIndicator", TestHealthIndicator.class) .setHealth(Health.down().build()); client.get().uri("/actuator/health").exchange().expectStatus() diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/HealthTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/HealthTests.java index 462defc056..70fc98e56a 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/HealthTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/HealthTests.java @@ -35,21 +35,21 @@ public class HealthTests { public ExpectedException thrown = ExpectedException.none(); @Test - public void statusMustNotBeNull() throws Exception { + public void statusMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Status must not be null"); new Health.Builder(null, null); } @Test - public void createWithStatus() throws Exception { + public void createWithStatus() { Health health = Health.status(Status.UP).build(); assertThat(health.getStatus()).isEqualTo(Status.UP); assertThat(health.getDetails()).isEmpty(); } @Test - public void createWithDetails() throws Exception { + public void createWithDetails() { Health health = new Health.Builder(Status.UP, Collections.singletonMap("a", "b")) .build(); assertThat(health.getStatus()).isEqualTo(Status.UP); @@ -57,7 +57,7 @@ public class HealthTests { } @Test - public void equalsAndHashCode() throws Exception { + public void equalsAndHashCode() { Health h1 = new Health.Builder(Status.UP, Collections.singletonMap("a", "b")) .build(); Health h2 = new Health.Builder(Status.UP, Collections.singletonMap("a", "b")) @@ -72,7 +72,7 @@ public class HealthTests { } @Test - public void withException() throws Exception { + public void withException() { RuntimeException ex = new RuntimeException("bang"); Health health = new Health.Builder(Status.UP, Collections.singletonMap("a", "b")) .withException(ex).build(); @@ -82,7 +82,7 @@ public class HealthTests { } @Test - public void withDetails() throws Exception { + public void withDetails() { Health health = new Health.Builder(Status.UP, Collections.singletonMap("a", "b")) .withDetail("c", "d").build(); assertThat(health.getDetails().get("a")).isEqualTo("b"); @@ -90,35 +90,35 @@ public class HealthTests { } @Test - public void unknownWithDetails() throws Exception { + public void unknownWithDetails() { Health health = new Health.Builder().unknown().withDetail("a", "b").build(); assertThat(health.getStatus()).isEqualTo(Status.UNKNOWN); assertThat(health.getDetails().get("a")).isEqualTo("b"); } @Test - public void unknown() throws Exception { + public void unknown() { Health health = new Health.Builder().unknown().build(); assertThat(health.getStatus()).isEqualTo(Status.UNKNOWN); assertThat(health.getDetails()).isEmpty(); } @Test - public void upWithDetails() throws Exception { + public void upWithDetails() { Health health = new Health.Builder().up().withDetail("a", "b").build(); assertThat(health.getStatus()).isEqualTo(Status.UP); assertThat(health.getDetails().get("a")).isEqualTo("b"); } @Test - public void up() throws Exception { + public void up() { Health health = new Health.Builder().up().build(); assertThat(health.getStatus()).isEqualTo(Status.UP); assertThat(health.getDetails()).isEmpty(); } @Test - public void downWithException() throws Exception { + public void downWithException() { RuntimeException ex = new RuntimeException("bang"); Health health = Health.down(ex).build(); assertThat(health.getStatus()).isEqualTo(Status.DOWN); @@ -127,28 +127,28 @@ public class HealthTests { } @Test - public void down() throws Exception { + public void down() { Health health = Health.down().build(); assertThat(health.getStatus()).isEqualTo(Status.DOWN); assertThat(health.getDetails()).isEmpty(); } @Test - public void outOfService() throws Exception { + public void outOfService() { Health health = Health.outOfService().build(); assertThat(health.getStatus()).isEqualTo(Status.OUT_OF_SERVICE); assertThat(health.getDetails()).isEmpty(); } @Test - public void statusCode() throws Exception { + public void statusCode() { Health health = Health.status("UP").build(); assertThat(health.getStatus()).isEqualTo(Status.UP); assertThat(health.getDetails()).isEmpty(); } @Test - public void status() throws Exception { + public void status() { Health health = Health.status(Status.UP).build(); assertThat(health.getStatus()).isEqualTo(Status.UP); assertThat(health.getDetails()).isEmpty(); diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/info/EnvironmentInfoContributorTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/info/EnvironmentInfoContributorTests.java index 71639a668e..4b293741b6 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/info/EnvironmentInfoContributorTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/info/EnvironmentInfoContributorTests.java @@ -55,7 +55,7 @@ public class EnvironmentInfoContributorTests { @Test @SuppressWarnings("unchecked") - public void propertiesFromEnvironmentShouldBindCorrectly() throws Exception { + public void propertiesFromEnvironmentShouldBindCorrectly() { TestPropertyValues.of("INFO_ENVIRONMENT_FOO=green").applyTo(this.environment, Type.SYSTEM_ENVIRONMENT); Info actual = contributeFrom(this.environment); diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/info/InfoEndpointWebIntegrationTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/info/InfoEndpointWebIntegrationTests.java index 520158f26e..a1298ac405 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/info/InfoEndpointWebIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/info/InfoEndpointWebIntegrationTests.java @@ -44,7 +44,7 @@ public class InfoEndpointWebIntegrationTests { private static WebTestClient client; @Test - public void info() throws Exception { + public void info() { client.get().uri("/actuator/info").accept(MediaType.APPLICATION_JSON).exchange() .expectStatus().isOk().expectBody().jsonPath("beanName1.key11") .isEqualTo("value11").jsonPath("beanName1.key12").isEqualTo("value12") diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/liquibase/LiquibaseEndpointTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/liquibase/LiquibaseEndpointTests.java index e2bf2b65f0..e61aa68364 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/liquibase/LiquibaseEndpointTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/liquibase/LiquibaseEndpointTests.java @@ -45,7 +45,7 @@ public class LiquibaseEndpointTests { .withPropertyValues("spring.datasource.generate-unique-name=true"); @Test - public void liquibaseReportIsReturned() throws Exception { + public void liquibaseReportIsReturned() { this.contextRunner.withUserConfiguration(Config.class) .run((context) -> assertThat( context.getBean(LiquibaseEndpoint.class).liquibaseReports()) @@ -53,7 +53,7 @@ public class LiquibaseEndpointTests { } @Test - public void invokeWithCustomSchema() throws Exception { + public void invokeWithCustomSchema() { this.contextRunner.withUserConfiguration(Config.class) .withPropertyValues("spring.liquibase.default-schema=CUSTOMSCHEMA", "spring.datasource.schema=classpath:/db/create-custom-schema.sql") diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/logging/LogFileWebEndpointTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/logging/LogFileWebEndpointTests.java index e2f1594d5a..22d27da724 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/logging/LogFileWebEndpointTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/logging/LogFileWebEndpointTests.java @@ -57,12 +57,12 @@ public class LogFileWebEndpointTests { } @Test - public void nullResponseWithoutLogFile() throws Exception { + public void nullResponseWithoutLogFile() { assertThat(this.endpoint.logFile()).isNull(); } @Test - public void nullResponseWithMissingLogFile() throws Exception { + public void nullResponseWithMissingLogFile() { this.environment.setProperty("logging.file", "no_test.log"); assertThat(this.endpoint.logFile()).isNull(); } diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/logging/LogFileWebEndpointWebIntegrationTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/logging/LogFileWebEndpointWebIntegrationTests.java index 9481158c39..7c713c3610 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/logging/LogFileWebEndpointWebIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/logging/LogFileWebEndpointWebIntegrationTests.java @@ -59,12 +59,12 @@ public class LogFileWebEndpointWebIntegrationTests { } @Test - public void getRequestProduces404ResponseWhenLogFileNotFound() throws Exception { + public void getRequestProduces404ResponseWhenLogFileNotFound() { client.get().uri("/actuator/logfile").exchange().expectStatus().isNotFound(); } @Test - public void getRequestProducesResponseWithLogFile() throws Exception { + public void getRequestProducesResponseWithLogFile() { TestPropertyValues.of("logging.file:" + this.logFile.getAbsolutePath()) .applyTo(context); client.get().uri("/actuator/logfile").exchange().expectStatus().isOk() diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/logging/LoggersEndpointTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/logging/LoggersEndpointTests.java index 559d227370..6427bfcab8 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/logging/LoggersEndpointTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/logging/LoggersEndpointTests.java @@ -45,7 +45,7 @@ public class LoggersEndpointTests { @Test @SuppressWarnings("unchecked") - public void loggersShouldReturnLoggerConfigurations() throws Exception { + public void loggersShouldReturnLoggerConfigurations() { given(this.loggingSystem.getLoggerConfigurations()).willReturn(Collections .singletonList(new LoggerConfiguration("ROOT", null, LogLevel.DEBUG))); given(this.loggingSystem.getSupportedLogLevels()) @@ -62,7 +62,7 @@ public class LoggersEndpointTests { } @Test - public void loggerLevelsWhenNameSpecifiedShouldReturnLevels() throws Exception { + public void loggerLevelsWhenNameSpecifiedShouldReturnLevels() { given(this.loggingSystem.getLoggerConfiguration("ROOT")) .willReturn(new LoggerConfiguration("ROOT", null, LogLevel.DEBUG)); LoggerLevels levels = new LoggersEndpoint(this.loggingSystem) @@ -72,7 +72,7 @@ public class LoggersEndpointTests { } @Test - public void configureLogLevelShouldSetLevelOnLoggingSystem() throws Exception { + public void configureLogLevelShouldSetLevelOnLoggingSystem() { new LoggersEndpoint(this.loggingSystem).configureLogLevel("ROOT", LogLevel.DEBUG); verify(this.loggingSystem).setLogLevel("ROOT", LogLevel.DEBUG); } diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/logging/LoggersEndpointWebIntegrationTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/logging/LoggersEndpointWebIntegrationTests.java index 7a2815c4e5..1281006fbd 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/logging/LoggersEndpointWebIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/logging/LoggersEndpointWebIntegrationTests.java @@ -72,7 +72,7 @@ public class LoggersEndpointWebIntegrationTests { } @Test - public void getLoggerShouldReturnAllLoggerConfigurations() throws Exception { + public void getLoggerShouldReturnAllLoggerConfigurations() { given(this.loggingSystem.getLoggerConfigurations()).willReturn(Collections .singletonList(new LoggerConfiguration("ROOT", null, LogLevel.DEBUG))); client.get().uri("/actuator/loggers").exchange().expectStatus().isOk() @@ -86,7 +86,7 @@ public class LoggersEndpointWebIntegrationTests { } @Test - public void getLoggerShouldReturnLogLevels() throws Exception { + public void getLoggerShouldReturnLogLevels() { given(this.loggingSystem.getLoggerConfiguration("ROOT")) .willReturn(new LoggerConfiguration("ROOT", null, LogLevel.DEBUG)); client.get().uri("/actuator/loggers/ROOT").exchange().expectStatus().isOk() @@ -96,13 +96,13 @@ public class LoggersEndpointWebIntegrationTests { } @Test - public void getLoggersWhenLoggerNotFoundShouldReturnNotFound() throws Exception { + public void getLoggersWhenLoggerNotFoundShouldReturnNotFound() { client.get().uri("/actuator/loggers/com.does.not.exist").exchange().expectStatus() .isNotFound(); } @Test - public void setLoggerUsingApplicationJsonShouldSetLogLevel() throws Exception { + public void setLoggerUsingApplicationJsonShouldSetLogLevel() { client.post().uri("/actuator/loggers/ROOT") .contentType(MediaType.APPLICATION_JSON) .syncBody(Collections.singletonMap("configuredLevel", "debug")).exchange() @@ -111,7 +111,7 @@ public class LoggersEndpointWebIntegrationTests { } @Test - public void setLoggerUsingActuatorV2JsonShouldSetLogLevel() throws Exception { + public void setLoggerUsingActuatorV2JsonShouldSetLogLevel() { client.post().uri("/actuator/loggers/ROOT") .contentType(MediaType.parseMediaType(ActuatorMediaType.V2_JSON)) .syncBody(Collections.singletonMap("configuredLevel", "debug")).exchange() @@ -120,7 +120,7 @@ public class LoggersEndpointWebIntegrationTests { } @Test - public void setLoggerWithWrongLogLevelResultInBadRequestResponse() throws Exception { + public void setLoggerWithWrongLogLevelResultInBadRequestResponse() { client.post().uri("/actuator/loggers/ROOT") .contentType(MediaType.APPLICATION_JSON) .syncBody(Collections.singletonMap("configuredLevel", "other")).exchange() @@ -129,7 +129,7 @@ public class LoggersEndpointWebIntegrationTests { } @Test - public void setLoggerWithNullLogLevel() throws Exception { + public void setLoggerWithNullLogLevel() { client.post().uri("/actuator/loggers/ROOT") .contentType(MediaType.parseMediaType(ActuatorMediaType.V2_JSON)) .syncBody(Collections.singletonMap("configuredLevel", null)).exchange() @@ -138,7 +138,7 @@ public class LoggersEndpointWebIntegrationTests { } @Test - public void setLoggerWithNoLogLevel() throws Exception { + public void setLoggerWithNoLogLevel() { client.post().uri("/actuator/loggers/ROOT") .contentType(MediaType.parseMediaType(ActuatorMediaType.V2_JSON)) .syncBody(Collections.emptyMap()).exchange().expectStatus().isNoContent(); @@ -146,8 +146,7 @@ public class LoggersEndpointWebIntegrationTests { } @Test - public void logLevelForLoggerWithNameThatCouldBeMistakenForAPathExtension() - throws Exception { + public void logLevelForLoggerWithNameThatCouldBeMistakenForAPathExtension() { given(this.loggingSystem.getLoggerConfiguration("com.png")) .willReturn(new LoggerConfiguration("com.png", null, LogLevel.DEBUG)); client.get().uri("/actuator/loggers/com.png").exchange().expectStatus().isOk() diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/mail/MailHealthIndicatorTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/mail/MailHealthIndicatorTests.java index 2a19b922b6..0ab79094e6 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/mail/MailHealthIndicatorTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/mail/MailHealthIndicatorTests.java @@ -90,13 +90,11 @@ public class MailHealthIndicatorTests { } @Override - public void connect(String host, int port, String user, String password) - throws MessagingException { + public void connect(String host, int port, String user, String password) { } @Override - public void sendMessage(Message msg, Address[] addresses) - throws MessagingException { + public void sendMessage(Message msg, Address[] addresses) { } } diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/management/HeapDumpWebEndpointWebIntegrationTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/management/HeapDumpWebEndpointWebIntegrationTests.java index 1ff9f4a551..b2b93095e1 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/management/HeapDumpWebEndpointWebIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/management/HeapDumpWebEndpointWebIntegrationTests.java @@ -58,8 +58,7 @@ public class HeapDumpWebEndpointWebIntegrationTests { } @Test - public void invokeWhenNotAvailableShouldReturnServiceUnavailableStatus() - throws Exception { + public void invokeWhenNotAvailableShouldReturnServiceUnavailableStatus() { this.endpoint.setAvailable(false); client.get().uri("/actuator/heapdump").exchange().expectStatus() .isEqualTo(HttpStatus.SERVICE_UNAVAILABLE); diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/management/ThreadDumpEndpointTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/management/ThreadDumpEndpointTests.java index 29725007fd..d35def1c37 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/management/ThreadDumpEndpointTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/management/ThreadDumpEndpointTests.java @@ -29,7 +29,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class ThreadDumpEndpointTests { @Test - public void dumpThreads() throws Exception { + public void dumpThreads() { assertThat(new ThreadDumpEndpoint().threadDump().getThreads().size()) .isGreaterThan(0); } diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/MetricsEndpointWebIntegrationTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/MetricsEndpointWebIntegrationTests.java index bb68e591f7..5fe8c4fea7 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/MetricsEndpointWebIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/MetricsEndpointWebIntegrationTests.java @@ -63,7 +63,7 @@ public class MetricsEndpointWebIntegrationTests { } @Test - public void selectByName() throws IOException { + public void selectByName() { MockClock.clock(registry).add(SimpleConfig.DEFAULT_STEP); client.get().uri("/actuator/metrics/jvm.memory.used").exchange().expectStatus() .isOk().expectBody().jsonPath("$.name").isEqualTo("jvm.memory.used"); diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/jdbc/DataSourcePoolMetricsTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/jdbc/DataSourcePoolMetricsTests.java index 520ac737c6..62c9901a5d 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/jdbc/DataSourcePoolMetricsTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/jdbc/DataSourcePoolMetricsTests.java @@ -16,7 +16,6 @@ package org.springframework.boot.actuate.metrics.jdbc; -import java.sql.SQLException; import java.util.Collection; import java.util.Collections; @@ -44,7 +43,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class DataSourcePoolMetricsTests { @Test - public void dataSourceIsInstrumented() throws SQLException, InterruptedException { + public void dataSourceIsInstrumented() { new ApplicationContextRunner() .withUserConfiguration(DataSourceConfig.class, MetricsApp.class) .withConfiguration( diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcMetricsFilterTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcMetricsFilterTests.java index 24e4016f95..d911a040ad 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcMetricsFilterTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcMetricsFilterTests.java @@ -152,7 +152,7 @@ public class WebMvcMetricsFilterTests { } @Test - public void unhandledError() throws Exception { + public void unhandledError() { assertThatCode(() -> this.mvc.perform(get("/api/c1/unhandledError/10")) .andExpect(status().isOk())) .hasRootCauseInstanceOf(RuntimeException.class); diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcMetricsIntegrationTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcMetricsIntegrationTests.java index 5edaa6d5bd..3faa2babac 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcMetricsIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcMetricsIntegrationTests.java @@ -89,7 +89,7 @@ public class WebMvcMetricsIntegrationTests { } @Test - public void rethrownExceptionIsRecordedInMetricTag() throws Exception { + public void rethrownExceptionIsRecordedInMetricTag() { assertThatCode(() -> this.mvc.perform(get("/api/rethrownError")) .andExpect(status().is5xxServerError())); this.clock.add(SimpleConfig.DEFAULT_STEP); @@ -163,14 +163,14 @@ public class WebMvcMetricsIntegrationTests { WebMvcMetrics metrics; @ExceptionHandler - ResponseEntity handleError(Exception1 ex) throws Throwable { + ResponseEntity handleError(Exception1 ex) { this.metrics.tagWithException(ex); return new ResponseEntity<>("this is a custom exception body", HttpStatus.INTERNAL_SERVER_ERROR); } @ExceptionHandler - ResponseEntity rethrowError(Exception2 ex) throws Throwable { + ResponseEntity rethrowError(Exception2 ex) { throw ex; } diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/mongo/MongoHealthIndicatorTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/mongo/MongoHealthIndicatorTests.java index 3d391d9d25..135cb4e9ba 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/mongo/MongoHealthIndicatorTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/mongo/MongoHealthIndicatorTests.java @@ -48,7 +48,7 @@ public class MongoHealthIndicatorTests { } @Test - public void mongoIsUp() throws Exception { + public void mongoIsUp() { Document commandResult = mock(Document.class); given(commandResult.getString("version")).willReturn("2.6.4"); MongoTemplate mongoTemplate = mock(MongoTemplate.class); @@ -62,7 +62,7 @@ public class MongoHealthIndicatorTests { } @Test - public void mongoIsDown() throws Exception { + public void mongoIsDown() { MongoTemplate mongoTemplate = mock(MongoTemplate.class); given(mongoTemplate.executeCommand("{ buildInfo: 1 }")) .willThrow(new MongoException("Connection failed")); diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/redis/RedisHealthIndicatorTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/redis/RedisHealthIndicatorTests.java index 836a515d77..a1f9996f3c 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/redis/RedisHealthIndicatorTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/redis/RedisHealthIndicatorTests.java @@ -47,7 +47,7 @@ import static org.mockito.Mockito.verify; public class RedisHealthIndicatorTests { @Test - public void redisIsUp() throws Exception { + public void redisIsUp() { Properties info = new Properties(); info.put("redis_version", "2.8.9"); RedisConnection redisConnection = mock(RedisConnection.class); @@ -59,7 +59,7 @@ public class RedisHealthIndicatorTests { } @Test - public void redisIsDown() throws Exception { + public void redisIsDown() { RedisConnection redisConnection = mock(RedisConnection.class); given(redisConnection.info()) .willThrow(new RedisConnectionFailureException("Connection failed")); @@ -78,7 +78,7 @@ public class RedisHealthIndicatorTests { } @Test - public void redisClusterIsUp() throws Exception { + public void redisClusterIsUp() { Properties clusterProperties = new Properties(); clusterProperties.setProperty("cluster_size", "4"); clusterProperties.setProperty("cluster_slots_ok", "4"); diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/security/AuthenticationAuditListenerTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/security/AuthenticationAuditListenerTests.java index 9a8ae3353a..a3c324a11d 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/security/AuthenticationAuditListenerTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/security/AuthenticationAuditListenerTests.java @@ -93,7 +93,7 @@ public class AuthenticationAuditListenerTests { } @Test - public void testDetailsAreIncludedInAuditEvent() throws Exception { + public void testDetailsAreIncludedInAuditEvent() { Object details = new Object(); UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken( "user", "password"); diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/security/AuthorizationAuditListenerTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/security/AuthorizationAuditListenerTests.java index c1b65a671d..02c427e329 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/security/AuthorizationAuditListenerTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/security/AuthorizationAuditListenerTests.java @@ -73,7 +73,7 @@ public class AuthorizationAuditListenerTests { } @Test - public void testDetailsAreIncludedInAuditEvent() throws Exception { + public void testDetailsAreIncludedInAuditEvent() { Object details = new Object(); UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken( "user", "password"); diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/session/SessionsEndpointWebIntegrationTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/session/SessionsEndpointWebIntegrationTests.java index 0fb7578ec3..1617e7b16b 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/session/SessionsEndpointWebIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/session/SessionsEndpointWebIntegrationTests.java @@ -51,13 +51,13 @@ public class SessionsEndpointWebIntegrationTests { private static WebTestClient client; @Test - public void sessionsForUsernameWithoutUsernameParam() throws Exception { + public void sessionsForUsernameWithoutUsernameParam() { client.get().uri((builder) -> builder.path("/actuator/sessions").build()) .exchange().expectStatus().isBadRequest(); } @Test - public void sessionsForUsernameNoResults() throws Exception { + public void sessionsForUsernameNoResults() { given(repository.findByIndexNameAndIndexValue( FindByIndexNameSessionRepository.PRINCIPAL_NAME_INDEX_NAME, "user")) .willReturn(Collections.emptyMap()); @@ -69,7 +69,7 @@ public class SessionsEndpointWebIntegrationTests { } @Test - public void sessionsForUsernameFound() throws Exception { + public void sessionsForUsernameFound() { given(repository.findByIndexNameAndIndexValue( FindByIndexNameSessionRepository.PRINCIPAL_NAME_INDEX_NAME, "user")) .willReturn(Collections.singletonMap(session.getId(), session)); diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/system/DiskSpaceHealthIndicatorTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/system/DiskSpaceHealthIndicatorTests.java index 8907cd9f58..ae0f5ef9c8 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/system/DiskSpaceHealthIndicatorTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/system/DiskSpaceHealthIndicatorTests.java @@ -50,7 +50,7 @@ public class DiskSpaceHealthIndicatorTests { private HealthIndicator healthIndicator; @Before - public void setUp() throws Exception { + public void setUp() { MockitoAnnotations.initMocks(this); given(this.fileMock.exists()).willReturn(true); given(this.fileMock.canRead()).willReturn(true); @@ -59,7 +59,7 @@ public class DiskSpaceHealthIndicatorTests { } @Test - public void diskSpaceIsUp() throws Exception { + public void diskSpaceIsUp() { given(this.fileMock.getUsableSpace()).willReturn(THRESHOLD_BYTES + 10); given(this.fileMock.getTotalSpace()).willReturn(THRESHOLD_BYTES * 10); Health health = this.healthIndicator.health(); @@ -70,7 +70,7 @@ public class DiskSpaceHealthIndicatorTests { } @Test - public void diskSpaceIsDown() throws Exception { + public void diskSpaceIsDown() { given(this.fileMock.getUsableSpace()).willReturn(THRESHOLD_BYTES - 10); given(this.fileMock.getTotalSpace()).willReturn(THRESHOLD_BYTES * 10); Health health = this.healthIndicator.health(); diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/trace/TraceEndpointTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/trace/TraceEndpointTests.java index 938c96bcce..f2250e8730 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/trace/TraceEndpointTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/trace/TraceEndpointTests.java @@ -31,7 +31,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class TraceEndpointTests { @Test - public void trace() throws Exception { + public void trace() { TraceRepository repository = new InMemoryTraceRepository(); repository.add(Collections.singletonMap("a", "b")); Trace trace = new TraceEndpoint(repository).traces().getTraces().get(0); diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/trace/WebRequestTraceFilterTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/trace/WebRequestTraceFilterTests.java index 2eeb30e3d3..8bc2f6657b 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/trace/WebRequestTraceFilterTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/trace/WebRequestTraceFilterTests.java @@ -136,8 +136,7 @@ public class WebRequestTraceFilterTests { @Test @SuppressWarnings({ "unchecked" }) - public void filterDoesNotAddRequestCookiesWithCookiesExclude() - throws ServletException, IOException { + public void filterDoesNotAddRequestCookiesWithCookiesExclude() { WebRequestTraceFilter filter = new WebRequestTraceFilter(this.repository, Collections.singleton(Include.REQUEST_HEADERS)); MockHttpServletRequest request = spy(new MockHttpServletRequest("GET", "/foo")); @@ -182,8 +181,7 @@ public class WebRequestTraceFilterTests { @Test @SuppressWarnings({ "unchecked" }) - public void filterDoesNotAddResponseCookiesWithCookiesExclude() - throws ServletException, IOException { + public void filterDoesNotAddResponseCookiesWithCookiesExclude() { WebRequestTraceFilter filter = new WebRequestTraceFilter(this.repository, Collections.singleton(Include.RESPONSE_HEADERS)); MockHttpServletRequest request = new MockHttpServletRequest("GET", "/foo"); @@ -267,7 +265,7 @@ public class WebRequestTraceFilterTests { @Test @SuppressWarnings("unchecked") - public void postProcessRequestHeaders() throws Exception { + public void postProcessRequestHeaders() { WebRequestTraceFilter filter = new WebRequestTraceFilter(this.repository) { @Override diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationImportSelectorTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationImportSelectorTests.java index 3c1c63a281..9509cc4f1e 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationImportSelectorTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationImportSelectorTests.java @@ -172,22 +172,19 @@ public class AutoConfigurationImportSelectorTests { } @Test - public void nonAutoConfigurationClassExclusionsShouldThrowException() - throws Exception { + public void nonAutoConfigurationClassExclusionsShouldThrowException() { this.expected.expect(IllegalStateException.class); selectImports(EnableAutoConfigurationWithFaultyClassExclude.class); } @Test - public void nonAutoConfigurationClassNameExclusionsWhenPresentOnClassPathShouldThrowException() - throws Exception { + public void nonAutoConfigurationClassNameExclusionsWhenPresentOnClassPathShouldThrowException() { this.expected.expect(IllegalStateException.class); selectImports(EnableAutoConfigurationWithFaultyClassNameExclude.class); } @Test - public void nonAutoConfigurationPropertyExclusionsWhenPresentOnClassPathShouldThrowException() - throws Exception { + public void nonAutoConfigurationPropertyExclusionsWhenPresentOnClassPathShouldThrowException() { this.environment.setProperty("spring.autoconfigure.exclude", "org.springframework.boot.autoconfigure." + "AutoConfigurationImportSelectorTests.TestConfiguration"); @@ -196,8 +193,7 @@ public class AutoConfigurationImportSelectorTests { } @Test - public void nameAndPropertyExclusionsWhenNotPresentOnClasspathShouldNotThrowException() - throws Exception { + public void nameAndPropertyExclusionsWhenNotPresentOnClasspathShouldNotThrowException() { this.environment.setProperty("spring.autoconfigure.exclude", "org.springframework.boot.autoconfigure.DoesNotExist2"); selectImports(EnableAutoConfigurationWithAbsentClassNameExclude.class); @@ -208,7 +204,7 @@ public class AutoConfigurationImportSelectorTests { } @Test - public void filterShouldFilterImports() throws Exception { + public void filterShouldFilterImports() { String[] defaultImports = selectImports(BasicEnableAutoConfiguration.class); this.filters.add(new TestAutoConfigurationImportFilter(defaultImports, 1)); this.filters.add(new TestAutoConfigurationImportFilter(defaultImports, 3, 4)); @@ -219,7 +215,7 @@ public class AutoConfigurationImportSelectorTests { } @Test - public void filterShouldSupportAware() throws Exception { + public void filterShouldSupportAware() { TestAutoConfigurationImportFilter filter = new TestAutoConfigurationImportFilter( new String[] {}); this.filters.add(filter); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationMetadataLoaderTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationMetadataLoaderTests.java index 06213654d0..d07c242810 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationMetadataLoaderTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationMetadataLoaderTests.java @@ -30,63 +30,63 @@ import static org.assertj.core.api.Assertions.assertThat; public class AutoConfigurationMetadataLoaderTests { @Test - public void loadShouldLoadProperties() throws Exception { + public void loadShouldLoadProperties() { assertThat(load()).isNotNull(); } @Test - public void wasProcessedWhenProcessedShouldReturnTrue() throws Exception { + public void wasProcessedWhenProcessedShouldReturnTrue() { assertThat(load().wasProcessed("test")).isTrue(); } @Test - public void wasProcessedWhenNotProcessedShouldReturnFalse() throws Exception { + public void wasProcessedWhenNotProcessedShouldReturnFalse() { assertThat(load().wasProcessed("testx")).isFalse(); } @Test - public void getIntegerShouldReturnValue() throws Exception { + public void getIntegerShouldReturnValue() { assertThat(load().getInteger("test", "int")).isEqualTo(123); } @Test - public void getIntegerWhenMissingShouldReturnNull() throws Exception { + public void getIntegerWhenMissingShouldReturnNull() { assertThat(load().getInteger("test", "intx")).isNull(); } @Test - public void getIntegerWithDefaultWhenMissingShouldReturnDefault() throws Exception { + public void getIntegerWithDefaultWhenMissingShouldReturnDefault() { assertThat(load().getInteger("test", "intx", 345)).isEqualTo(345); } @Test - public void getSetShouldReturnValue() throws Exception { + public void getSetShouldReturnValue() { assertThat(load().getSet("test", "set")).containsExactly("a", "b", "c"); } @Test - public void getSetWhenMissingShouldReturnNull() throws Exception { + public void getSetWhenMissingShouldReturnNull() { assertThat(load().getSet("test", "setx")).isNull(); } @Test - public void getSetWithDefaultWhenMissingShouldReturnDefault() throws Exception { + public void getSetWithDefaultWhenMissingShouldReturnDefault() { assertThat(load().getSet("test", "setx", Collections.singleton("x"))) .containsExactly("x"); } @Test - public void getShouldReturnValue() throws Exception { + public void getShouldReturnValue() { assertThat(load().get("test", "string")).isEqualTo("abc"); } @Test - public void getWhenMissingShouldReturnNull() throws Exception { + public void getWhenMissingShouldReturnNull() { assertThat(load().get("test", "stringx")).isNull(); } @Test - public void getWithDefaultWhenMissingShouldReturnDefault() throws Exception { + public void getWithDefaultWhenMissingShouldReturnDefault() { assertThat(load().get("test", "stringx", "xyz")).isEqualTo("xyz"); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationPackagesTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationPackagesTests.java index ab72f324a4..8e03fa8333 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationPackagesTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationPackagesTests.java @@ -52,7 +52,7 @@ public class AutoConfigurationPackagesTests { } @Test - public void getWithoutSet() throws Exception { + public void getWithoutSet() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext( EmptyConfig.class); this.thrown.expect(IllegalStateException.class); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationReproTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationReproTests.java index eebd21ddb9..d0780aeb87 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationReproTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationReproTests.java @@ -45,7 +45,7 @@ public class AutoConfigurationReproTests { } @Test - public void doesNotEarlyInitializeFactoryBeans() throws Exception { + public void doesNotEarlyInitializeFactoryBeans() { SpringApplication application = new SpringApplication(EarlyInitConfig.class, PropertySourcesPlaceholderConfigurer.class, ServletWebServerFactoryAutoConfiguration.class); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationSorterTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationSorterTests.java index c664ba0384..4d3bb7a155 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationSorterTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationSorterTests.java @@ -87,60 +87,59 @@ public class AutoConfigurationSorterTests { } @Test - public void byOrderAnnotation() throws Exception { + public void byOrderAnnotation() { List actual = this.sorter .getInPriorityOrder(Arrays.asList(LOWEST, HIGHEST, DEFAULT)); assertThat(actual).containsExactly(HIGHEST, DEFAULT, LOWEST); } @Test - public void byAutoConfigureAfter() throws Exception { + public void byAutoConfigureAfter() { List actual = this.sorter.getInPriorityOrder(Arrays.asList(A, B, C)); assertThat(actual).containsExactly(C, B, A); } @Test - public void byAutoConfigureBefore() throws Exception { + public void byAutoConfigureBefore() { List actual = this.sorter.getInPriorityOrder(Arrays.asList(X, Y, Z)); assertThat(actual).containsExactly(Z, Y, X); } @Test - public void byAutoConfigureAfterDoubles() throws Exception { + public void byAutoConfigureAfterDoubles() { List actual = this.sorter.getInPriorityOrder(Arrays.asList(A, B, C, E)); assertThat(actual).containsExactly(C, E, B, A); } @Test - public void byAutoConfigureMixedBeforeAndAfter() throws Exception { + public void byAutoConfigureMixedBeforeAndAfter() { List actual = this.sorter .getInPriorityOrder(Arrays.asList(A, B, C, W, X)); assertThat(actual).containsExactly(C, W, B, A, X); } @Test - public void byAutoConfigureMixedBeforeAndAfterWithClassNames() throws Exception { + public void byAutoConfigureMixedBeforeAndAfterWithClassNames() { List actual = this.sorter .getInPriorityOrder(Arrays.asList(A2, B, C, W2, X)); assertThat(actual).containsExactly(C, W2, B, A2, X); } @Test - public void byAutoConfigureMixedBeforeAndAfterWithDifferentInputOrder() - throws Exception { + public void byAutoConfigureMixedBeforeAndAfterWithDifferentInputOrder() { List actual = this.sorter .getInPriorityOrder(Arrays.asList(W, X, A, B, C)); assertThat(actual).containsExactly(C, W, B, A, X); } @Test - public void byAutoConfigureAfterWithMissing() throws Exception { + public void byAutoConfigureAfterWithMissing() { List actual = this.sorter.getInPriorityOrder(Arrays.asList(A, B)); assertThat(actual).containsExactly(B, A); } @Test - public void byAutoConfigureAfterWithCycle() throws Exception { + public void byAutoConfigureAfterWithCycle() { this.thrown.expect(IllegalStateException.class); this.thrown.expectMessage("AutoConfigure cycle detected"); this.sorter.getInPriorityOrder(Arrays.asList(A, B, C, D)); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationsTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationsTests.java index 2dd4ba05f5..953cdabb51 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationsTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationsTests.java @@ -30,7 +30,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class AutoConfigurationsTests { @Test - public void ofShouldCreateOrderedConfigurations() throws Exception { + public void ofShouldCreateOrderedConfigurations() { Configurations configurations = AutoConfigurations.of(AutoConfigureA.class, AutoConfigureB.class); assertThat(Configurations.getClasses(configurations)) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/ImportAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/ImportAutoConfigurationTests.java index aaf8e8cc3b..bc9421747a 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/ImportAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/ImportAutoConfigurationTests.java @@ -45,13 +45,13 @@ public class ImportAutoConfigurationTests { } @Test - public void classesAsAnAlias() throws Exception { + public void classesAsAnAlias() { assertThat(getImportedConfigBeans(AnotherConfigUsingClasses.class)) .containsExactly("ConfigA", "ConfigB", "ConfigC", "ConfigD"); } @Test - public void excluding() throws Exception { + public void excluding() { assertThat(getImportedConfigBeans(ExcludingConfig.class)) .containsExactly("ConfigA", "ConfigB", "ConfigD"); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/admin/SpringApplicationAdminJmxAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/admin/SpringApplicationAdminJmxAutoConfigurationTests.java index de3a00a6fd..2a2e391916 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/admin/SpringApplicationAdminJmxAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/admin/SpringApplicationAdminJmxAutoConfigurationTests.java @@ -69,8 +69,7 @@ public class SpringApplicationAdminJmxAutoConfigurationTests { SpringApplicationAdminJmxAutoConfiguration.class)); @Test - public void notRegisteredByDefault() - throws MalformedObjectNameException, InstanceNotFoundException { + public void notRegisteredByDefault() { this.contextRunner.run((context) -> { this.thrown.expect(InstanceNotFoundException.class); this.server.getObjectInstance(createDefaultObjectName()); @@ -78,7 +77,7 @@ public class SpringApplicationAdminJmxAutoConfigurationTests { } @Test - public void registeredWithProperty() throws Exception { + public void registeredWithProperty() { this.contextRunner.withPropertyValues(ENABLE_ADMIN_PROP).run((context) -> { ObjectName objectName = createDefaultObjectName(); ObjectInstance objectInstance = this.server.getObjectInstance(objectName); @@ -88,7 +87,7 @@ public class SpringApplicationAdminJmxAutoConfigurationTests { } @Test - public void registerWithCustomJmxName() throws InstanceNotFoundException { + public void registerWithCustomJmxName() { String customJmxName = "org.acme:name=FooBar"; this.contextRunner .withSystemProperties( @@ -125,7 +124,7 @@ public class SpringApplicationAdminJmxAutoConfigurationTests { } @Test - public void onlyRegisteredOnceWhenThereIsAChildContext() throws Exception { + public void onlyRegisteredOnceWhenThereIsAChildContext() { SpringApplicationBuilder parentBuilder = new SpringApplicationBuilder() .web(WebApplicationType.NONE) .sources(MultipleMBeanExportersConfiguration.class, diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java index 86437c4a25..d2c4ee1233 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java @@ -518,7 +518,7 @@ public class RabbitAutoConfigurationTests { } @Test - public void enableRabbitAutomatically() throws Exception { + public void enableRabbitAutomatically() { this.contextRunner.withUserConfiguration(NoEnableRabbitConfiguration.class) .run((context) -> { assertThat(context).hasBean( @@ -595,7 +595,7 @@ public class RabbitAutoConfigurationTests { } @Test - public void enableSslWithInvalidKeystoreTypeShouldFail() throws Exception { + public void enableSslWithInvalidKeystoreTypeShouldFail() { this.contextRunner.withUserConfiguration(TestConfiguration.class) .withPropertyValues("spring.rabbitmq.ssl.enabled:true", "spring.rabbitmq.ssl.keyStore=foo", @@ -609,7 +609,7 @@ public class RabbitAutoConfigurationTests { } @Test - public void enableSslWithInvalidTrustStoreTypeShouldFail() throws Exception { + public void enableSslWithInvalidTrustStoreTypeShouldFail() { this.contextRunner.withUserConfiguration(TestConfiguration.class) .withPropertyValues("spring.rabbitmq.ssl.enabled:true", "spring.rabbitmq.ssl.trustStore=bar", @@ -623,7 +623,7 @@ public class RabbitAutoConfigurationTests { } @Test - public void enableSslWithKeystoreTypeAndTrustStoreTypeShouldWork() throws Exception { + public void enableSslWithKeystoreTypeAndTrustStoreTypeShouldWork() { this.contextRunner.withUserConfiguration(TestConfiguration.class) .withPropertyValues("spring.rabbitmq.ssl.enabled:true", "spring.rabbitmq.ssl.keyStore=/org/springframework/boot/autoconfigure/amqp/test.jks", diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfigurationTests.java index fd6f735d8f..12f2244359 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfigurationTests.java @@ -29,7 +29,6 @@ import org.junit.rules.ExpectedException; import org.springframework.batch.core.BatchStatus; import org.springframework.batch.core.Job; import org.springframework.batch.core.JobExecution; -import org.springframework.batch.core.JobExecutionException; import org.springframework.batch.core.JobParameters; import org.springframework.batch.core.Step; import org.springframework.batch.core.configuration.JobRegistry; @@ -82,7 +81,7 @@ public class BatchAutoConfigurationTests { TransactionAutoConfiguration.class)); @Test - public void testDefaultContext() throws Exception { + public void testDefaultContext() { this.contextRunner.withUserConfiguration(TestConfiguration.class, EmbeddedDataSourceConfiguration.class).run((context) -> { assertThat(context).hasSingleBean(JobLauncher.class); @@ -96,7 +95,7 @@ public class BatchAutoConfigurationTests { } @Test - public void testNoDatabase() throws Exception { + public void testNoDatabase() { this.contextRunner.withUserConfiguration(TestCustomConfiguration.class) .run((context) -> { assertThat(context).hasSingleBean(JobLauncher.class); @@ -106,7 +105,7 @@ public class BatchAutoConfigurationTests { } @Test - public void testNoBatchConfiguration() throws Exception { + public void testNoBatchConfiguration() { this.contextRunner.withUserConfiguration(EmptyConfiguration.class, EmbeddedDataSourceConfiguration.class).run((context) -> { assertThat(context).doesNotHaveBean(JobLauncher.class); @@ -115,7 +114,7 @@ public class BatchAutoConfigurationTests { } @Test - public void testDefinesAndLaunchesJob() throws Exception { + public void testDefinesAndLaunchesJob() { this.contextRunner.withUserConfiguration(JobConfiguration.class, EmbeddedDataSourceConfiguration.class).run((context) -> { assertThat(context).hasSingleBean(JobLauncher.class); @@ -126,7 +125,7 @@ public class BatchAutoConfigurationTests { } @Test - public void testDefinesAndLaunchesNamedJob() throws Exception { + public void testDefinesAndLaunchesNamedJob() { this.contextRunner .withUserConfiguration(NamedJobConfigurationWithRegisteredJob.class, EmbeddedDataSourceConfiguration.class) @@ -140,7 +139,7 @@ public class BatchAutoConfigurationTests { } @Test - public void testDefinesAndLaunchesLocalJob() throws Exception { + public void testDefinesAndLaunchesLocalJob() { this.contextRunner .withUserConfiguration(NamedJobConfigurationWithLocalJob.class, EmbeddedDataSourceConfiguration.class) @@ -155,7 +154,7 @@ public class BatchAutoConfigurationTests { } @Test - public void testDisableLaunchesJob() throws Exception { + public void testDisableLaunchesJob() { this.contextRunner .withUserConfiguration(JobConfiguration.class, EmbeddedDataSourceConfiguration.class) @@ -166,7 +165,7 @@ public class BatchAutoConfigurationTests { } @Test - public void testDisableSchemaLoader() throws Exception { + public void testDisableSchemaLoader() { this.contextRunner .withUserConfiguration(TestConfiguration.class, EmbeddedDataSourceConfiguration.class) @@ -184,7 +183,7 @@ public class BatchAutoConfigurationTests { } @Test - public void testUsingJpa() throws Exception { + public void testUsingJpa() { this.contextRunner.withUserConfiguration(TestConfiguration.class, EmbeddedDataSourceConfiguration.class, HibernateJpaAutoConfiguration.class).run((context) -> { @@ -203,7 +202,7 @@ public class BatchAutoConfigurationTests { } @Test - public void testRenamePrefix() throws Exception { + public void testRenamePrefix() { this.contextRunner .withUserConfiguration(TestConfiguration.class, EmbeddedDataSourceConfiguration.class, @@ -228,7 +227,7 @@ public class BatchAutoConfigurationTests { } @Test - public void testCustomizeJpaTransactionManagerUsingProperties() throws Exception { + public void testCustomizeJpaTransactionManagerUsingProperties() { this.contextRunner .withUserConfiguration(TestConfiguration.class, EmbeddedDataSourceConfiguration.class, @@ -246,8 +245,7 @@ public class BatchAutoConfigurationTests { } @Test - public void testCustomizeDataSourceTransactionManagerUsingProperties() - throws Exception { + public void testCustomizeDataSourceTransactionManagerUsingProperties() { this.contextRunner .withUserConfiguration(TestConfiguration.class, EmbeddedDataSourceConfiguration.class) @@ -292,12 +290,12 @@ public class BatchAutoConfigurationTests { } @Override - public PlatformTransactionManager getTransactionManager() throws Exception { + public PlatformTransactionManager getTransactionManager() { return new ResourcelessTransactionManager(); } @Override - public JobLauncher getJobLauncher() throws Exception { + public JobLauncher getJobLauncher() { SimpleJobLauncher launcher = new SimpleJobLauncher(); launcher.setJobRepository(this.jobRepository); return launcher; @@ -344,8 +342,7 @@ public class BatchAutoConfigurationTests { } @Override - protected void doExecute(JobExecution execution) - throws JobExecutionException { + protected void doExecute(JobExecution execution) { execution.setStatus(BatchStatus.COMPLETED); } }; @@ -376,8 +373,7 @@ public class BatchAutoConfigurationTests { } @Override - protected void doExecute(JobExecution execution) - throws JobExecutionException { + protected void doExecute(JobExecution execution) { execution.setStatus(BatchStatus.COMPLETED); } }; @@ -408,8 +404,7 @@ public class BatchAutoConfigurationTests { } @Override - protected void doExecute(JobExecution execution) - throws JobExecutionException { + protected void doExecute(JobExecution execution) { execution.setStatus(BatchStatus.COMPLETED); } }; diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfigurationWithoutJpaTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfigurationWithoutJpaTests.java index ff606accfc..98021950c0 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfigurationWithoutJpaTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfigurationWithoutJpaTests.java @@ -54,7 +54,7 @@ public class BatchAutoConfigurationWithoutJpaTests { TransactionAutoConfiguration.class)); @Test - public void jdbcWithDefaultSettings() throws Exception { + public void jdbcWithDefaultSettings() { this.contextRunner .withUserConfiguration(DefaultConfiguration.class, EmbeddedDataSourceConfiguration.class) @@ -80,7 +80,7 @@ public class BatchAutoConfigurationWithoutJpaTests { } @Test - public void jdbcWithCustomPrefix() throws Exception { + public void jdbcWithCustomPrefix() { this.contextRunner .withUserConfiguration(DefaultConfiguration.class, EmbeddedDataSourceConfiguration.class) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunnerTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunnerTests.java index 15a2dc0b3a..869025af68 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunnerTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunnerTests.java @@ -67,7 +67,7 @@ public class JobLauncherCommandLineRunnerTests { private Step step; @Before - public void init() throws Exception { + public void init() { this.context.register(BatchConfiguration.class); this.context.refresh(); JobRepository jobRepository = this.context.getBean(JobRepository.class); @@ -167,17 +167,17 @@ public class JobLauncherCommandLineRunnerTests { } @Override - public JobRepository getJobRepository() throws Exception { + public JobRepository getJobRepository() { return this.jobRepository; } @Override - public PlatformTransactionManager getTransactionManager() throws Exception { + public PlatformTransactionManager getTransactionManager() { return this.transactionManager; } @Override - public JobLauncher getJobLauncher() throws Exception { + public JobLauncher getJobLauncher() { SimpleJobLauncher launcher = new SimpleJobLauncher(); launcher.setJobRepository(this.jobRepository); launcher.setTaskExecutor(new SyncTaskExecutor()); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheAutoConfigurationTests.java index 302eabf665..1269e4f027 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheAutoConfigurationTests.java @@ -16,7 +16,6 @@ package org.springframework.boot.autoconfigure.cache; -import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -123,7 +122,7 @@ public class CacheAutoConfigurationTests { } @Test - public void cacheResolverFromSupportBackOff() throws Exception { + public void cacheResolverFromSupportBackOff() { this.contextRunner .withUserConfiguration(CustomCacheResolverFromSupportConfiguration.class) .run((context) -> assertThat(context) @@ -131,7 +130,7 @@ public class CacheAutoConfigurationTests { } @Test - public void customCacheResolverCanBeDefined() throws Exception { + public void customCacheResolverCanBeDefined() { this.contextRunner.withUserConfiguration(SpecificCacheResolverConfiguration.class) .withPropertyValues("spring.cache.type=simple").run((context) -> { getCacheManager(context, ConcurrentMapCacheManager.class); @@ -515,7 +514,7 @@ public class CacheAutoConfigurationTests { } @Test - public void ehcache3AsJCacheWithConfig() throws IOException { + public void ehcache3AsJCacheWithConfig() { String cachingProviderFqn = EhcacheCachingProvider.class.getName(); String configLocation = "ehcache3.xml"; this.contextRunner.withUserConfiguration(DefaultCacheConfiguration.class) @@ -571,7 +570,7 @@ public class CacheAutoConfigurationTests { } @Test - public void hazelcastCacheWithHazelcastAutoConfiguration() throws IOException { + public void hazelcastCacheWithHazelcastAutoConfiguration() { String hazelcastConfig = "org/springframework/boot/autoconfigure/hazelcast/hazelcast-specific.xml"; this.contextRunner .withConfiguration( @@ -616,7 +615,7 @@ public class CacheAutoConfigurationTests { } @Test - public void hazelcastAsJCacheWithConfig() throws IOException { + public void hazelcastAsJCacheWithConfig() { String cachingProviderFqn = HazelcastCachingProvider.class.getName(); try { String configLocation = "org/springframework/boot/autoconfigure/hazelcast/hazelcast-specific.xml"; @@ -639,7 +638,7 @@ public class CacheAutoConfigurationTests { } @Test - public void hazelcastAsJCacheWithExistingHazelcastInstance() throws IOException { + public void hazelcastAsJCacheWithExistingHazelcastInstance() { String cachingProviderFqn = HazelcastCachingProvider.class.getName(); this.contextRunner .withConfiguration( @@ -722,7 +721,7 @@ public class CacheAutoConfigurationTests { } @Test - public void infinispanAsJCacheWithConfig() throws IOException { + public void infinispanAsJCacheWithConfig() { String cachingProviderClassName = JCachingProvider.class.getName(); String configLocation = "infinispan.xml"; this.contextRunner.withUserConfiguration(DefaultCacheConfiguration.class) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheManagerCustomizersTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheManagerCustomizersTests.java index fc89bee731..05fdee9d17 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheManagerCustomizersTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheManagerCustomizersTests.java @@ -50,7 +50,7 @@ public class CacheManagerCustomizersTests { } @Test - public void customizeShouldCheckGeneric() throws Exception { + public void customizeShouldCheckGeneric() { List> list = new ArrayList<>(); list.add(new TestCustomizer<>()); list.add(new TestConcurrentMapCacheManagerCustomizer()); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cloud/CloudAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cloud/CloudAutoConfigurationTests.java index 5ad7be002e..27c65147b3 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cloud/CloudAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cloud/CloudAutoConfigurationTests.java @@ -39,7 +39,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class CloudAutoConfigurationTests { @Test - public void testOrder() throws Exception { + public void testOrder() { TestAutoConfigurationSorter sorter = new TestAutoConfigurationSorter( new CachingMetadataReaderFactory()); Collection classNames = new ArrayList<>(); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/AllNestedConditionsTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/AllNestedConditionsTests.java index f82e11c1e3..7b7585bdd5 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/AllNestedConditionsTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/AllNestedConditionsTests.java @@ -38,24 +38,24 @@ public class AllNestedConditionsTests { private final ApplicationContextRunner contextRunner = new ApplicationContextRunner(); @Test - public void neither() throws Exception { + public void neither() { this.contextRunner.withUserConfiguration(Config.class).run(match(false)); } @Test - public void propertyA() throws Exception { + public void propertyA() { this.contextRunner.withUserConfiguration(Config.class).withPropertyValues("a:a") .run(match(false)); } @Test - public void propertyB() throws Exception { + public void propertyB() { this.contextRunner.withUserConfiguration(Config.class).withPropertyValues("b:b") .run(match(false)); } @Test - public void both() throws Exception { + public void both() { this.contextRunner.withUserConfiguration(Config.class) .withPropertyValues("a:a", "b:b").run(match(true)); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/AnyNestedConditionTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/AnyNestedConditionTests.java index 486a5a1244..9600b05887 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/AnyNestedConditionTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/AnyNestedConditionTests.java @@ -41,24 +41,24 @@ public class AnyNestedConditionTests { private final ApplicationContextRunner contextRunner = new ApplicationContextRunner(); @Test - public void neither() throws Exception { + public void neither() { this.contextRunner.withUserConfiguration(Config.class).run(match(false)); } @Test - public void propertyA() throws Exception { + public void propertyA() { this.contextRunner.withUserConfiguration(Config.class).withPropertyValues("a:a") .run(match(true)); } @Test - public void propertyB() throws Exception { + public void propertyB() { this.contextRunner.withUserConfiguration(Config.class).withPropertyValues("b:b") .run(match(true)); } @Test - public void both() throws Exception { + public void both() { this.contextRunner.withUserConfiguration(Config.class) .withPropertyValues("a:a", "b:b").run(match(true)); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReportAutoConfigurationImportListenerTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReportAutoConfigurationImportListenerTests.java index 953b217c9a..0f7e839685 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReportAutoConfigurationImportListenerTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReportAutoConfigurationImportListenerTests.java @@ -49,7 +49,7 @@ public class ConditionEvaluationReportAutoConfigurationImportListenerTests { } @Test - public void shouldBeInSpringFactories() throws Exception { + public void shouldBeInSpringFactories() { List factories = SpringFactoriesLoader .loadFactories(AutoConfigurationImportListener.class, null); assertThat(factories).hasAtLeastOneElementOfType( @@ -57,7 +57,7 @@ public class ConditionEvaluationReportAutoConfigurationImportListenerTests { } @Test - public void onAutoConfigurationImportEventShouldRecordCandidates() throws Exception { + public void onAutoConfigurationImportEventShouldRecordCandidates() { List candidateConfigurations = Collections.singletonList("Test"); Set exclusions = Collections.emptySet(); AutoConfigurationImportEvent event = new AutoConfigurationImportEvent(this, @@ -70,7 +70,7 @@ public class ConditionEvaluationReportAutoConfigurationImportListenerTests { } @Test - public void onAutoConfigurationImportEventShouldRecordExclusions() throws Exception { + public void onAutoConfigurationImportEventShouldRecordExclusions() { List candidateConfigurations = Collections.emptyList(); Set exclusions = Collections.singleton("Test"); AutoConfigurationImportEvent event = new AutoConfigurationImportEvent(this, diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReportTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReportTests.java index 775538d1d7..4515319d44 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReportTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReportTests.java @@ -84,13 +84,13 @@ public class ConditionEvaluationReportTests { } @Test - public void get() throws Exception { + public void get() { assertThat(this.report).isNotEqualTo(nullValue()); assertThat(this.report).isSameAs(ConditionEvaluationReport.get(this.beanFactory)); } @Test - public void parent() throws Exception { + public void parent() { this.beanFactory.setParentBeanFactory(new DefaultListableBeanFactory()); ConditionEvaluationReport.get((ConfigurableListableBeanFactory) this.beanFactory .getParentBeanFactory()); @@ -106,7 +106,7 @@ public class ConditionEvaluationReportTests { } @Test - public void parentBottomUp() throws Exception { + public void parentBottomUp() { this.beanFactory = new DefaultListableBeanFactory(); // NB: overrides setup this.beanFactory.setParentBeanFactory(new DefaultListableBeanFactory()); ConditionEvaluationReport.get((ConfigurableListableBeanFactory) this.beanFactory @@ -119,7 +119,7 @@ public class ConditionEvaluationReportTests { } @Test - public void recordConditionEvaluations() throws Exception { + public void recordConditionEvaluations() { this.outcome1 = new ConditionOutcome(false, "m1"); this.outcome2 = new ConditionOutcome(false, "m2"); this.outcome3 = new ConditionOutcome(false, "m3"); @@ -148,14 +148,14 @@ public class ConditionEvaluationReportTests { } @Test - public void fullMatch() throws Exception { + public void fullMatch() { prepareMatches(true, true, true); assertThat(this.report.getConditionAndOutcomesBySource().get("a").isFullMatch()) .isTrue(); } @Test - public void notFullMatch() throws Exception { + public void notFullMatch() { prepareMatches(true, false, true); assertThat(this.report.getConditionAndOutcomesBySource().get("a").isFullMatch()) .isFalse(); @@ -172,7 +172,7 @@ public class ConditionEvaluationReportTests { @Test @SuppressWarnings("resource") - public void springBootConditionPopulatesReport() throws Exception { + public void springBootConditionPopulatesReport() { ConditionEvaluationReport report = ConditionEvaluationReport.get( new AnnotationConfigApplicationContext(Config.class).getBeanFactory()); assertThat(report.getConditionAndOutcomesBySource().size()).isNotEqualTo(0); @@ -225,7 +225,7 @@ public class ConditionEvaluationReportTests { } @Test - public void negativeOuterPositiveInnerBean() throws Exception { + public void negativeOuterPositiveInnerBean() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); TestPropertyValues.of("test.present=true").applyTo(context); context.register(NegativeOuterConfig.class); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionMessageTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionMessageTests.java index eea9e1d183..e5b1e1d2b6 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionMessageTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionMessageTests.java @@ -33,71 +33,70 @@ import static org.assertj.core.api.Assertions.assertThat; public class ConditionMessageTests { @Test - public void isEmptyWhenEmptyShouldReturnTrue() throws Exception { + public void isEmptyWhenEmptyShouldReturnTrue() { ConditionMessage message = ConditionMessage.empty(); assertThat(message.isEmpty()).isTrue(); } @Test - public void isEmptyWhenNotEmptyShouldReturnFalse() throws Exception { + public void isEmptyWhenNotEmptyShouldReturnFalse() { ConditionMessage message = ConditionMessage.of("Test"); assertThat(message.isEmpty()).isFalse(); } @Test - public void toStringWhenEmptyShouldReturnEmptyString() throws Exception { + public void toStringWhenEmptyShouldReturnEmptyString() { ConditionMessage message = ConditionMessage.empty(); assertThat(message.toString()).isEqualTo(""); } @Test - public void toStringWhenHasMessageShouldReturnMessage() throws Exception { + public void toStringWhenHasMessageShouldReturnMessage() { ConditionMessage message = ConditionMessage.of("Test"); assertThat(message.toString()).isEqualTo("Test"); } @Test - public void appendWhenHasExistingMessageShouldAddSpace() throws Exception { + public void appendWhenHasExistingMessageShouldAddSpace() { ConditionMessage message = ConditionMessage.of("a").append("b"); assertThat(message.toString()).isEqualTo("a b"); } @Test - public void appendWhenAppendingNullShouldDoNothing() throws Exception { + public void appendWhenAppendingNullShouldDoNothing() { ConditionMessage message = ConditionMessage.of("a").append(null); assertThat(message.toString()).isEqualTo("a"); } @Test - public void appendWhenNoMessageShouldNotAddSpace() throws Exception { + public void appendWhenNoMessageShouldNotAddSpace() { ConditionMessage message = ConditionMessage.empty().append("b"); assertThat(message.toString()).isEqualTo("b"); } @Test - public void andConditionWhenUsingClassShouldIncludeCondition() throws Exception { + public void andConditionWhenUsingClassShouldIncludeCondition() { ConditionMessage message = ConditionMessage.empty().andCondition(Test.class) .because("OK"); assertThat(message.toString()).isEqualTo("@Test OK"); } @Test - public void andConditionWhenUsingStringShouldIncludeCondition() throws Exception { + public void andConditionWhenUsingStringShouldIncludeCondition() { ConditionMessage message = ConditionMessage.empty().andCondition("@Test") .because("OK"); assertThat(message.toString()).isEqualTo("@Test OK"); } @Test - public void andConditionWhenIncludingDetailsShouldIncludeCondition() - throws Exception { + public void andConditionWhenIncludingDetailsShouldIncludeCondition() { ConditionMessage message = ConditionMessage.empty() .andCondition(Test.class, "(a=b)").because("OK"); assertThat(message.toString()).isEqualTo("@Test (a=b) OK"); } @Test - public void ofCollectionShouldCombine() throws Exception { + public void ofCollectionShouldCombine() { List messages = new ArrayList<>(); messages.add(ConditionMessage.of("a")); messages.add(ConditionMessage.of("b")); @@ -106,95 +105,95 @@ public class ConditionMessageTests { } @Test - public void ofCollectionWhenNullShouldReturnEmpty() throws Exception { + public void ofCollectionWhenNullShouldReturnEmpty() { ConditionMessage message = ConditionMessage.of((List) null); assertThat(message.isEmpty()).isTrue(); } @Test - public void forConditionShouldIncludeCondition() throws Exception { + public void forConditionShouldIncludeCondition() { ConditionMessage message = ConditionMessage.forCondition("@Test").because("OK"); assertThat(message.toString()).isEqualTo("@Test OK"); } @Test - public void forConditionShouldNotAddExtraSpaceWithEmptyCondition() throws Exception { + public void forConditionShouldNotAddExtraSpaceWithEmptyCondition() { ConditionMessage message = ConditionMessage.forCondition("").because("OK"); assertThat(message.toString()).isEqualTo("OK"); } @Test - public void forConditionWhenClassShouldIncludeCondition() throws Exception { + public void forConditionWhenClassShouldIncludeCondition() { ConditionMessage message = ConditionMessage.forCondition(Test.class, "(a=b)") .because("OK"); assertThat(message.toString()).isEqualTo("@Test (a=b) OK"); } @Test - public void foundExactlyShouldConstructMessage() throws Exception { + public void foundExactlyShouldConstructMessage() { ConditionMessage message = ConditionMessage.forCondition(Test.class) .foundExactly("abc"); assertThat(message.toString()).isEqualTo("@Test found abc"); } @Test - public void foundWhenSingleElementShouldUseSingular() throws Exception { + public void foundWhenSingleElementShouldUseSingular() { ConditionMessage message = ConditionMessage.forCondition(Test.class) .found("bean", "beans").items("a"); assertThat(message.toString()).isEqualTo("@Test found bean a"); } @Test - public void foundNoneAtAllShouldConstructMessage() throws Exception { + public void foundNoneAtAllShouldConstructMessage() { ConditionMessage message = ConditionMessage.forCondition(Test.class) .found("no beans").atAll(); assertThat(message.toString()).isEqualTo("@Test found no beans"); } @Test - public void foundWhenMultipleElementsShouldUsePlural() throws Exception { + public void foundWhenMultipleElementsShouldUsePlural() { ConditionMessage message = ConditionMessage.forCondition(Test.class) .found("bean", "beans").items("a", "b", "c"); assertThat(message.toString()).isEqualTo("@Test found beans a, b, c"); } @Test - public void foundWhenQuoteStyleShouldQuote() throws Exception { + public void foundWhenQuoteStyleShouldQuote() { ConditionMessage message = ConditionMessage.forCondition(Test.class) .found("bean", "beans").items(Style.QUOTE, "a", "b", "c"); assertThat(message.toString()).isEqualTo("@Test found beans 'a', 'b', 'c'"); } @Test - public void didNotFindWhenSingleElementShouldUseSingular() throws Exception { + public void didNotFindWhenSingleElementShouldUseSingular() { ConditionMessage message = ConditionMessage.forCondition(Test.class) .didNotFind("class", "classes").items("a"); assertThat(message.toString()).isEqualTo("@Test did not find class a"); } @Test - public void didNotFindWhenMultipleElementsShouldUsePlural() throws Exception { + public void didNotFindWhenMultipleElementsShouldUsePlural() { ConditionMessage message = ConditionMessage.forCondition(Test.class) .didNotFind("class", "classes").items("a", "b", "c"); assertThat(message.toString()).isEqualTo("@Test did not find classes a, b, c"); } @Test - public void resultedInShouldConstructMessage() throws Exception { + public void resultedInShouldConstructMessage() { ConditionMessage message = ConditionMessage.forCondition(Test.class) .resultedIn("Green"); assertThat(message.toString()).isEqualTo("@Test resulted in Green"); } @Test - public void notAvailableShouldConstructMessage() throws Exception { + public void notAvailableShouldConstructMessage() { ConditionMessage message = ConditionMessage.forCondition(Test.class) .notAvailable("JMX"); assertThat(message.toString()).isEqualTo("@Test JMX is not available"); } @Test - public void availableShouldConstructMessage() throws Exception { + public void availableShouldConstructMessage() { ConditionMessage message = ConditionMessage.forCondition(Test.class) .available("JMX"); assertThat(message.toString()).isEqualTo("@Test JMX is available"); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnBeanTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnBeanTests.java index adc57e66a7..546b5f4836 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnBeanTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnBeanTests.java @@ -106,7 +106,7 @@ public class ConditionalOnBeanTests { } @Test - public void testOnMissingBeanType() throws Exception { + public void testOnMissingBeanType() { this.contextRunner .withUserConfiguration(FooConfiguration.class, OnBeanMissingClassConfiguration.class) @@ -114,7 +114,7 @@ public class ConditionalOnBeanTests { } @Test - public void withPropertyPlaceholderClassName() throws Exception { + public void withPropertyPlaceholderClassName() { this.contextRunner .withUserConfiguration(PropertySourcesPlaceholderConfigurer.class, WithPropertyPlaceholderClassName.class, @@ -270,7 +270,7 @@ public class ConditionalOnBeanTests { public static class ExampleFactoryBean implements FactoryBean { @Override - public ExampleBean getObject() throws Exception { + public ExampleBean getObject() { return new ExampleBean("fromFactory"); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnJavaTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnJavaTests.java index 84716aa677..bd6e69429b 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnJavaTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnJavaTests.java @@ -66,7 +66,7 @@ public class ConditionalOnJavaTests { } @Test - public void boundsTests() throws Exception { + public void boundsTests() { testBounds(Range.EQUAL_OR_NEWER, JavaVersion.NINE, JavaVersion.EIGHT, true); testBounds(Range.EQUAL_OR_NEWER, JavaVersion.EIGHT, JavaVersion.EIGHT, true); testBounds(Range.EQUAL_OR_NEWER, JavaVersion.EIGHT, JavaVersion.NINE, false); @@ -76,7 +76,7 @@ public class ConditionalOnJavaTests { } @Test - public void equalOrNewerMessage() throws Exception { + public void equalOrNewerMessage() { ConditionOutcome outcome = this.condition.getMatchOutcome(Range.EQUAL_OR_NEWER, JavaVersion.NINE, JavaVersion.EIGHT); assertThat(outcome.getMessage()) @@ -84,7 +84,7 @@ public class ConditionalOnJavaTests { } @Test - public void olderThanMessage() throws Exception { + public void olderThanMessage() { ConditionOutcome outcome = this.condition.getMatchOutcome(Range.OLDER_THAN, JavaVersion.NINE, JavaVersion.EIGHT); assertThat(outcome.getMessage()) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnMissingBeanTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnMissingBeanTests.java index 25d574ce40..147e9c9652 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnMissingBeanTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnMissingBeanTests.java @@ -92,7 +92,7 @@ public class ConditionalOnMissingBeanTests { } @Test - public void hierarchyConsidered() throws Exception { + public void hierarchyConsidered() { this.context.register(FooConfiguration.class); this.context.refresh(); AnnotationConfigApplicationContext childContext = new AnnotationConfigApplicationContext(); @@ -103,7 +103,7 @@ public class ConditionalOnMissingBeanTests { } @Test - public void hierarchyNotConsidered() throws Exception { + public void hierarchyNotConsidered() { this.context.register(FooConfiguration.class); this.context.refresh(); AnnotationConfigApplicationContext childContext = new AnnotationConfigApplicationContext(); @@ -114,7 +114,7 @@ public class ConditionalOnMissingBeanTests { } @Test - public void impliedOnBeanMethod() throws Exception { + public void impliedOnBeanMethod() { this.context.register(ExampleBeanConfiguration.class, ImpliedOnBeanMethod.class); this.context.refresh(); assertThat(this.context.getBeansOfType(ExampleBean.class).size()).isEqualTo(1); @@ -610,7 +610,7 @@ public class ConditionalOnMissingBeanTests { } @Override - public ExampleBean getObject() throws Exception { + public ExampleBean getObject() { return new ExampleBean("fromFactory"); } @@ -633,7 +633,7 @@ public class ConditionalOnMissingBeanTests { } @Override - public ExampleBean getObject() throws Exception { + public ExampleBean getObject() { return new ExampleBean("fromFactory"); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnPropertyTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnPropertyTests.java index c59e927262..ef7614bc81 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnPropertyTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnPropertyTests.java @@ -98,7 +98,7 @@ public class ConditionalOnPropertyTests { } @Test - public void prefixWithoutPeriod() throws Exception { + public void prefixWithoutPeriod() { load(RelaxedPropertiesRequiredConfigurationWithShortPrefix.class, "spring.property=value1"); assertThat(this.context.containsBean("foo")).isTrue(); @@ -198,13 +198,13 @@ public class ConditionalOnPropertyTests { } @Test - public void usingValueAttribute() throws Exception { + public void usingValueAttribute() { load(ValueAttribute.class, "some.property"); assertThat(this.context.containsBean("foo")).isTrue(); } @Test - public void nameOrValueMustBeSpecified() throws Exception { + public void nameOrValueMustBeSpecified() { this.thrown.expect(IllegalStateException.class); this.thrown.expectCause(hasMessage(containsString("The name or " + "value attribute of @ConditionalOnProperty must be specified"))); @@ -212,7 +212,7 @@ public class ConditionalOnPropertyTests { } @Test - public void nameAndValueMustNotBeSpecified() throws Exception { + public void nameAndValueMustNotBeSpecified() { this.thrown.expect(IllegalStateException.class); this.thrown.expectCause(hasMessage(containsString("The name and " + "value attributes of @ConditionalOnProperty are exclusive"))); @@ -220,14 +220,13 @@ public class ConditionalOnPropertyTests { } @Test - public void metaAnnotationConditionMatchesWhenPropertyIsSet() throws Exception { + public void metaAnnotationConditionMatchesWhenPropertyIsSet() { load(MetaAnnotation.class, "my.feature.enabled=true"); assertThat(this.context.containsBean("foo")).isTrue(); } @Test - public void metaAnnotationConditionDoesNotMatchWhenPropertyIsNotSet() - throws Exception { + public void metaAnnotationConditionDoesNotMatchWhenPropertyIsNotSet() { load(MetaAnnotation.class); assertThat(this.context.containsBean("foo")).isFalse(); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/NoneNestedConditionsTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/NoneNestedConditionsTests.java index 7f22e99ad8..534b16c851 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/NoneNestedConditionsTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/NoneNestedConditionsTests.java @@ -35,28 +35,28 @@ import static org.assertj.core.api.Assertions.assertThat; public class NoneNestedConditionsTests { @Test - public void neither() throws Exception { + public void neither() { AnnotationConfigApplicationContext context = load(Config.class); assertThat(context.containsBean("myBean")).isTrue(); context.close(); } @Test - public void propertyA() throws Exception { + public void propertyA() { AnnotationConfigApplicationContext context = load(Config.class, "a:a"); assertThat(context.containsBean("myBean")).isFalse(); context.close(); } @Test - public void propertyB() throws Exception { + public void propertyB() { AnnotationConfigApplicationContext context = load(Config.class, "b:b"); assertThat(context.containsBean("myBean")).isFalse(); context.close(); } @Test - public void both() throws Exception { + public void both() { AnnotationConfigApplicationContext context = load(Config.class, "a:a", "b:b"); assertThat(context.containsBean("myBean")).isFalse(); context.close(); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/OnClassConditionAutoConfigurationImportFilterTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/OnClassConditionAutoConfigurationImportFilterTests.java index 1d53c5267b..7dae28adb0 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/OnClassConditionAutoConfigurationImportFilterTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/OnClassConditionAutoConfigurationImportFilterTests.java @@ -48,14 +48,14 @@ public class OnClassConditionAutoConfigurationImportFilterTests { } @Test - public void shouldBeRegistered() throws Exception { + public void shouldBeRegistered() { assertThat(SpringFactoriesLoader .loadFactories(AutoConfigurationImportFilter.class, null)) .hasAtLeastOneElementOfType(OnClassCondition.class); } @Test - public void matchShouldMatchClasses() throws Exception { + public void matchShouldMatchClasses() { String[] autoConfigurationClasses = new String[] { "test.match", "test.nomatch" }; boolean[] result = this.filter.match(autoConfigurationClasses, getAutoConfigurationMetadata()); @@ -63,7 +63,7 @@ public class OnClassConditionAutoConfigurationImportFilterTests { } @Test - public void matchShouldRecordOutcome() throws Exception { + public void matchShouldRecordOutcome() { String[] autoConfigurationClasses = new String[] { "test.match", "test.nomatch" }; this.filter.match(autoConfigurationClasses, getAutoConfigurationMetadata()); ConditionEvaluationReport report = ConditionEvaluationReport diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/SpringBootConditionTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/SpringBootConditionTests.java index 7e086277a0..5ab850997b 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/SpringBootConditionTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/SpringBootConditionTests.java @@ -47,7 +47,7 @@ public class SpringBootConditionTests { } @Test - public void sensibleMethodException() throws Exception { + public void sensibleMethodException() { this.thrown.expect(IllegalStateException.class); this.thrown.expectMessage("Error processing condition on " + ErrorOnMethod.class.getName() + ".myBean"); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/context/MessageSourceAutoConfigurationIntegrationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/context/MessageSourceAutoConfigurationIntegrationTests.java index 3643c5e252..50d6f1b2bf 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/context/MessageSourceAutoConfigurationIntegrationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/context/MessageSourceAutoConfigurationIntegrationTests.java @@ -47,7 +47,7 @@ public class MessageSourceAutoConfigurationIntegrationTests { private ApplicationContext context; @Test - public void testMessageSourceFromPropertySourceAnnotation() throws Exception { + public void testMessageSourceFromPropertySourceAnnotation() { assertThat(this.context.getMessage("foo", null, "Foo message", Locale.UK)) .isEqualTo("bar"); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/context/MessageSourceAutoConfigurationProfileTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/context/MessageSourceAutoConfigurationProfileTests.java index a52937ec19..e05737f02a 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/context/MessageSourceAutoConfigurationProfileTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/context/MessageSourceAutoConfigurationProfileTests.java @@ -49,7 +49,7 @@ public class MessageSourceAutoConfigurationProfileTests { private ApplicationContext context; @Test - public void testMessageSourceFromPropertySourceAnnotation() throws Exception { + public void testMessageSourceFromPropertySourceAnnotation() { assertThat(this.context.getMessage("foo", null, "Foo message", Locale.UK)) .isEqualTo("bar"); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/context/MessageSourceAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/context/MessageSourceAutoConfigurationTests.java index ac1e2a4e1f..8d12cd92d1 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/context/MessageSourceAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/context/MessageSourceAutoConfigurationTests.java @@ -128,7 +128,7 @@ public class MessageSourceAutoConfigurationTests { } @Test - public void testFormatMessageOn() throws Exception { + public void testFormatMessageOn() { this.contextRunner .withPropertyValues("spring.messages.basename:test/messages", "spring.messages.always-use-message-format:true") diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/context/PropertyPlaceholderAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/context/PropertyPlaceholderAutoConfigurationTests.java index 5c54a3fe66..036d1e1d20 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/context/PropertyPlaceholderAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/context/PropertyPlaceholderAutoConfigurationTests.java @@ -46,7 +46,7 @@ public class PropertyPlaceholderAutoConfigurationTests { } @Test - public void propertyPlaceholders() throws Exception { + public void propertyPlaceholders() { this.context.register(PropertyPlaceholderAutoConfiguration.class, PlaceholderConfig.class); TestPropertyValues.of("foo:two").applyTo(this.context); @@ -56,7 +56,7 @@ public class PropertyPlaceholderAutoConfigurationTests { } @Test - public void propertyPlaceholdersOverride() throws Exception { + public void propertyPlaceholdersOverride() { this.context.register(PropertyPlaceholderAutoConfiguration.class, PlaceholderConfig.class, PlaceholdersOverride.class); TestPropertyValues.of("foo:two").applyTo(this.context); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseAutoConfigurationIntegrationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseAutoConfigurationIntegrationTests.java index e004b1a174..bb0e6a0926 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseAutoConfigurationIntegrationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseAutoConfigurationIntegrationTests.java @@ -63,7 +63,7 @@ public class CouchbaseAutoConfigurationIntegrationTests static class CustomConfiguration { @Bean - public Cluster myCustomCouchbaseCluster() throws Exception { + public Cluster myCustomCouchbaseCluster() { return mock(Cluster.class); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseAutoConfigurationTests.java index ae0d34477f..f1b3d57bc6 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseAutoConfigurationTests.java @@ -152,7 +152,7 @@ public class CouchbaseAutoConfigurationTests } @Override - public Cluster couchbaseCluster() throws Exception { + public Cluster couchbaseCluster() { return mock(Cluster.class); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraDataAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraDataAutoConfigurationTests.java index cfdb1654d0..7828018422 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraDataAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraDataAutoConfigurationTests.java @@ -70,7 +70,7 @@ public class CassandraDataAutoConfigurationTests { @Test @SuppressWarnings("unchecked") - public void entityScanShouldSetInitialEntitySet() throws Exception { + public void entityScanShouldSetInitialEntitySet() { load(EntityScanConfig.class); CassandraMappingContext mappingContext = this.context .getBean(CassandraMappingContext.class); @@ -80,7 +80,7 @@ public class CassandraDataAutoConfigurationTests { } @Test - public void userTypeResolverShouldBeSet() throws Exception { + public void userTypeResolverShouldBeSet() { load(); CassandraMappingContext mappingContext = this.context .getBean(CassandraMappingContext.class); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraReactiveDataAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraReactiveDataAutoConfigurationTests.java index 3708638c6a..8645b02edf 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraReactiveDataAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraReactiveDataAutoConfigurationTests.java @@ -64,7 +64,7 @@ public class CassandraReactiveDataAutoConfigurationTests { @Test @SuppressWarnings("unchecked") - public void entityScanShouldSetInitialEntitySet() throws Exception { + public void entityScanShouldSetInitialEntitySet() { load(EntityScanConfig.class, "spring.data.cassandra.keyspaceName:boot_test"); CassandraMappingContext mappingContext = this.context .getBean(CassandraMappingContext.class); @@ -74,7 +74,7 @@ public class CassandraReactiveDataAutoConfigurationTests { } @Test - public void userTypeResolverShouldBeSet() throws Exception { + public void userTypeResolverShouldBeSet() { load("spring.data.cassandra.keyspaceName:boot_test"); CassandraMappingContext mappingContext = this.context .getBean(CassandraMappingContext.class); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/couchbase/CouchbaseDataAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/couchbase/CouchbaseDataAutoConfigurationTests.java index 7187644fae..4b37c2aa14 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/couchbase/CouchbaseDataAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/couchbase/CouchbaseDataAutoConfigurationTests.java @@ -116,7 +116,7 @@ public class CouchbaseDataAutoConfigurationTests { @Test @SuppressWarnings("unchecked") - public void entityScanShouldSetInitialEntitySet() throws Exception { + public void entityScanShouldSetInitialEntitySet() { load(EntityScanConfig.class); CouchbaseMappingContext mappingContext = this.context .getBean(CouchbaseMappingContext.class); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/couchbase/CouchbaseReactiveAndImperativeRepositoriesAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/couchbase/CouchbaseReactiveAndImperativeRepositoriesAutoConfigurationTests.java index b1d8867555..33c62c73c1 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/couchbase/CouchbaseReactiveAndImperativeRepositoriesAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/couchbase/CouchbaseReactiveAndImperativeRepositoriesAutoConfigurationTests.java @@ -55,8 +55,7 @@ public class CouchbaseReactiveAndImperativeRepositoriesAutoConfigurationTests { } @Test - public void shouldCreateInstancesForReactiveAndImperativeRepositories() - throws Exception { + public void shouldCreateInstancesForReactiveAndImperativeRepositories() { this.context = new AnnotationConfigApplicationContext(); TestPropertyValues.of("spring.datasource.initialization-mode:never") .applyTo(this.context); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/couchbase/CouchbaseReactiveDataAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/couchbase/CouchbaseReactiveDataAutoConfigurationTests.java index bc425e76ce..554d794f7a 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/couchbase/CouchbaseReactiveDataAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/couchbase/CouchbaseReactiveDataAutoConfigurationTests.java @@ -88,7 +88,7 @@ public class CouchbaseReactiveDataAutoConfigurationTests { @Test @SuppressWarnings("unchecked") - public void entityScanShouldSetInitialEntitySet() throws Exception { + public void entityScanShouldSetInitialEntitySet() { load(EntityScanConfig.class); CouchbaseMappingContext mappingContext = this.context .getBean(CouchbaseMappingContext.class); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/couchbase/CouchbaseReactiveRepositoriesAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/couchbase/CouchbaseReactiveRepositoriesAutoConfigurationTests.java index 25614d51e4..185acde436 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/couchbase/CouchbaseReactiveRepositoriesAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/couchbase/CouchbaseReactiveRepositoriesAutoConfigurationTests.java @@ -53,13 +53,13 @@ public class CouchbaseReactiveRepositoriesAutoConfigurationTests { } @Test - public void couchbaseNotAvailable() throws Exception { + public void couchbaseNotAvailable() { load(null); assertThat(this.context.getBeansOfType(ReactiveCityRepository.class)).hasSize(0); } @Test - public void defaultRepository() throws Exception { + public void defaultRepository() { load(DefaultConfiguration.class); assertThat(this.context.getBeansOfType(ReactiveCityRepository.class)).hasSize(1); } @@ -78,7 +78,7 @@ public class CouchbaseReactiveRepositoriesAutoConfigurationTests { } @Test - public void noRepositoryAvailable() throws Exception { + public void noRepositoryAvailable() { load(NoRepositoryConfiguration.class); assertThat(this.context.getBeansOfType(ReactiveCityRepository.class)).hasSize(0); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/couchbase/CouchbaseRepositoriesAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/couchbase/CouchbaseRepositoriesAutoConfigurationTests.java index 7745935d72..03dfa248b7 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/couchbase/CouchbaseRepositoriesAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/couchbase/CouchbaseRepositoriesAutoConfigurationTests.java @@ -51,13 +51,13 @@ public class CouchbaseRepositoriesAutoConfigurationTests { } @Test - public void couchbaseNotAvailable() throws Exception { + public void couchbaseNotAvailable() { load(null); assertThat(this.context.getBeansOfType(CityRepository.class)).hasSize(0); } @Test - public void defaultRepository() throws Exception { + public void defaultRepository() { load(DefaultConfiguration.class); assertThat(this.context.getBeansOfType(CityRepository.class)).hasSize(1); } @@ -76,7 +76,7 @@ public class CouchbaseRepositoriesAutoConfigurationTests { } @Test - public void noRepositoryAvailable() throws Exception { + public void noRepositoryAvailable() { load(NoRepositoryConfiguration.class); assertThat(this.context.getBeansOfType(CityRepository.class)).hasSize(0); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchAutoConfigurationTests.java index 940878865c..55bd5d6465 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchAutoConfigurationTests.java @@ -63,7 +63,7 @@ public class ElasticsearchAutoConfigurationTests { } @Test - public void createTransportClient() throws Exception { + public void createTransportClient() { this.context = new AnnotationConfigApplicationContext(); new ElasticsearchNodeTemplate().doWithNode((node) -> { TestPropertyValues diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchRepositoriesAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchRepositoriesAutoConfigurationTests.java index b9ca989fa0..1c4a5965d5 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchRepositoriesAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchRepositoriesAutoConfigurationTests.java @@ -55,7 +55,7 @@ public class ElasticsearchRepositoriesAutoConfigurationTests { } @Test - public void testDefaultRepositoryConfiguration() throws Exception { + public void testDefaultRepositoryConfiguration() { new ElasticsearchNodeTemplate().doWithNode((node) -> { load(TestConfiguration.class, node); assertThat(this.context.getBean(CityRepository.class)).isNotNull(); @@ -65,7 +65,7 @@ public class ElasticsearchRepositoriesAutoConfigurationTests { } @Test - public void testNoRepositoryConfiguration() throws Exception { + public void testNoRepositoryConfiguration() { new ElasticsearchNodeTemplate().doWithNode((node) -> { load(EmptyConfiguration.class, node); assertThat(this.context.getBean(Client.class)).isNotNull(); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/jpa/JpaRepositoriesAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/jpa/JpaRepositoriesAutoConfigurationTests.java index 43884b6c3d..3d547cb049 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/jpa/JpaRepositoriesAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/jpa/JpaRepositoriesAutoConfigurationTests.java @@ -55,7 +55,7 @@ public class JpaRepositoriesAutoConfigurationTests { } @Test - public void testDefaultRepositoryConfiguration() throws Exception { + public void testDefaultRepositoryConfiguration() { prepareApplicationContext(TestConfiguration.class); assertThat(this.context.getBean(CityRepository.class)).isNotNull(); @@ -64,7 +64,7 @@ public class JpaRepositoriesAutoConfigurationTests { } @Test - public void testOverrideRepositoryConfiguration() throws Exception { + public void testOverrideRepositoryConfiguration() { prepareApplicationContext(CustomConfiguration.class); assertThat(this.context.getBean( org.springframework.boot.autoconfigure.data.alt.jpa.CityJpaRepository.class)) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/jpa/JpaWebAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/jpa/JpaWebAutoConfigurationTests.java index 770a91d893..5a30d84774 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/jpa/JpaWebAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/jpa/JpaWebAutoConfigurationTests.java @@ -51,7 +51,7 @@ public class JpaWebAutoConfigurationTests { } @Test - public void testDefaultRepositoryConfiguration() throws Exception { + public void testDefaultRepositoryConfiguration() { this.context = new AnnotationConfigWebApplicationContext(); this.context.setServletContext(new MockServletContext()); this.context.register(TestConfiguration.class, diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/ldap/LdapRepositoriesAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/ldap/LdapRepositoriesAutoConfigurationTests.java index d99ba23d38..136c304ef2 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/ldap/LdapRepositoriesAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/ldap/LdapRepositoriesAutoConfigurationTests.java @@ -50,13 +50,13 @@ public class LdapRepositoriesAutoConfigurationTests { } @Test - public void testDefaultRepositoryConfiguration() throws Exception { + public void testDefaultRepositoryConfiguration() { load(TestConfiguration.class); assertThat(this.context.getBean(PersonRepository.class)).isNotNull(); } @Test - public void testNoRepositoryConfiguration() throws Exception { + public void testNoRepositoryConfiguration() { load(EmptyConfiguration.class); assertThat(this.context.getBeanNamesForType(PersonRepository.class)).isEmpty(); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MixedMongoRepositoriesAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MixedMongoRepositoriesAutoConfigurationTests.java index 16105f7068..6dcc70c4c5 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MixedMongoRepositoriesAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MixedMongoRepositoriesAutoConfigurationTests.java @@ -60,7 +60,7 @@ public class MixedMongoRepositoriesAutoConfigurationTests { } @Test - public void testDefaultRepositoryConfiguration() throws Exception { + public void testDefaultRepositoryConfiguration() { this.context = new AnnotationConfigApplicationContext(); TestPropertyValues.of("spring.datasource.initialization-mode:never") .applyTo(this.context); @@ -70,7 +70,7 @@ public class MixedMongoRepositoriesAutoConfigurationTests { } @Test - public void testMixedRepositoryConfiguration() throws Exception { + public void testMixedRepositoryConfiguration() { this.context = new AnnotationConfigApplicationContext(); TestPropertyValues.of("spring.datasource.initialization-mode:never") .applyTo(this.context); @@ -81,7 +81,7 @@ public class MixedMongoRepositoriesAutoConfigurationTests { } @Test - public void testJpaRepositoryConfigurationWithMongoTemplate() throws Exception { + public void testJpaRepositoryConfigurationWithMongoTemplate() { this.context = new AnnotationConfigApplicationContext(); TestPropertyValues.of("spring.datasource.initialization-mode:never") .applyTo(this.context); @@ -91,7 +91,7 @@ public class MixedMongoRepositoriesAutoConfigurationTests { } @Test - public void testJpaRepositoryConfigurationWithMongoOverlap() throws Exception { + public void testJpaRepositoryConfigurationWithMongoOverlap() { this.context = new AnnotationConfigApplicationContext(); TestPropertyValues.of("spring.datasource.initialization-mode:never") .applyTo(this.context); @@ -101,8 +101,7 @@ public class MixedMongoRepositoriesAutoConfigurationTests { } @Test - public void testJpaRepositoryConfigurationWithMongoOverlapDisabled() - throws Exception { + public void testJpaRepositoryConfigurationWithMongoOverlapDisabled() { this.context = new AnnotationConfigApplicationContext(); TestPropertyValues .of("spring.datasource.initialization-mode:never", diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MongoDataAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MongoDataAutoConfigurationTests.java index 89484ff6c5..71f852cce2 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MongoDataAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MongoDataAutoConfigurationTests.java @@ -89,7 +89,7 @@ public class MongoDataAutoConfigurationTests { } @Test - public void customConversions() throws Exception { + public void customConversions() { this.context = new AnnotationConfigApplicationContext(); this.context.register(CustomConversionsConfig.class); this.context.register(PropertyPlaceholderAutoConfiguration.class, @@ -137,7 +137,7 @@ public class MongoDataAutoConfigurationTests { @Test @SuppressWarnings("unchecked") - public void entityScanShouldSetInitialEntitySet() throws Exception { + public void entityScanShouldSetInitialEntitySet() { this.context = new AnnotationConfigApplicationContext(); this.context.register(EntityScanConfig.class, PropertyPlaceholderAutoConfiguration.class, MongoAutoConfiguration.class, diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MongoReactiveAndBlockingRepositoriesAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MongoReactiveAndBlockingRepositoriesAutoConfigurationTests.java index 0ab57fb168..dde4b3a002 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MongoReactiveAndBlockingRepositoriesAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MongoReactiveAndBlockingRepositoriesAutoConfigurationTests.java @@ -55,8 +55,7 @@ public class MongoReactiveAndBlockingRepositoriesAutoConfigurationTests { } @Test - public void shouldCreateInstancesForReactiveAndBlockingRepositories() - throws Exception { + public void shouldCreateInstancesForReactiveAndBlockingRepositories() { this.context = new AnnotationConfigApplicationContext(); TestPropertyValues.of("spring.datasource.initialization-mode:never") .applyTo(this.context); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MongoReactiveRepositoriesAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MongoReactiveRepositoriesAutoConfigurationTests.java index 9020202b6a..6bdc1e6c07 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MongoReactiveRepositoriesAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MongoReactiveRepositoriesAutoConfigurationTests.java @@ -57,7 +57,7 @@ public class MongoReactiveRepositoriesAutoConfigurationTests { PropertyPlaceholderAutoConfiguration.class)); @Test - public void testDefaultRepositoryConfiguration() throws Exception { + public void testDefaultRepositoryConfiguration() { this.runner.withUserConfiguration(TestConfiguration.class).run((context) -> { assertThat(context).hasSingleBean(ReactiveCityRepository.class); MongoClient client = context.getBean(MongoClient.class); @@ -72,7 +72,7 @@ public class MongoReactiveRepositoriesAutoConfigurationTests { } @Test - public void testNoRepositoryConfiguration() throws Exception { + public void testNoRepositoryConfiguration() { this.runner.withUserConfiguration(EmptyConfiguration.class) .run((context) -> assertThat(context).hasSingleBean(MongoClient.class)); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MongoRepositoriesAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MongoRepositoriesAutoConfigurationTests.java index 0449c69d4e..a0d1d37d51 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MongoRepositoriesAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MongoRepositoriesAutoConfigurationTests.java @@ -53,7 +53,7 @@ public class MongoRepositoriesAutoConfigurationTests { PropertyPlaceholderAutoConfiguration.class)); @Test - public void testDefaultRepositoryConfiguration() throws Exception { + public void testDefaultRepositoryConfiguration() { this.runner.withUserConfiguration(TestConfiguration.class).run((context) -> { assertThat(context).hasSingleBean(CityRepository.class); Mongo mongo = context.getBean(Mongo.class); @@ -68,7 +68,7 @@ public class MongoRepositoriesAutoConfigurationTests { } @Test - public void testNoRepositoryConfiguration() throws Exception { + public void testNoRepositoryConfiguration() { this.runner.withUserConfiguration(EmptyConfiguration.class).run((context) -> { assertThat(context).hasSingleBean(Mongo.class); assertThat(context.getBean(Mongo.class)).isInstanceOf(MongoClient.class); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/MixedNeo4jRepositoriesAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/MixedNeo4jRepositoriesAutoConfigurationTests.java index 51a4af4953..5b3c1dfee9 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/MixedNeo4jRepositoriesAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/MixedNeo4jRepositoriesAutoConfigurationTests.java @@ -59,34 +59,33 @@ public class MixedNeo4jRepositoriesAutoConfigurationTests { } @Test - public void testDefaultRepositoryConfiguration() throws Exception { + public void testDefaultRepositoryConfiguration() { load(TestConfiguration.class); assertThat(this.context.getBean(CountryRepository.class)).isNotNull(); } @Test - public void testMixedRepositoryConfiguration() throws Exception { + public void testMixedRepositoryConfiguration() { load(MixedConfiguration.class); assertThat(this.context.getBean(CountryRepository.class)).isNotNull(); assertThat(this.context.getBean(CityRepository.class)).isNotNull(); } @Test - public void testJpaRepositoryConfigurationWithNeo4jTemplate() throws Exception { + public void testJpaRepositoryConfigurationWithNeo4jTemplate() { load(JpaConfiguration.class); assertThat(this.context.getBean(CityRepository.class)).isNotNull(); } @Test @Ignore - public void testJpaRepositoryConfigurationWithNeo4jOverlap() throws Exception { + public void testJpaRepositoryConfigurationWithNeo4jOverlap() { load(OverlapConfiguration.class); assertThat(this.context.getBean(CityRepository.class)).isNotNull(); } @Test - public void testJpaRepositoryConfigurationWithNeo4jOverlapDisabled() - throws Exception { + public void testJpaRepositoryConfigurationWithNeo4jOverlapDisabled() { load(OverlapConfiguration.class, "spring.data.neo4j.repositories.enabled:false"); assertThat(this.context.getBean(CityRepository.class)).isNotNull(); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jRepositoriesAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jRepositoriesAutoConfigurationTests.java index 72ba1b6dec..e38320e2eb 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jRepositoriesAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jRepositoriesAutoConfigurationTests.java @@ -54,7 +54,7 @@ public class Neo4jRepositoriesAutoConfigurationTests { } @Test - public void testDefaultRepositoryConfiguration() throws Exception { + public void testDefaultRepositoryConfiguration() { prepareApplicationContext(TestConfiguration.class); assertThat(this.context.getBean(CityRepository.class)).isNotNull(); Neo4jMappingContext mappingContext = this.context @@ -63,7 +63,7 @@ public class Neo4jRepositoriesAutoConfigurationTests { } @Test - public void testNoRepositoryConfiguration() throws Exception { + public void testNoRepositoryConfiguration() { prepareApplicationContext(EmptyConfiguration.class); assertThat(this.context.getBean(SessionFactory.class)).isNotNull(); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/redis/RedisAutoConfigurationJedisTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/redis/RedisAutoConfigurationJedisTests.java index 1ac6531435..3bfbe6f951 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/redis/RedisAutoConfigurationJedisTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/redis/RedisAutoConfigurationJedisTests.java @@ -55,7 +55,7 @@ public class RedisAutoConfigurationJedisTests { } @Test - public void testOverrideRedisConfiguration() throws Exception { + public void testOverrideRedisConfiguration() { load("spring.redis.host:foo", "spring.redis.database:1"); JedisConnectionFactory cf = this.context.getBean(JedisConnectionFactory.class); assertThat(cf.getHostName()).isEqualTo("foo"); @@ -65,14 +65,14 @@ public class RedisAutoConfigurationJedisTests { } @Test - public void testCustomizeRedisConfiguration() throws Exception { + public void testCustomizeRedisConfiguration() { load(CustomConfiguration.class); JedisConnectionFactory cf = this.context.getBean(JedisConnectionFactory.class); assertThat(cf.isUseSsl()).isTrue(); } @Test - public void testRedisUrlConfiguration() throws Exception { + public void testRedisUrlConfiguration() { load("spring.redis.host:foo", "spring.redis.url:redis://user:password@example:33"); JedisConnectionFactory cf = this.context.getBean(JedisConnectionFactory.class); @@ -83,7 +83,7 @@ public class RedisAutoConfigurationJedisTests { } @Test - public void testOverrideUrlRedisConfiguration() throws Exception { + public void testOverrideUrlRedisConfiguration() { load("spring.redis.host:foo", "spring.redis.password:xyz", "spring.redis.port:1000", "spring.redis.ssl:false", "spring.redis.url:rediss://user:password@example:33"); @@ -95,7 +95,7 @@ public class RedisAutoConfigurationJedisTests { } @Test - public void testRedisConfigurationWithPool() throws Exception { + public void testRedisConfigurationWithPool() { load("spring.redis.host:foo", "spring.redis.jedis.pool.min-idle:1", "spring.redis.jedis.pool.max-idle:4", "spring.redis.jedis.pool.max-active:16", @@ -109,7 +109,7 @@ public class RedisAutoConfigurationJedisTests { } @Test - public void testRedisConfigurationWithTimeout() throws Exception { + public void testRedisConfigurationWithTimeout() { load("spring.redis.host:foo", "spring.redis.timeout:100"); JedisConnectionFactory cf = this.context.getBean(JedisConnectionFactory.class); assertThat(cf.getHostName()).isEqualTo("foo"); @@ -117,7 +117,7 @@ public class RedisAutoConfigurationJedisTests { } @Test - public void testRedisConfigurationWithSentinel() throws Exception { + public void testRedisConfigurationWithSentinel() { List sentinels = Arrays.asList("127.0.0.1:26379", "127.0.0.1:26380"); load("spring.redis.sentinel.master:mymaster", "spring.redis.sentinel.nodes:" + StringUtils.collectionToCommaDelimitedString(sentinels)); @@ -137,7 +137,7 @@ public class RedisAutoConfigurationJedisTests { } @Test - public void testRedisConfigurationWithCluster() throws Exception { + public void testRedisConfigurationWithCluster() { List clusterNodes = Arrays.asList("127.0.0.1:27379", "127.0.0.1:27380"); load("spring.redis.cluster.nodes[0]:" + clusterNodes.get(0), "spring.redis.cluster.nodes[1]:" + clusterNodes.get(1)); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/redis/RedisAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/redis/RedisAutoConfigurationTests.java index 2635e78c85..16f6729da6 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/redis/RedisAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/redis/RedisAutoConfigurationTests.java @@ -91,7 +91,7 @@ public class RedisAutoConfigurationTests { } @Test - public void testRedisUrlConfiguration() throws Exception { + public void testRedisUrlConfiguration() { load("spring.redis.host:foo", "spring.redis.url:redis://user:password@example:33"); LettuceConnectionFactory cf = this.context @@ -116,7 +116,7 @@ public class RedisAutoConfigurationTests { } @Test - public void testRedisConfigurationWithPool() throws Exception { + public void testRedisConfigurationWithPool() { load("spring.redis.host:foo", "spring.redis.lettuce.pool.min-idle:1", "spring.redis.lettuce.pool.max-idle:4", "spring.redis.lettuce.pool.max-active:16", @@ -137,7 +137,7 @@ public class RedisAutoConfigurationTests { } @Test - public void testRedisConfigurationWithTimeout() throws Exception { + public void testRedisConfigurationWithTimeout() { load("spring.redis.host:foo", "spring.redis.timeout:100"); LettuceConnectionFactory cf = this.context .getBean(LettuceConnectionFactory.class); @@ -146,7 +146,7 @@ public class RedisAutoConfigurationTests { } @Test - public void testRedisConfigurationWithSentinel() throws Exception { + public void testRedisConfigurationWithSentinel() { List sentinels = Arrays.asList("127.0.0.1:26379", "127.0.0.1:26380"); load("spring.redis.sentinel.master:mymaster", "spring.redis.sentinel.nodes:" + StringUtils.collectionToCommaDelimitedString(sentinels)); @@ -155,7 +155,7 @@ public class RedisAutoConfigurationTests { } @Test - public void testRedisConfigurationWithSentinelAndPassword() throws Exception { + public void testRedisConfigurationWithSentinelAndPassword() { load("spring.redis.password=password", "spring.redis.sentinel.master:mymaster", "spring.redis.sentinel.nodes:127.0.0.1:26379, 127.0.0.1:26380"); LettuceConnectionFactory connectionFactory = this.context @@ -168,7 +168,7 @@ public class RedisAutoConfigurationTests { } @Test - public void testRedisConfigurationWithCluster() throws Exception { + public void testRedisConfigurationWithCluster() { List clusterNodes = Arrays.asList("127.0.0.1:27379", "127.0.0.1:27380"); load("spring.redis.cluster.nodes[0]:" + clusterNodes.get(0), "spring.redis.cluster.nodes[1]:" + clusterNodes.get(1)); @@ -177,7 +177,7 @@ public class RedisAutoConfigurationTests { } @Test - public void testRedisConfigurationWithClusterAndPassword() throws Exception { + public void testRedisConfigurationWithClusterAndPassword() { List clusterNodes = Arrays.asList("127.0.0.1:27379", "127.0.0.1:27380"); load("spring.redis.password=password", "spring.redis.cluster.nodes[0]:" + clusterNodes.get(0), diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/rest/RepositoryRestMvcAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/rest/RepositoryRestMvcAutoConfigurationTests.java index 67316e7ec2..c552b8cad5 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/rest/RepositoryRestMvcAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/rest/RepositoryRestMvcAutoConfigurationTests.java @@ -69,14 +69,14 @@ public class RepositoryRestMvcAutoConfigurationTests { } @Test - public void testDefaultRepositoryConfiguration() throws Exception { + public void testDefaultRepositoryConfiguration() { load(TestConfiguration.class); assertThat(this.context.getBean(RepositoryRestMvcConfiguration.class)) .isNotNull(); } @Test - public void testWithCustomBasePath() throws Exception { + public void testWithCustomBasePath() { load(TestConfiguration.class, "spring.data.rest.base-path:foo"); assertThat(this.context.getBean(RepositoryRestMvcConfiguration.class)) .isNotNull(); @@ -91,7 +91,7 @@ public class RepositoryRestMvcAutoConfigurationTests { } @Test - public void testWithCustomSettings() throws Exception { + public void testWithCustomSettings() { load(TestConfiguration.class, "spring.data.rest.default-page-size:42", "spring.data.rest.max-page-size:78", "spring.data.rest.page-param-name:_page", diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/diagnostics/analyzer/NoSuchBeanDefinitionFailureAnalyzerTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/diagnostics/analyzer/NoSuchBeanDefinitionFailureAnalyzerTests.java index 68a78746ea..16a9f6be78 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/diagnostics/analyzer/NoSuchBeanDefinitionFailureAnalyzerTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/diagnostics/analyzer/NoSuchBeanDefinitionFailureAnalyzerTests.java @@ -84,7 +84,7 @@ public class NoSuchBeanDefinitionFailureAnalyzerTests { } @Test - public void failureAnalysisForMissingCollectionType() throws Exception { + public void failureAnalysisForMissingCollectionType() { FailureAnalysis analysis = analyzeFailure( createFailure(StringCollectionConfiguration.class)); assertDescriptionConstructorMissingType(analysis, StringCollectionHandler.class, @@ -96,7 +96,7 @@ public class NoSuchBeanDefinitionFailureAnalyzerTests { } @Test - public void failureAnalysisForMissingMapType() throws Exception { + public void failureAnalysisForMissingMapType() { FailureAnalysis analysis = analyzeFailure( createFailure(StringMapConfiguration.class)); assertDescriptionConstructorMissingType(analysis, StringMapHandler.class, 0, diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/domain/EntityScanPackagesTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/domain/EntityScanPackagesTests.java index f204449e63..534433a32d 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/domain/EntityScanPackagesTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/domain/EntityScanPackagesTests.java @@ -51,7 +51,7 @@ public class EntityScanPackagesTests { } @Test - public void getWhenNoneRegisteredShouldReturnNone() throws Exception { + public void getWhenNoneRegisteredShouldReturnNone() { this.context = new AnnotationConfigApplicationContext(); this.context.refresh(); EntityScanPackages packages = EntityScanPackages.get(this.context); @@ -60,7 +60,7 @@ public class EntityScanPackagesTests { } @Test - public void getShouldReturnRegisterPackages() throws Exception { + public void getShouldReturnRegisterPackages() { this.context = new AnnotationConfigApplicationContext(); EntityScanPackages.register(this.context, "a", "b"); EntityScanPackages.register(this.context, "b", "c"); @@ -70,8 +70,7 @@ public class EntityScanPackagesTests { } @Test - public void registerFromArrayWhenRegistryIsNullShouldThrowException() - throws Exception { + public void registerFromArrayWhenRegistryIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Registry must not be null"); EntityScanPackages.register(null); @@ -79,8 +78,7 @@ public class EntityScanPackagesTests { } @Test - public void registerFromArrayWhenPackageNamesIsNullShouldThrowException() - throws Exception { + public void registerFromArrayWhenPackageNamesIsNullShouldThrowException() { this.context = new AnnotationConfigApplicationContext(); this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("PackageNames must not be null"); @@ -88,16 +86,14 @@ public class EntityScanPackagesTests { } @Test - public void registerFromCollectionWhenRegistryIsNullShouldThrowException() - throws Exception { + public void registerFromCollectionWhenRegistryIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Registry must not be null"); EntityScanPackages.register(null, Collections.emptyList()); } @Test - public void registerFromCollectionWhenPackageNamesIsNullShouldThrowException() - throws Exception { + public void registerFromCollectionWhenPackageNamesIsNullShouldThrowException() { this.context = new AnnotationConfigApplicationContext(); this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("PackageNames must not be null"); @@ -105,8 +101,7 @@ public class EntityScanPackagesTests { } @Test - public void entityScanAnnotationWhenHasValueAttributeShouldSetupPackages() - throws Exception { + public void entityScanAnnotationWhenHasValueAttributeShouldSetupPackages() { this.context = new AnnotationConfigApplicationContext( EntityScanValueConfig.class); EntityScanPackages packages = EntityScanPackages.get(this.context); @@ -114,8 +109,7 @@ public class EntityScanPackagesTests { } @Test - public void entityScanAnnotationWhenHasValueAttributeShouldSetupPackagesAsm() - throws Exception { + public void entityScanAnnotationWhenHasValueAttributeShouldSetupPackagesAsm() { this.context = new AnnotationConfigApplicationContext(); this.context.registerBeanDefinition("entityScanValueConfig", new RootBeanDefinition(EntityScanValueConfig.class.getName())); @@ -125,8 +119,7 @@ public class EntityScanPackagesTests { } @Test - public void entityScanAnnotationWhenHasBasePackagesAttributeShouldSetupPackages() - throws Exception { + public void entityScanAnnotationWhenHasBasePackagesAttributeShouldSetupPackages() { this.context = new AnnotationConfigApplicationContext( EntityScanBasePackagesConfig.class); EntityScanPackages packages = EntityScanPackages.get(this.context); @@ -134,16 +127,14 @@ public class EntityScanPackagesTests { } @Test - public void entityScanAnnotationWhenHasValueAndBasePackagesAttributeShouldThrow() - throws Exception { + public void entityScanAnnotationWhenHasValueAndBasePackagesAttributeShouldThrow() { this.thrown.expect(AnnotationConfigurationException.class); this.context = new AnnotationConfigApplicationContext( EntityScanValueAndBasePackagesConfig.class); } @Test - public void entityScanAnnotationWhenHasBasePackageClassesAttributeShouldSetupPackages() - throws Exception { + public void entityScanAnnotationWhenHasBasePackageClassesAttributeShouldSetupPackages() { this.context = new AnnotationConfigApplicationContext( EntityScanBasePackageClassesConfig.class); EntityScanPackages packages = EntityScanPackages.get(this.context); @@ -152,8 +143,7 @@ public class EntityScanPackagesTests { } @Test - public void entityScanAnnotationWhenNoAttributesShouldSetupPackages() - throws Exception { + public void entityScanAnnotationWhenNoAttributesShouldSetupPackages() { this.context = new AnnotationConfigApplicationContext( EntityScanNoAttributesConfig.class); EntityScanPackages packages = EntityScanPackages.get(this.context); @@ -162,8 +152,7 @@ public class EntityScanPackagesTests { } @Test - public void entityScanAnnotationWhenLoadingFromMultipleConfigsShouldCombinePackages() - throws Exception { + public void entityScanAnnotationWhenLoadingFromMultipleConfigsShouldCombinePackages() { this.context = new AnnotationConfigApplicationContext(EntityScanValueConfig.class, EntityScanBasePackagesConfig.class); EntityScanPackages packages = EntityScanPackages.get(this.context); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/domain/EntityScannerTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/domain/EntityScannerTests.java index 3f897a069f..b85a7f82cd 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/domain/EntityScannerTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/domain/EntityScannerTests.java @@ -47,7 +47,7 @@ public class EntityScannerTests { public ExpectedException thrown = ExpectedException.none(); @Test - public void createWhenContextIsNullShouldThrowException() throws Exception { + public void createWhenContextIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Context must not be null"); new EntityScanner(null); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/elasticsearch/jest/JestAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/elasticsearch/jest/JestAutoConfigurationTests.java index ee761442c1..01273d8053 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/elasticsearch/jest/JestAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/elasticsearch/jest/JestAutoConfigurationTests.java @@ -116,7 +116,7 @@ public class JestAutoConfigurationTests { } @Test - public void jestCanCommunicateWithElasticsearchInstance() throws IOException { + public void jestCanCommunicateWithElasticsearchInstance() { new ElasticsearchNodeTemplate().doWithNode((node) -> { load("spring.elasticsearch.jest.uris=http://localhost:" + node.getHttpPort()); JestClient client = this.context.getBean(JestClient.class); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java index e96a599777..fd298cfad0 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java @@ -207,7 +207,7 @@ public class FlywayAutoConfigurationTests { } @Test - public void customFlywayMigrationInitializer() throws Exception { + public void customFlywayMigrationInitializer() { this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class, CustomFlywayMigrationInitializer.class).run((context) -> { assertThat(context).hasSingleBean(Flyway.class); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfigurationReactiveIntegrationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfigurationReactiveIntegrationTests.java index b027ce53a2..969fc4ecdf 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfigurationReactiveIntegrationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfigurationReactiveIntegrationTests.java @@ -124,7 +124,7 @@ public class FreeMarkerAutoConfigurationReactiveIntegrationTests { return "Hello World"; } - private MockServerWebExchange render(String viewName) throws Exception { + private MockServerWebExchange render(String viewName) { FreeMarkerViewResolver resolver = this.context .getBean(FreeMarkerViewResolver.class); Mono view = resolver.resolveViewName(viewName, Locale.UK); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfigurationServletIntegrationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfigurationServletIntegrationTests.java index 95041303c9..83df1fbb09 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfigurationServletIntegrationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfigurationServletIntegrationTests.java @@ -151,15 +151,14 @@ public class FreeMarkerAutoConfigurationServletIntegrationTests { } @Test - public void registerResourceHandlingFilterDisabledByDefault() throws Exception { + public void registerResourceHandlingFilterDisabledByDefault() { registerAndRefreshContext(); assertThat(this.context.getBeansOfType(ResourceUrlEncodingFilter.class)) .isEmpty(); } @Test - public void registerResourceHandlingFilterOnlyIfResourceChainIsEnabled() - throws Exception { + public void registerResourceHandlingFilterOnlyIfResourceChainIsEnabled() { registerAndRefreshContext("spring.resources.chain.enabled:true"); assertThat(this.context.getBean(ResourceUrlEncodingFilter.class)).isNotNull(); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfigurationTests.java index 31d4fc6c0b..8c3be66cec 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfigurationTests.java @@ -66,7 +66,7 @@ public class FreeMarkerAutoConfigurationTests { } @Test - public void nonExistentTemplateLocation() throws Exception { + public void nonExistentTemplateLocation() { registerAndRefreshContext("spring.freemarker.templateLoaderPath:" + "classpath:/does-not-exist/,classpath:/also-does-not-exist"); this.output.expect(containsString("Cannot find template location")); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAutoConfigurationTests.java index 27891723b6..a85dab0a92 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAutoConfigurationTests.java @@ -100,7 +100,7 @@ public class GroovyTemplateAutoConfigurationTests { } @Test - public void disableViewResolution() throws Exception { + public void disableViewResolution() { TestPropertyValues.of("spring.groovy.template.enabled:false") .applyTo(this.context); registerAndRefreshContext(); @@ -171,7 +171,7 @@ public class GroovyTemplateAutoConfigurationTests { } @Test - public void customConfiguration() throws Exception { + public void customConfiguration() { registerAndRefreshContext( "spring.groovy.template.configuration.auto-indent:true"); assertThat(this.context.getBean(GroovyMarkupConfigurer.class).isAutoIndent()) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hateoas/HypermediaAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hateoas/HypermediaAutoConfigurationTests.java index 97c758bc97..e25fd2af10 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hateoas/HypermediaAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hateoas/HypermediaAutoConfigurationTests.java @@ -62,7 +62,7 @@ public class HypermediaAutoConfigurationTests { } @Test - public void linkDiscoverersCreated() throws Exception { + public void linkDiscoverersCreated() { this.context = new AnnotationConfigWebApplicationContext(); this.context.setServletContext(new MockServletContext()); this.context.register(BaseConfig.class); @@ -74,7 +74,7 @@ public class HypermediaAutoConfigurationTests { } @Test - public void entityLinksCreated() throws Exception { + public void entityLinksCreated() { this.context = new AnnotationConfigWebApplicationContext(); this.context.setServletContext(new MockServletContext()); this.context.register(BaseConfig.class); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastAutoConfigurationClientTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastAutoConfigurationClientTests.java index 7de3c902ec..aec508959f 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastAutoConfigurationClientTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastAutoConfigurationClientTests.java @@ -16,8 +16,6 @@ package org.springframework.boot.autoconfigure.hazelcast; -import java.io.IOException; - import com.hazelcast.client.config.ClientConfig; import com.hazelcast.client.impl.HazelcastClientProxy; import com.hazelcast.config.Config; @@ -65,7 +63,7 @@ public class HazelcastAutoConfigurationClientTests { .withConfiguration(AutoConfigurations.of(HazelcastAutoConfiguration.class)); @Test - public void systemProperty() throws IOException { + public void systemProperty() { this.contextRunner .withSystemProperties(HazelcastClientConfiguration.CONFIG_SYSTEM_PROPERTY + "=classpath:org/springframework/boot/autoconfigure/hazelcast/" @@ -76,7 +74,7 @@ public class HazelcastAutoConfigurationClientTests { } @Test - public void explicitConfigFile() throws IOException { + public void explicitConfigFile() { this.contextRunner .withPropertyValues( "spring.hazelcast.config=org/springframework/boot/autoconfigure/" @@ -87,7 +85,7 @@ public class HazelcastAutoConfigurationClientTests { } @Test - public void explicitConfigUrl() throws IOException { + public void explicitConfigUrl() { this.contextRunner .withPropertyValues( "spring.hazelcast.config=hazelcast-client-default.xml") diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastAutoConfigurationServerTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastAutoConfigurationServerTests.java index a793f79ee1..59443f2b04 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastAutoConfigurationServerTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastAutoConfigurationServerTests.java @@ -16,7 +16,6 @@ package org.springframework.boot.autoconfigure.hazelcast; -import java.io.IOException; import java.util.Map; import com.hazelcast.config.Config; @@ -50,7 +49,7 @@ public class HazelcastAutoConfigurationServerTests { .withConfiguration(AutoConfigurations.of(HazelcastAutoConfiguration.class)); @Test - public void defaultConfigFile() throws IOException { + public void defaultConfigFile() { // hazelcast.xml present in root classpath this.contextRunner.run((context) -> { Config config = context.getBean(HazelcastInstance.class).getConfig(); @@ -60,7 +59,7 @@ public class HazelcastAutoConfigurationServerTests { } @Test - public void systemProperty() throws IOException { + public void systemProperty() { this.contextRunner .withSystemProperties(HazelcastServerConfiguration.CONFIG_SYSTEM_PROPERTY + "=classpath:org/springframework/boot/autoconfigure/hazelcast/hazelcast-specific.xml") @@ -71,7 +70,7 @@ public class HazelcastAutoConfigurationServerTests { } @Test - public void explicitConfigFile() throws IOException { + public void explicitConfigFile() { this.contextRunner.withPropertyValues( "spring.hazelcast.config=org/springframework/boot/autoconfigure/hazelcast/" + "hazelcast-specific.xml") @@ -85,7 +84,7 @@ public class HazelcastAutoConfigurationServerTests { } @Test - public void explicitConfigUrl() throws IOException { + public void explicitConfigUrl() { this.contextRunner .withPropertyValues("spring.hazelcast.config=hazelcast-default.xml") .run((context) -> { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastAutoConfigurationTests.java index d3309a05d1..cf6d7e8628 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastAutoConfigurationTests.java @@ -16,8 +16,6 @@ package org.springframework.boot.autoconfigure.hazelcast; -import java.io.IOException; - import com.hazelcast.config.Config; import com.hazelcast.core.HazelcastInstance; import org.junit.Test; @@ -39,7 +37,7 @@ public class HazelcastAutoConfigurationTests { .withConfiguration(AutoConfigurations.of(HazelcastAutoConfiguration.class)); @Test - public void defaultConfigFile() throws IOException { + public void defaultConfigFile() { // no hazelcast-client.xml and hazelcast.xml is present in root classpath this.contextRunner.run((context) -> { Config config = context.getBean(HazelcastInstance.class).getConfig(); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/http/HttpMessageConvertersAutoConfigurationWithoutJacksonTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/http/HttpMessageConvertersAutoConfigurationWithoutJacksonTests.java index e53b72317c..ead33a1a2d 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/http/HttpMessageConvertersAutoConfigurationWithoutJacksonTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/http/HttpMessageConvertersAutoConfigurationWithoutJacksonTests.java @@ -46,8 +46,7 @@ public class HttpMessageConvertersAutoConfigurationWithoutJacksonTests { } @Test - public void autoConfigurationWorksWithSpringHateoasButWithoutJackson() - throws Exception { + public void autoConfigurationWorksWithSpringHateoasButWithoutJackson() { this.context.register(HttpMessageConvertersAutoConfiguration.class); this.context.refresh(); assertThat(this.context.getBeansOfType(HttpMessageConverters.class)).hasSize(1); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/http/HttpMessageConvertersTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/http/HttpMessageConvertersTests.java index 9b3b6af761..6d19bd828a 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/http/HttpMessageConvertersTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/http/HttpMessageConvertersTests.java @@ -47,7 +47,7 @@ import static org.mockito.Mockito.mock; public class HttpMessageConvertersTests { @Test - public void containsDefaults() throws Exception { + public void containsDefaults() { HttpMessageConverters converters = new HttpMessageConverters(); List> converterClasses = new ArrayList<>(); for (HttpMessageConverter converter : converters) { @@ -108,7 +108,7 @@ public class HttpMessageConvertersTests { } @Test - public void postProcessConverters() throws Exception { + public void postProcessConverters() { HttpMessageConverters converters = new HttpMessageConverters() { @Override @@ -135,7 +135,7 @@ public class HttpMessageConvertersTests { } @Test - public void postProcessPartConverters() throws Exception { + public void postProcessPartConverters() { HttpMessageConverters converters = new HttpMessageConverters() { @Override diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfigurationTests.java index 4cb4c75789..c1579079ff 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfigurationTests.java @@ -118,7 +118,7 @@ public class JacksonAutoConfigurationTests { */ @Test - public void noCustomDateFormat() throws Exception { + public void noCustomDateFormat() { this.context.register(JacksonAutoConfiguration.class); this.context.refresh(); ObjectMapper mapper = this.context.getBean(ObjectMapper.class); @@ -126,7 +126,7 @@ public class JacksonAutoConfigurationTests { } @Test - public void customDateFormat() throws Exception { + public void customDateFormat() { this.context.register(JacksonAutoConfiguration.class); TestPropertyValues.of("spring.jackson.date-format:yyyyMMddHHmmss") .applyTo(this.context); @@ -155,7 +155,7 @@ public class JacksonAutoConfigurationTests { } @Test - public void customDateFormatClass() throws Exception { + public void customDateFormatClass() { this.context.register(JacksonAutoConfiguration.class); TestPropertyValues .of("spring.jackson.date-format:org.springframework.boot.autoconfigure.jackson.JacksonAutoConfigurationTests.MyDateFormat") @@ -166,7 +166,7 @@ public class JacksonAutoConfigurationTests { } @Test - public void noCustomPropertyNamingStrategy() throws Exception { + public void noCustomPropertyNamingStrategy() { this.context.register(JacksonAutoConfiguration.class); this.context.refresh(); ObjectMapper mapper = this.context.getBean(ObjectMapper.class); @@ -174,7 +174,7 @@ public class JacksonAutoConfigurationTests { } @Test - public void customPropertyNamingStrategyField() throws Exception { + public void customPropertyNamingStrategyField() { this.context.register(JacksonAutoConfiguration.class); TestPropertyValues.of("spring.jackson.property-naming-strategy:SNAKE_CASE") .applyTo(this.context); @@ -185,7 +185,7 @@ public class JacksonAutoConfigurationTests { } @Test - public void customPropertyNamingStrategyClass() throws Exception { + public void customPropertyNamingStrategyClass() { this.context.register(JacksonAutoConfiguration.class); TestPropertyValues .of("spring.jackson.property-naming-strategy:com.fasterxml.jackson.databind.PropertyNamingStrategy.SnakeCaseStrategy") @@ -197,7 +197,7 @@ public class JacksonAutoConfigurationTests { } @Test - public void enableSerializationFeature() throws Exception { + public void enableSerializationFeature() { this.context.register(JacksonAutoConfiguration.class); TestPropertyValues.of("spring.jackson.serialization.indent_output:true") .applyTo(this.context); @@ -210,7 +210,7 @@ public class JacksonAutoConfigurationTests { } @Test - public void disableSerializationFeature() throws Exception { + public void disableSerializationFeature() { this.context.register(JacksonAutoConfiguration.class); TestPropertyValues .of("spring.jackson.serialization.write_dates_as_timestamps:false") @@ -224,7 +224,7 @@ public class JacksonAutoConfigurationTests { } @Test - public void enableDeserializationFeature() throws Exception { + public void enableDeserializationFeature() { this.context.register(JacksonAutoConfiguration.class); TestPropertyValues .of("spring.jackson.deserialization.use_big_decimal_for_floats:true") @@ -238,7 +238,7 @@ public class JacksonAutoConfigurationTests { } @Test - public void disableDeserializationFeature() throws Exception { + public void disableDeserializationFeature() { this.context.register(JacksonAutoConfiguration.class); TestPropertyValues .of("spring.jackson.deserialization.fail-on-unknown-properties:false") @@ -252,7 +252,7 @@ public class JacksonAutoConfigurationTests { } @Test - public void enableMapperFeature() throws Exception { + public void enableMapperFeature() { this.context.register(JacksonAutoConfiguration.class); TestPropertyValues.of("spring.jackson.mapper.require_setters_for_getters:true") .applyTo(this.context); @@ -269,7 +269,7 @@ public class JacksonAutoConfigurationTests { } @Test - public void disableMapperFeature() throws Exception { + public void disableMapperFeature() { this.context.register(JacksonAutoConfiguration.class); TestPropertyValues.of("spring.jackson.mapper.use_annotations:false") .applyTo(this.context); @@ -283,7 +283,7 @@ public class JacksonAutoConfigurationTests { } @Test - public void enableParserFeature() throws Exception { + public void enableParserFeature() { this.context.register(JacksonAutoConfiguration.class); TestPropertyValues.of("spring.jackson.parser.allow_single_quotes:true") .applyTo(this.context); @@ -295,7 +295,7 @@ public class JacksonAutoConfigurationTests { } @Test - public void disableParserFeature() throws Exception { + public void disableParserFeature() { this.context.register(JacksonAutoConfiguration.class); TestPropertyValues.of("spring.jackson.parser.auto_close_source:false") .applyTo(this.context); @@ -307,7 +307,7 @@ public class JacksonAutoConfigurationTests { } @Test - public void enableGeneratorFeature() throws Exception { + public void enableGeneratorFeature() { this.context.register(JacksonAutoConfiguration.class); TestPropertyValues.of("spring.jackson.generator.write_numbers_as_strings:true") .applyTo(this.context); @@ -320,7 +320,7 @@ public class JacksonAutoConfigurationTests { } @Test - public void disableGeneratorFeature() throws Exception { + public void disableGeneratorFeature() { this.context.register(JacksonAutoConfiguration.class); TestPropertyValues.of("spring.jackson.generator.auto_close_target:false") .applyTo(this.context); @@ -332,7 +332,7 @@ public class JacksonAutoConfigurationTests { } @Test - public void defaultObjectMapperBuilder() throws Exception { + public void defaultObjectMapperBuilder() { this.context.register(JacksonAutoConfiguration.class); this.context.refresh(); Jackson2ObjectMapperBuilder builder = this.context @@ -430,7 +430,7 @@ public class JacksonAutoConfigurationTests { } @Test - public void additionalJacksonBuilderCustomization() throws Exception { + public void additionalJacksonBuilderCustomization() { this.context.register(JacksonAutoConfiguration.class, ObjectMapperBuilderCustomConfig.class); this.context.refresh(); @@ -594,7 +594,7 @@ public class JacksonAutoConfigurationTests { @Override protected void serializeObject(Baz value, JsonGenerator jgen, - SerializerProvider provider) throws IOException { + SerializerProvider provider) { } } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java index dfd48543fd..cad30e34c0 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java @@ -21,8 +21,6 @@ import java.net.URLClassLoader; import java.sql.Connection; import java.sql.Driver; import java.sql.DriverPropertyInfo; -import java.sql.SQLException; -import java.sql.SQLFeatureNotSupportedException; import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -68,13 +66,13 @@ public class DataSourceAutoConfigurationTests { + new Random().nextInt()); @Test - public void testDefaultDataSourceExists() throws Exception { + public void testDefaultDataSourceExists() { this.contextRunner .run((context) -> assertThat(context).hasSingleBean(DataSource.class)); } @Test - public void testDataSourceHasEmbeddedDefault() throws Exception { + public void testDataSourceHasEmbeddedDefault() { this.contextRunner.run((context) -> { HikariDataSource dataSource = context.getBean(HikariDataSource.class); assertThat(dataSource.getJdbcUrl()).isNotNull(); @@ -83,7 +81,7 @@ public class DataSourceAutoConfigurationTests { } @Test - public void testBadUrl() throws Exception { + public void testBadUrl() { this.contextRunner .withPropertyValues("spring.datasource.url:jdbc:not-going-to-work") .withClassLoader(new DisableEmbeddedDatabaseClassLoader()) @@ -92,7 +90,7 @@ public class DataSourceAutoConfigurationTests { } @Test - public void testBadDriverClass() throws Exception { + public void testBadDriverClass() { this.contextRunner .withPropertyValues( "spring.datasource.driverClassName:org.none.jdbcDriver") @@ -102,7 +100,7 @@ public class DataSourceAutoConfigurationTests { } @Test - public void hikariValidatesConnectionByDefault() throws Exception { + public void hikariValidatesConnectionByDefault() { assertDataSource(HikariDataSource.class, Collections.singletonList("org.apache.tomcat"), (dataSource) -> // Use Connection#isValid() @@ -110,7 +108,7 @@ public class DataSourceAutoConfigurationTests { } @Test - public void tomcatIsFallback() throws Exception { + public void tomcatIsFallback() { assertDataSource(org.apache.tomcat.jdbc.pool.DataSource.class, Collections.singletonList("com.zaxxer.hikari"), (dataSource) -> assertThat(dataSource.getUrl()) @@ -128,7 +126,7 @@ public class DataSourceAutoConfigurationTests { } @Test - public void commonsDbcp2IsFallback() throws Exception { + public void commonsDbcp2IsFallback() { assertDataSource(BasicDataSource.class, Arrays.asList("com.zaxxer.hikari", "org.apache.tomcat"), (dataSource) -> assertThat(dataSource.getUrl()) @@ -136,7 +134,7 @@ public class DataSourceAutoConfigurationTests { } @Test - public void commonsDbcp2ValidatesConnectionByDefault() throws Exception { + public void commonsDbcp2ValidatesConnectionByDefault() { assertDataSource(org.apache.commons.dbcp2.BasicDataSource.class, Arrays.asList("com.zaxxer.hikari", "org.apache.tomcat"), (dataSource) -> { assertThat(dataSource.getTestOnBorrow()).isEqualTo(true); @@ -147,7 +145,7 @@ public class DataSourceAutoConfigurationTests { @Test @SuppressWarnings("resource") - public void testEmbeddedTypeDefaultsUsername() throws Exception { + public void testEmbeddedTypeDefaultsUsername() { this.contextRunner.withPropertyValues( "spring.datasource.driverClassName:org.hsqldb.jdbcDriver", "spring.datasource.url:jdbc:hsqldb:mem:testdb").run((context) -> { @@ -196,7 +194,7 @@ public class DataSourceAutoConfigurationTests { } @Test - public void testExplicitDriverClassClearsUsername() throws Exception { + public void testExplicitDriverClassClearsUsername() { this.contextRunner.withPropertyValues( "spring.datasource.driverClassName:" + DatabaseTestDriver.class.getName(), "spring.datasource.url:jdbc:foo://localhost").run((context) -> { @@ -209,7 +207,7 @@ public class DataSourceAutoConfigurationTests { } @Test - public void testDefaultDataSourceCanBeOverridden() throws Exception { + public void testDefaultDataSourceCanBeOverridden() { this.contextRunner.withUserConfiguration(TestDataSourceConfiguration.class) .run((context) -> assertThat(context).getBean(DataSource.class) .isInstanceOf(BasicDataSource.class)); @@ -272,18 +270,17 @@ public class DataSourceAutoConfigurationTests { public static class DatabaseTestDriver implements Driver { @Override - public Connection connect(String url, Properties info) throws SQLException { + public Connection connect(String url, Properties info) { return mock(Connection.class); } @Override - public boolean acceptsURL(String url) throws SQLException { + public boolean acceptsURL(String url) { return true; } @Override - public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) - throws SQLException { + public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) { return new DriverPropertyInfo[0]; } @@ -303,7 +300,7 @@ public class DataSourceAutoConfigurationTests { } @Override - public Logger getParentLogger() throws SQLFeatureNotSupportedException { + public Logger getParentLogger() { return mock(Logger.class); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfigurationTests.java index 07809f7eeb..18b965fe90 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfigurationTests.java @@ -44,7 +44,7 @@ public class DataSourceTransactionManagerAutoConfigurationTests { private final AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); @Test - public void testDataSourceExists() throws Exception { + public void testDataSourceExists() { this.context.register(EmbeddedDataSourceConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class, TransactionAutoConfiguration.class); @@ -54,7 +54,7 @@ public class DataSourceTransactionManagerAutoConfigurationTests { } @Test - public void testNoDataSourceExists() throws Exception { + public void testNoDataSourceExists() { this.context.register(DataSourceTransactionManagerAutoConfiguration.class, TransactionAutoConfiguration.class); this.context.refresh(); @@ -64,7 +64,7 @@ public class DataSourceTransactionManagerAutoConfigurationTests { } @Test - public void testManualConfiguration() throws Exception { + public void testManualConfiguration() { this.context.register(EmbeddedDataSourceConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class, TransactionAutoConfiguration.class); @@ -87,7 +87,7 @@ public class DataSourceTransactionManagerAutoConfigurationTests { } @Test - public void testMultiDataSource() throws Exception { + public void testMultiDataSource() { this.context.register(MultiDataSourceConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class, TransactionAutoConfiguration.class); @@ -97,7 +97,7 @@ public class DataSourceTransactionManagerAutoConfigurationTests { } @Test - public void testMultiDataSourceUsingPrimary() throws Exception { + public void testMultiDataSourceUsingPrimary() { this.context.register(MultiDataSourceUsingPrimaryConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class, TransactionAutoConfiguration.class); @@ -108,8 +108,7 @@ public class DataSourceTransactionManagerAutoConfigurationTests { } @Test - public void testCustomizeDataSourceTransactionManagerUsingProperties() - throws Exception { + public void testCustomizeDataSourceTransactionManagerUsingProperties() { TestPropertyValues .of("spring.transaction.default-timeout:30", "spring.transaction.rollback-on-commit-failure:true") diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/HikariDataSourceConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/HikariDataSourceConfigurationTests.java index d9f8fdf532..2bafd7464a 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/HikariDataSourceConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/HikariDataSourceConfigurationTests.java @@ -48,14 +48,14 @@ public class HikariDataSourceConfigurationTests { } @Test - public void testDataSourceExists() throws Exception { + public void testDataSourceExists() { load(); assertThat(this.context.getBeansOfType(DataSource.class)).hasSize(1); assertThat(this.context.getBeansOfType(HikariDataSource.class)).hasSize(1); } @Test - public void testDataSourcePropertiesOverridden() throws Exception { + public void testDataSourcePropertiesOverridden() { load("spring.datasource.hikari.jdbc-url=jdbc:foo//bar/spam", "spring.datasource.hikari.max-lifetime=1234"); HikariDataSource ds = this.context.getBean(HikariDataSource.class); @@ -65,7 +65,7 @@ public class HikariDataSourceConfigurationTests { } @Test - public void testDataSourceGenericPropertiesOverridden() throws Exception { + public void testDataSourceGenericPropertiesOverridden() { load("spring.datasource.hikari.data-source-properties.dataSourceClassName=org.h2.JDBCDataSource"); HikariDataSource ds = this.context.getBean(HikariDataSource.class); assertThat(ds.getDataSourceProperties().getProperty("dataSourceClassName")) @@ -73,7 +73,7 @@ public class HikariDataSourceConfigurationTests { } @Test - public void testDataSourceDefaultsPreserved() throws Exception { + public void testDataSourceDefaultsPreserved() { load(); HikariDataSource ds = this.context.getBean(HikariDataSource.class); assertThat(ds.getMaxLifetime()).isEqualTo(1800000); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/JdbcTemplateAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/JdbcTemplateAutoConfigurationTests.java index 0a931d2bfd..bd7ce321ff 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/JdbcTemplateAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/JdbcTemplateAutoConfigurationTests.java @@ -68,7 +68,7 @@ public class JdbcTemplateAutoConfigurationTests { } @Test - public void testJdbcTemplateWithCustomProperties() throws Exception { + public void testJdbcTemplateWithCustomProperties() { load("spring.jdbc.template.fetch-size:100", "spring.jdbc.template.query-timeout:60", "spring.jdbc.template.max-rows:1000"); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/JndiDataSourceAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/JndiDataSourceAutoConfigurationTests.java index 1fa370241d..cbc857d2a1 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/JndiDataSourceAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/JndiDataSourceAutoConfigurationTests.java @@ -157,7 +157,7 @@ public class JndiDataSourceAutoConfigurationTests { } private void configureJndi(String name, DataSource dataSource) - throws IllegalStateException, NamingException { + throws IllegalStateException { TestableInitialContextFactory.bind(name, dataSource); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/TomcatDataSourceConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/TomcatDataSourceConfigurationTests.java index 430cfa45e2..a268f64229 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/TomcatDataSourceConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/TomcatDataSourceConfigurationTests.java @@ -57,7 +57,7 @@ public class TomcatDataSourceConfigurationTests { } @Test - public void testDataSourceExists() throws Exception { + public void testDataSourceExists() { this.context.register(TomcatDataSourceConfiguration.class); TestPropertyValues.of(PREFIX + "url:jdbc:h2:mem:testdb").applyTo(this.context); this.context.refresh(); @@ -103,7 +103,7 @@ public class TomcatDataSourceConfigurationTests { } @Test - public void testDataSourceDefaultsPreserved() throws Exception { + public void testDataSourceDefaultsPreserved() { this.context.register(TomcatDataSourceConfiguration.class); TestPropertyValues.of(PREFIX + "url:jdbc:h2:mem:testdb").applyTo(this.context); this.context.refresh(); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/XADataSourceAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/XADataSourceAutoConfigurationTests.java index d7141ce20c..12e621f2b8 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/XADataSourceAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/XADataSourceAutoConfigurationTests.java @@ -40,7 +40,7 @@ import static org.mockito.Mockito.mock; public class XADataSourceAutoConfigurationTests { @Test - public void wrapExistingXaDataSource() throws Exception { + public void wrapExistingXaDataSource() { ApplicationContext context = createContext(WrapExisting.class); context.getBean(DataSource.class); XADataSource source = context.getBean(XADataSource.class); @@ -49,7 +49,7 @@ public class XADataSourceAutoConfigurationTests { } @Test - public void createFromUrl() throws Exception { + public void createFromUrl() { ApplicationContext context = createContext(FromProperties.class, "spring.datasource.url:jdbc:hsqldb:mem:test", "spring.datasource.username:un"); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/JmsAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/JmsAutoConfigurationTests.java index 63f7407fc9..4fcc2fc8b2 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/JmsAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/JmsAutoConfigurationTests.java @@ -412,7 +412,7 @@ public class JmsAutoConfigurationTests { } @Test - public void enableJmsAutomatically() throws Exception { + public void enableJmsAutomatically() { this.contextRunner.withUserConfiguration(NoEnableJmsConfiguration.class) .run((context) -> assertThat(context) .hasBean( diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQAutoConfigurationTests.java index 061daec763..2b645f0c65 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQAutoConfigurationTests.java @@ -17,7 +17,6 @@ package org.springframework.boot.autoconfigure.jms.activemq; import javax.jms.ConnectionFactory; -import javax.jms.JMSException; import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.pool.PooledConnectionFactory; @@ -199,7 +198,7 @@ public class ActiveMQAutoConfigurationTests { } @Test - public void pooledConnectionFactoryConfiguration() throws JMSException { + public void pooledConnectionFactoryConfiguration() { this.contextRunner.withUserConfiguration(EmptyConfiguration.class) .withPropertyValues("spring.activemq.pool.enabled:true") .run((context) -> { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisAutoConfigurationTests.java index 4fd77e3bde..5936f9c10c 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisAutoConfigurationTests.java @@ -221,7 +221,7 @@ public class ArtemisAutoConfigurationTests { } @Test - public void embeddedWithPersistentMode() throws IOException, JMSException { + public void embeddedWithPersistentMode() throws IOException { File dataFolder = this.folder.newFolder(); final String messageId = UUID.randomUUID().toString(); // Start the server and post a message to some queue diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisEmbeddedConfigurationFactoryTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisEmbeddedConfigurationFactoryTests.java index d9eed35d8d..003cf4a762 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisEmbeddedConfigurationFactoryTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisEmbeddedConfigurationFactoryTests.java @@ -52,7 +52,7 @@ public class ArtemisEmbeddedConfigurationFactoryTests { } @Test - public void generatedClusterPassword() throws Exception { + public void generatedClusterPassword() { ArtemisProperties properties = new ArtemisProperties(); Configuration configuration = new ArtemisEmbeddedConfigurationFactory(properties) .createConfiguration(); @@ -60,7 +60,7 @@ public class ArtemisEmbeddedConfigurationFactoryTests { } @Test - public void specificClusterPassword() throws Exception { + public void specificClusterPassword() { ArtemisProperties properties = new ArtemisProperties(); properties.getEmbedded().setClusterPassword("password"); Configuration configuration = new ArtemisEmbeddedConfigurationFactory(properties) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jmx/JmxAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jmx/JmxAutoConfigurationTests.java index 4f00ec9cb7..fd9f3ae837 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jmx/JmxAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jmx/JmxAutoConfigurationTests.java @@ -117,7 +117,7 @@ public class JmxAutoConfigurationTests { } @Test - public void testParentContext() throws Exception { + public void testParentContext() { this.context = new AnnotationConfigApplicationContext(); this.context.register(JmxAutoConfiguration.class, TestConfiguration.class); this.context.refresh(); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jooq/JooqAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jooq/JooqAutoConfigurationTests.java index 18193bba9d..2855a064bd 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jooq/JooqAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jooq/JooqAutoConfigurationTests.java @@ -74,14 +74,14 @@ public class JooqAutoConfigurationTests { } @Test - public void noDataSource() throws Exception { + public void noDataSource() { load(); assertThat(this.context.getBeanNamesForType(DSLContext.class).length) .isEqualTo(0); } @Test - public void jooqWithoutTx() throws Exception { + public void jooqWithoutTx() { load(JooqDataSourceConfiguration.class); assertThat(getBeanNames(PlatformTransactionManager.class)).isEqualTo(NO_BEANS); assertThat(getBeanNames(SpringTransactionProvider.class)).isEqualTo(NO_BEANS); @@ -107,7 +107,7 @@ public class JooqAutoConfigurationTests { } @Test - public void jooqWithTx() throws Exception { + public void jooqWithTx() { load(JooqDataSourceConfiguration.class, TxManagerConfiguration.class); this.context.getBean(PlatformTransactionManager.class); DSLContext dsl = this.context.getBean(DSLContext.class); @@ -188,7 +188,7 @@ public class JooqAutoConfigurationTests { } @Override - public void run(org.jooq.Configuration configuration) throws Exception { + public void run(org.jooq.Configuration configuration) { assertThat(this.dsl.fetch(this.sql).getValue(0, 0).toString()) .isEqualTo(this.expected); } @@ -207,7 +207,7 @@ public class JooqAutoConfigurationTests { } @Override - public void run(org.jooq.Configuration configuration) throws Exception { + public void run(org.jooq.Configuration configuration) { for (String statement : this.sql) { this.dsl.execute(statement); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jooq/SqlDialectLookupTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jooq/SqlDialectLookupTests.java index 7f58df9be7..5b39979089 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jooq/SqlDialectLookupTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jooq/SqlDialectLookupTests.java @@ -37,7 +37,7 @@ import static org.mockito.Mockito.mock; public class SqlDialectLookupTests { @Test - public void getSqlDialectWhenDataSourceIsNullShouldReturnDefault() throws Exception { + public void getSqlDialectWhenDataSourceIsNullShouldReturnDefault() { assertThat(SqlDialectLookup.getDialect(null)).isEqualTo(SQLDialect.DEFAULT); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/ldap/embedded/EmbeddedLdapAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/ldap/embedded/EmbeddedLdapAutoConfigurationTests.java index 124e27e4ad..095fdd5d56 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/ldap/embedded/EmbeddedLdapAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/ldap/embedded/EmbeddedLdapAutoConfigurationTests.java @@ -59,7 +59,7 @@ public class EmbeddedLdapAutoConfigurationTests { } @Test - public void testSetDefaultPort() throws LDAPException { + public void testSetDefaultPort() { load("spring.ldap.embedded.port:1234", "spring.ldap.embedded.base-dn:dc=spring,dc=org"); InMemoryDirectoryServer server = this.context @@ -68,7 +68,7 @@ public class EmbeddedLdapAutoConfigurationTests { } @Test - public void testRandomPortWithEnvironment() throws LDAPException { + public void testRandomPortWithEnvironment() { load("spring.ldap.embedded.base-dn:dc=spring,dc=org"); InMemoryDirectoryServer server = this.context .getBean(InMemoryDirectoryServer.class); @@ -77,7 +77,7 @@ public class EmbeddedLdapAutoConfigurationTests { } @Test - public void testRandomPortWithValueAnnotation() throws LDAPException { + public void testRandomPortWithValueAnnotation() { TestPropertyValues.of("spring.ldap.embedded.base-dn:dc=spring,dc=org") .applyTo(this.context); this.context.register(EmbeddedLdapAutoConfiguration.class, @@ -118,7 +118,7 @@ public class EmbeddedLdapAutoConfigurationTests { } @Test - public void testQueryEmbeddedLdap() throws LDAPException { + public void testQueryEmbeddedLdap() { TestPropertyValues.of("spring.ldap.embedded.base-dn:dc=spring,dc=org") .applyTo(this.context); this.context.register(EmbeddedLdapAutoConfiguration.class, diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/logging/ConditionEvaluationReportLoggingListenerTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/logging/ConditionEvaluationReportLoggingListenerTests.java index b6222f2929..3f22dedd4b 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/logging/ConditionEvaluationReportLoggingListenerTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/logging/ConditionEvaluationReportLoggingListenerTests.java @@ -105,7 +105,7 @@ public class ConditionEvaluationReportLoggingListenerTests { } @Test - public void logsOutput() throws Exception { + public void logsOutput() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); this.initializer.initialize(context); context.register(Config.class); @@ -119,7 +119,7 @@ public class ConditionEvaluationReportLoggingListenerTests { } @Test - public void canBeUsedInApplicationContext() throws Exception { + public void canBeUsedInApplicationContext() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); context.register(Config.class); new ConditionEvaluationReportLoggingListener().initialize(context); @@ -128,7 +128,7 @@ public class ConditionEvaluationReportLoggingListenerTests { } @Test - public void canBeUsedInNonGenericApplicationContext() throws Exception { + public void canBeUsedInNonGenericApplicationContext() { AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext(); context.setServletContext(new MockServletContext()); context.register(Config.class); @@ -138,7 +138,7 @@ public class ConditionEvaluationReportLoggingListenerTests { } @Test - public void noErrorIfNotInitialized() throws Exception { + public void noErrorIfNotInitialized() { this.initializer .onApplicationEvent(new ApplicationFailedEvent(new SpringApplication(), new String[0], null, new RuntimeException("Planned"))); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mail/MailSenderAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mail/MailSenderAutoConfigurationTests.java index 7c505bfe8a..3ad4a2da97 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mail/MailSenderAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mail/MailSenderAutoConfigurationTests.java @@ -172,7 +172,7 @@ public class MailSenderAutoConfigurationTests { } @Test - public void jndiSessionNotAvailableWithJndiName() throws NamingException { + public void jndiSessionNotAvailableWithJndiName() { this.thrown.expect(BeanCreationException.class); this.thrown.expectMessage("Unable to find Session in JNDI location foo"); load(EmptyConfig.class, "spring.mail.jndi-name:foo"); @@ -195,7 +195,7 @@ public class MailSenderAutoConfigurationTests { } private Session configureJndiSession(String name) - throws IllegalStateException, NamingException { + throws IllegalStateException { Properties properties = new Properties(); Session session = Session.getDefaultInstance(properties); TestableInitialContextFactory.bind(name, session); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoPropertiesTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoPropertiesTests.java index 304d996fdf..77a9259b0b 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoPropertiesTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoPropertiesTests.java @@ -16,7 +16,6 @@ package org.springframework.boot.autoconfigure.mongo; -import java.net.UnknownHostException; import java.util.List; import com.mongodb.MongoClient; @@ -114,7 +113,7 @@ public class MongoPropertiesTests { } @Test - public void uriOverridesHostAndPort() throws UnknownHostException { + public void uriOverridesHostAndPort() { MongoProperties properties = new MongoProperties(); properties.setHost("localhost"); properties.setPort(27017); @@ -127,7 +126,7 @@ public class MongoPropertiesTests { } @Test - public void onlyHostAndPortSetShouldUseThat() throws UnknownHostException { + public void onlyHostAndPortSetShouldUseThat() { MongoProperties properties = new MongoProperties(); properties.setHost("localhost"); properties.setPort(27017); @@ -139,7 +138,7 @@ public class MongoPropertiesTests { } @Test - public void onlyUriSetShouldUseThat() throws UnknownHostException { + public void onlyUriSetShouldUseThat() { MongoProperties properties = new MongoProperties(); properties.setUri("mongodb://mongo1.example.com:12345"); MongoClient client = new MongoClientFactory(properties, null) @@ -150,7 +149,7 @@ public class MongoPropertiesTests { } @Test - public void noCustomAddressAndNoUriUsesDefaultUri() throws UnknownHostException { + public void noCustomAddressAndNoUriUsesDefaultUri() { MongoProperties properties = new MongoProperties(); MongoClient client = new MongoClientFactory(properties, null) .createMongoClient(null); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/ReactiveMongoClientFactoryTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/ReactiveMongoClientFactoryTests.java index 168ff7ed7f..33962435dd 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/ReactiveMongoClientFactoryTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/ReactiveMongoClientFactoryTests.java @@ -16,7 +16,6 @@ package org.springframework.boot.autoconfigure.mongo; -import java.net.UnknownHostException; import java.util.Arrays; import java.util.List; @@ -51,7 +50,7 @@ public class ReactiveMongoClientFactoryTests { private MockEnvironment environment = new MockEnvironment(); @Test - public void portCanBeCustomized() throws UnknownHostException { + public void portCanBeCustomized() { MongoProperties properties = new MongoProperties(); properties.setPort(12345); MongoClient client = createMongoClient(properties); @@ -61,7 +60,7 @@ public class ReactiveMongoClientFactoryTests { } @Test - public void hostCanBeCustomized() throws UnknownHostException { + public void hostCanBeCustomized() { MongoProperties properties = new MongoProperties(); properties.setHost("mongo.example.com"); MongoClient client = createMongoClient(properties); @@ -71,7 +70,7 @@ public class ReactiveMongoClientFactoryTests { } @Test - public void credentialsCanBeCustomized() throws UnknownHostException { + public void credentialsCanBeCustomized() { MongoProperties properties = new MongoProperties(); properties.setUsername("user"); properties.setPassword("secret".toCharArray()); @@ -81,7 +80,7 @@ public class ReactiveMongoClientFactoryTests { } @Test - public void databaseCanBeCustomized() throws UnknownHostException { + public void databaseCanBeCustomized() { MongoProperties properties = new MongoProperties(); properties.setDatabase("foo"); properties.setUsername("user"); @@ -92,7 +91,7 @@ public class ReactiveMongoClientFactoryTests { } @Test - public void authenticationDatabaseCanBeCustomized() throws UnknownHostException { + public void authenticationDatabaseCanBeCustomized() { MongoProperties properties = new MongoProperties(); properties.setAuthenticationDatabase("foo"); properties.setUsername("user"); @@ -103,7 +102,7 @@ public class ReactiveMongoClientFactoryTests { } @Test - public void uriCanBeCustomized() throws UnknownHostException { + public void uriCanBeCustomized() { MongoProperties properties = new MongoProperties(); properties.setUri("mongodb://user:secret@mongo1.example.com:12345," + "mongo2.example.com:23456/test"); @@ -118,7 +117,7 @@ public class ReactiveMongoClientFactoryTests { } @Test - public void uriCannotBeSetWithCredentials() throws UnknownHostException { + public void uriCannotBeSetWithCredentials() { MongoProperties properties = new MongoProperties(); properties.setUri("mongodb://127.0.0.1:1234/mydb"); properties.setUsername("user"); @@ -130,7 +129,7 @@ public class ReactiveMongoClientFactoryTests { } @Test - public void uriCannotBeSetWithHostPort() throws UnknownHostException { + public void uriCannotBeSetWithHostPort() { MongoProperties properties = new MongoProperties(); properties.setUri("mongodb://127.0.0.1:1234/mydb"); properties.setHost("localhost"); @@ -142,7 +141,7 @@ public class ReactiveMongoClientFactoryTests { } @Test - public void uriIsIgnoredInEmbeddedMode() throws UnknownHostException { + public void uriIsIgnoredInEmbeddedMode() { MongoProperties properties = new MongoProperties(); properties.setUri("mongodb://mongo.example.com:1234/mydb"); this.environment.setProperty("local.mongo.port", "4000"); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfigurationTests.java index a7265f15b0..554e47f4b8 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfigurationTests.java @@ -17,7 +17,6 @@ package org.springframework.boot.autoconfigure.mongo.embedded; import java.io.File; -import java.net.UnknownHostException; import com.mongodb.MongoClient; import de.flapdoodle.embed.mongo.config.IMongodConfig; @@ -190,8 +189,7 @@ public class EmbeddedMongoAutoConfigurationTests { static class MongoClientConfiguration { @Bean - public MongoClient mongoClient(@Value("${local.mongo.port}") int port) - throws UnknownHostException { + public MongoClient mongoClient(@Value("${local.mongo.port}") int port) { return new MongoClient("localhost", port); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheAutoConfigurationReactiveIntegrationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheAutoConfigurationReactiveIntegrationTests.java index 1e636aa1cc..58612e91d1 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheAutoConfigurationReactiveIntegrationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheAutoConfigurationReactiveIntegrationTests.java @@ -58,14 +58,14 @@ public class MustacheAutoConfigurationReactiveIntegrationTests { private WebTestClient client; @Test - public void testHomePage() throws Exception { + public void testHomePage() { String result = this.client.get().uri("/").exchange().expectStatus().isOk() .expectBody(String.class).returnResult().getResponseBody(); assertThat(result).contains("Hello App").contains("Hello World"); } @Test - public void testPartialPage() throws Exception { + public void testPartialPage() { String result = this.client.get().uri("/partial").exchange().expectStatus().isOk() .expectBody(String.class).returnResult().getResponseBody(); assertThat(result).contains("Hello App").contains("Hello World"); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheAutoConfigurationServletIntegrationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheAutoConfigurationServletIntegrationTests.java index 9f75618d56..4bb0ec5382 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheAutoConfigurationServletIntegrationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheAutoConfigurationServletIntegrationTests.java @@ -83,14 +83,14 @@ public class MustacheAutoConfigurationServletIntegrationTests { } @Test - public void testHomePage() throws Exception { + public void testHomePage() { String body = new TestRestTemplate().getForObject("http://localhost:" + this.port, String.class); assertThat(body.contains("Hello World")).isTrue(); } @Test - public void testPartialPage() throws Exception { + public void testPartialPage() { String body = new TestRestTemplate() .getForObject("http://localhost:" + this.port + "/partial", String.class); assertThat(body.contains("Hello World")).isTrue(); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheStandaloneIntegrationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheStandaloneIntegrationTests.java index e0debaae12..dd0e7501fc 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheStandaloneIntegrationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheStandaloneIntegrationTests.java @@ -48,26 +48,26 @@ public class MustacheStandaloneIntegrationTests { private Mustache.Compiler compiler; @Test - public void directCompilation() throws Exception { + public void directCompilation() { assertThat(this.compiler.compile("Hello: {{world}}") .execute(Collections.singletonMap("world", "World"))) .isEqualTo("Hello: World"); } @Test - public void environmentCollectorCompoundKey() throws Exception { + public void environmentCollectorCompoundKey() { assertThat(this.compiler.compile("Hello: {{env.foo}}").execute(new Object())) .isEqualTo("Hello: There"); } @Test - public void environmentCollectorCompoundKeyStandard() throws Exception { + public void environmentCollectorCompoundKeyStandard() { assertThat(this.compiler.standardsMode(true).compile("Hello: {{env.foo}}") .execute(new Object())).isEqualTo("Hello: There"); } @Test - public void environmentCollectorSimpleKey() throws Exception { + public void environmentCollectorSimpleKey() { assertThat(this.compiler.compile("Hello: {{foo}}").execute(new Object())) .isEqualTo("Hello: World"); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/DatabaseLookupTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/DatabaseLookupTests.java index a3ff71753f..4d334a0a8a 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/DatabaseLookupTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/DatabaseLookupTests.java @@ -38,7 +38,7 @@ import static org.mockito.Mockito.mock; public class DatabaseLookupTests { @Test - public void getDatabaseWhenDataSourceIsNullShouldReturnDefault() throws Exception { + public void getDatabaseWhenDataSourceIsNullShouldReturnDefault() { assertThat(DatabaseLookup.getDatabase(null)).isEqualTo(Database.DEFAULT); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfigurationTests.java index b3259ce4d8..24fd71564d 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfigurationTests.java @@ -28,7 +28,6 @@ import java.util.Vector; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.transaction.Synchronization; -import javax.transaction.SystemException; import javax.transaction.Transaction; import javax.transaction.TransactionManager; import javax.transaction.UserTransaction; @@ -319,7 +318,7 @@ public class HibernateJpaAutoConfigurationTests } @Override - public int getCurrentStatus() throws SystemException { + public int getCurrentStatus() { throw new UnsupportedOperationException(); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/JpaPropertiesTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/JpaPropertiesTests.java index ca80d9d5f4..50753afbec 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/JpaPropertiesTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/JpaPropertiesTests.java @@ -61,7 +61,7 @@ public class JpaPropertiesTests { } @Test - public void noCustomNamingStrategy() throws Exception { + public void noCustomNamingStrategy() { JpaProperties properties = load(); Map hibernateProperties = properties .getHibernateProperties(new HibernateSettings().ddlAuto("none")); @@ -76,7 +76,7 @@ public class JpaPropertiesTests { } @Test - public void hibernate5CustomNamingStrategies() throws Exception { + public void hibernate5CustomNamingStrategies() { JpaProperties properties = load( "spring.jpa.hibernate.naming.implicit-strategy:com.example.Implicit", "spring.jpa.hibernate.naming.physical-strategy:com.example.Physical"); @@ -90,7 +90,7 @@ public class JpaPropertiesTests { } @Test - public void namingStrategyInstancesCanBeUsed() throws Exception { + public void namingStrategyInstancesCanBeUsed() { JpaProperties properties = load(); ImplicitNamingStrategy implicitStrategy = mock(ImplicitNamingStrategy.class); PhysicalNamingStrategy physicalStrategy = mock(PhysicalNamingStrategy.class); @@ -106,8 +106,7 @@ public class JpaPropertiesTests { } @Test - public void namingStrategyInstancesTakePrecedenceOverNamingStrategyProperties() - throws Exception { + public void namingStrategyInstancesTakePrecedenceOverNamingStrategyProperties() { JpaProperties properties = load( "spring.jpa.hibernate.naming.implicit-strategy:com.example.Implicit", "spring.jpa.hibernate.naming.physical-strategy:com.example.Physical"); @@ -125,7 +124,7 @@ public class JpaPropertiesTests { } @Test - public void hibernate5CustomNamingStrategiesViaJpaProperties() throws Exception { + public void hibernate5CustomNamingStrategiesViaJpaProperties() { JpaProperties properties = load( "spring.jpa.properties.hibernate.implicit_naming_strategy:com.example.Implicit", "spring.jpa.properties.hibernate.physical_naming_strategy:com.example.Physical"); @@ -140,7 +139,7 @@ public class JpaPropertiesTests { } @Test - public void useNewIdGeneratorMappingsDefault() throws Exception { + public void useNewIdGeneratorMappingsDefault() { JpaProperties properties = load(); Map hibernateProperties = properties .getHibernateProperties(new HibernateSettings().ddlAuto("none")); @@ -149,7 +148,7 @@ public class JpaPropertiesTests { } @Test - public void useNewIdGeneratorMappingsFalse() throws Exception { + public void useNewIdGeneratorMappingsFalse() { JpaProperties properties = load( "spring.jpa.hibernate.use-new-id-generator-mappings:false"); Map hibernateProperties = properties diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/quartz/QuartzAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/quartz/QuartzAutoConfigurationTests.java index 351881cb17..94b9933137 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/quartz/QuartzAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/quartz/QuartzAutoConfigurationTests.java @@ -28,7 +28,6 @@ import org.quartz.Calendar; import org.quartz.JobBuilder; import org.quartz.JobDetail; import org.quartz.JobExecutionContext; -import org.quartz.JobExecutionException; import org.quartz.JobKey; import org.quartz.Scheduler; import org.quartz.SchedulerException; @@ -362,8 +361,7 @@ public class QuartzAutoConfigurationTests { private String jobDataKey; @Override - protected void executeInternal(JobExecutionContext context) - throws JobExecutionException { + protected void executeInternal(JobExecutionContext context) { System.out.println(this.env.getProperty("test-name", "unknown") + " - " + this.jobDataKey); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityAutoConfigurationTests.java index 61f571c74b..74394d6a95 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityAutoConfigurationTests.java @@ -80,7 +80,7 @@ public class SecurityAutoConfigurationTests { } @Test - public void testWebConfiguration() throws Exception { + public void testWebConfiguration() { this.context = new AnnotationConfigWebApplicationContext(); this.context.setServletContext(new MockServletContext()); this.context.register(SecurityAutoConfiguration.class, @@ -92,7 +92,7 @@ public class SecurityAutoConfigurationTests { } @Test - public void testDefaultFilterOrderWithSecurityAdapter() throws Exception { + public void testDefaultFilterOrderWithSecurityAdapter() { this.context = new AnnotationConfigWebApplicationContext(); this.context.setServletContext(new MockServletContext()); this.context.register(WebSecurity.class, SecurityAutoConfiguration.class, @@ -105,7 +105,7 @@ public class SecurityAutoConfigurationTests { } @Test - public void testFilterIsNotRegisteredInNonWeb() throws Exception { + public void testFilterIsNotRegisteredInNonWeb() { try (AnnotationConfigApplicationContext customContext = new AnnotationConfigApplicationContext()) { customContext.register(SecurityAutoConfiguration.class, SecurityFilterAutoConfiguration.class, @@ -117,7 +117,7 @@ public class SecurityAutoConfigurationTests { } @Test - public void testDefaultFilterOrder() throws Exception { + public void testDefaultFilterOrder() { this.context = new AnnotationConfigWebApplicationContext(); this.context.setServletContext(new MockServletContext()); this.context.register(SecurityAutoConfiguration.class, @@ -130,7 +130,7 @@ public class SecurityAutoConfigurationTests { } @Test - public void testCustomFilterOrder() throws Exception { + public void testCustomFilterOrder() { this.context = new AnnotationConfigWebApplicationContext(); TestPropertyValues.of("spring.security.filter.order:12345").applyTo(this.context); this.context.setServletContext(new MockServletContext()); @@ -143,7 +143,7 @@ public class SecurityAutoConfigurationTests { } @Test - public void testDefaultUsernamePassword() throws Exception { + public void testDefaultUsernamePassword() { this.context = new AnnotationConfigWebApplicationContext(); this.context.setServletContext(new MockServletContext()); this.context.register(SecurityAutoConfiguration.class); @@ -155,8 +155,7 @@ public class SecurityAutoConfigurationTests { } @Test - public void defaultUserNotCreatedIfAuthenticationManagerBeanPresent() - throws Exception { + public void defaultUserNotCreatedIfAuthenticationManagerBeanPresent() { this.context = new AnnotationConfigWebApplicationContext(); this.context.setServletContext(new MockServletContext()); this.context.register(TestAuthenticationManagerConfiguration.class, @@ -173,7 +172,7 @@ public class SecurityAutoConfigurationTests { } @Test - public void defaultUserNotCreatedIfUserDetailsServiceBeanPresent() throws Exception { + public void defaultUserNotCreatedIfUserDetailsServiceBeanPresent() { this.context = new AnnotationConfigWebApplicationContext(); this.context.setServletContext(new MockServletContext()); this.context.register(TestUserDetailsServiceConfiguration.class, @@ -188,8 +187,7 @@ public class SecurityAutoConfigurationTests { } @Test - public void defaultUserNotCreatedIfAuthenticationProviderBeanPresent() - throws Exception { + public void defaultUserNotCreatedIfAuthenticationProviderBeanPresent() { this.context = new AnnotationConfigWebApplicationContext(); this.context.setServletContext(new MockServletContext()); this.context.register(TestAuthenticationProviderConfiguration.class, @@ -205,7 +203,7 @@ public class SecurityAutoConfigurationTests { } @Test - public void testJpaCoexistsHappily() throws Exception { + public void testJpaCoexistsHappily() { this.context = new AnnotationConfigWebApplicationContext(); this.context.setServletContext(new MockServletContext()); TestPropertyValues diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityFilterAutoConfigurationEarlyInitializationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityFilterAutoConfigurationEarlyInitializationTests.java index dd888a26eb..b3c0d18799 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityFilterAutoConfigurationEarlyInitializationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityFilterAutoConfigurationEarlyInitializationTests.java @@ -16,10 +16,7 @@ package org.springframework.boot.autoconfigure.security; -import java.io.IOException; - import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.deser.std.StdDeserializer; import com.fasterxml.jackson.databind.module.SimpleModule; @@ -59,7 +56,7 @@ public class SecurityFilterAutoConfigurationEarlyInitializationTests { public OutputCapture outputCapture = new OutputCapture(); @Test - public void testSecurityFilterDoesNotCauseEarlyInitialization() throws Exception { + public void testSecurityFilterDoesNotCauseEarlyInitialization() { try (AnnotationConfigServletWebServerApplicationContext context = new AnnotationConfigServletWebServerApplicationContext()) { TestPropertyValues.of("server.port:0").applyTo(context); context.register(Config.class); @@ -127,8 +124,7 @@ public class SecurityFilterAutoConfigurationEarlyInitializationTests { } @Override - public SourceType deserialize(JsonParser p, DeserializationContext ctxt) - throws IOException, JsonProcessingException { + public SourceType deserialize(JsonParser p, DeserializationContext ctxt) { return new SourceType(); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityFilterAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityFilterAutoConfigurationTests.java index d26d1a1cec..7ae0392ec9 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityFilterAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityFilterAutoConfigurationTests.java @@ -42,8 +42,7 @@ import org.springframework.web.context.support.AnnotationConfigWebApplicationCon public class SecurityFilterAutoConfigurationTests { @Test - public void filterAutoConfigurationWorksWithoutSecurityAutoConfiguration() - throws Exception { + public void filterAutoConfigurationWorksWithoutSecurityAutoConfiguration() { try (AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext()) { context.setServletContext(new MockServletContext()); context.register(Config.class); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityPropertiesTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityPropertiesTests.java index 1e7f057a60..e4ccc3d745 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityPropertiesTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityPropertiesTests.java @@ -40,7 +40,7 @@ public class SecurityPropertiesTests { private MapConfigurationPropertySource source = new MapConfigurationPropertySource(); @Before - public void setUp() throws Exception { + public void setUp() { this.binder = new Binder(this.source); } @@ -52,7 +52,7 @@ public class SecurityPropertiesTests { } @Test - public void userWhenNotConfiguredShouldUseDefaultNameAndGeneratedPassword() throws Exception { + public void userWhenNotConfiguredShouldUseDefaultNameAndGeneratedPassword() { SecurityProperties.User user = this.security.getUser(); assertThat(user.getName()).isEqualTo("user"); assertThat(user.getPassword()).isNotNull(); @@ -61,7 +61,7 @@ public class SecurityPropertiesTests { } @Test - public void userShouldBindProperly() throws Exception { + public void userShouldBindProperly() { this.source.put("spring.security.user.name", "foo"); this.source.put("spring.security.user.password", "password"); this.source.put("spring.security.user.roles", "ADMIN,USER"); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/StaticResourceRequestTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/StaticResourceRequestTests.java index b21eec8d82..2a5c4512fa 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/StaticResourceRequestTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/StaticResourceRequestTests.java @@ -47,7 +47,7 @@ public class StaticResourceRequestTests { public ExpectedException thrown = ExpectedException.none(); @Test - public void toCommonLocationsShouldMatchCommonLocations() throws Exception { + public void toCommonLocationsShouldMatchCommonLocations() { RequestMatcher matcher = StaticResourceRequest.toCommonLocations(); assertMatcher(matcher).matches("/css/file.css"); assertMatcher(matcher).matches("/js/file.js"); @@ -58,7 +58,7 @@ public class StaticResourceRequestTests { } @Test - public void toCommonLocationsWithExcludeShouldNotMatchExcluded() throws Exception { + public void toCommonLocationsWithExcludeShouldNotMatchExcluded() { RequestMatcher matcher = StaticResourceRequest.toCommonLocations() .excluding(Location.CSS); assertMatcher(matcher).doesNotMatch("/css/file.css"); @@ -66,14 +66,14 @@ public class StaticResourceRequestTests { } @Test - public void toLocationShouldMatchLocation() throws Exception { + public void toLocationShouldMatchLocation() { RequestMatcher matcher = StaticResourceRequest.to(Location.CSS); assertMatcher(matcher).matches("/css/file.css"); assertMatcher(matcher).doesNotMatch("/js/file.js"); } @Test - public void toLocationWhenHasServletPathShouldMatchLocation() throws Exception { + public void toLocationWhenHasServletPathShouldMatchLocation() { ServerProperties serverProperties = new ServerProperties(); serverProperties.getServlet().setPath("/foo"); RequestMatcher matcher = StaticResourceRequest.to(Location.CSS); @@ -82,14 +82,14 @@ public class StaticResourceRequestTests { } @Test - public void toLocationsFromSetWhenSetIsNullShouldThrowException() throws Exception { + public void toLocationsFromSetWhenSetIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Locations must not be null"); StaticResourceRequest.to((Set) null); } @Test - public void excludeFromSetWhenSetIsNullShouldThrowException() throws Exception { + public void excludeFromSetWhenSetIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Locations must not be null"); StaticResourceRequest.toCommonLocations().excluding((Set) null); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/jpa/JpaUserDetailsTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/jpa/JpaUserDetailsTests.java index 66e42c0f11..abae4f9e6c 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/jpa/JpaUserDetailsTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/jpa/JpaUserDetailsTests.java @@ -45,10 +45,10 @@ import org.springframework.test.context.junit4.SpringRunner; public class JpaUserDetailsTests { @Test - public void contextLoads() throws Exception { + public void contextLoads() { } - public static void main(String[] args) throws Exception { + public static void main(String[] args) { SpringApplication.run(Main.class, args); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2ClientPropertiesRegistrationAdapterTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2ClientPropertiesRegistrationAdapterTests.java index 65bdf43b8d..0b18ddac81 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2ClientPropertiesRegistrationAdapterTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2ClientPropertiesRegistrationAdapterTests.java @@ -42,8 +42,7 @@ public class OAuth2ClientPropertiesRegistrationAdapterTests { public ExpectedException thrown = ExpectedException.none(); @Test - public void getClientRegistrationsWhenUsingDefinedProviderShouldAdapt() - throws Exception { + public void getClientRegistrationsWhenUsingDefinedProviderShouldAdapt() { OAuth2ClientProperties properties = new OAuth2ClientProperties(); Provider provider = new Provider(); provider.setAuthorizationUri("http://example.com/auth"); @@ -85,8 +84,7 @@ public class OAuth2ClientPropertiesRegistrationAdapterTests { } @Test - public void getClientRegistrationsWhenUsingCommonProviderShouldAdapt() - throws Exception { + public void getClientRegistrationsWhenUsingCommonProviderShouldAdapt() { OAuth2ClientProperties properties = new OAuth2ClientProperties(); Registration registration = new Registration(); registration.setProvider("google"); @@ -120,8 +118,7 @@ public class OAuth2ClientPropertiesRegistrationAdapterTests { } @Test - public void getClientRegistrationsWhenUsingCommonProviderWithOverrideShouldAdapt() - throws Exception { + public void getClientRegistrationsWhenUsingCommonProviderWithOverrideShouldAdapt() { OAuth2ClientProperties properties = new OAuth2ClientProperties(); Registration registration = new Registration(); registration.setProvider("google"); @@ -159,8 +156,7 @@ public class OAuth2ClientPropertiesRegistrationAdapterTests { } @Test - public void getClientRegistrationsWhenUnknownProviderShouldThrowException() - throws Exception { + public void getClientRegistrationsWhenUnknownProviderShouldThrowException() { OAuth2ClientProperties properties = new OAuth2ClientProperties(); Registration registration = new Registration(); registration.setProvider("missing"); @@ -171,8 +167,7 @@ public class OAuth2ClientPropertiesRegistrationAdapterTests { } @Test - public void getClientRegistrationsWhenProviderNotSpecifiedShouldUseRegistrationId() - throws Exception { + public void getClientRegistrationsWhenProviderNotSpecifiedShouldUseRegistrationId() { OAuth2ClientProperties properties = new OAuth2ClientProperties(); Registration registration = new Registration(); registration.setClientId("clientId"); @@ -205,8 +200,7 @@ public class OAuth2ClientPropertiesRegistrationAdapterTests { } @Test - public void getClientRegistrationsWhenProviderNotSpecifiedAndUnknownProviderShouldThrowException() - throws Exception { + public void getClientRegistrationsWhenProviderNotSpecifiedAndUnknownProviderShouldThrowException() { OAuth2ClientProperties properties = new OAuth2ClientProperties(); Registration registration = new Registration(); properties.getRegistration().put("missing", registration); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2ClientPropertiesTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2ClientPropertiesTests.java index 166fea47b6..cfd146c093 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2ClientPropertiesTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2ClientPropertiesTests.java @@ -33,7 +33,7 @@ public class OAuth2ClientPropertiesTests { public ExpectedException thrown = ExpectedException.none(); @Test - public void clientIdAbsentThrowsException() throws Exception { + public void clientIdAbsentThrowsException() { OAuth2ClientProperties.Registration registration = new OAuth2ClientProperties.Registration(); registration.setClientSecret("secret"); registration.setProvider("google"); @@ -44,7 +44,7 @@ public class OAuth2ClientPropertiesTests { } @Test - public void clientSecretAbsentThrowsException() throws Exception { + public void clientSecretAbsentThrowsException() { OAuth2ClientProperties.Registration registration = new OAuth2ClientProperties.Registration(); registration.setClientId("foo"); registration.setProvider("google"); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2ClientRegistrationRepositoryConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2ClientRegistrationRepositoryConfigurationTests.java index b03e0626bb..a7a6639be6 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2ClientRegistrationRepositoryConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2ClientRegistrationRepositoryConfigurationTests.java @@ -36,8 +36,7 @@ public class OAuth2ClientRegistrationRepositoryConfigurationTests { private static final String REGISTRATION_PREFIX = "spring.security.oauth2.client.registration"; @Test - public void clientRegistrationRepositoryBeanShouldNotBeCreatedWhenPropertiesAbsent() - throws Exception { + public void clientRegistrationRepositoryBeanShouldNotBeCreatedWhenPropertiesAbsent() { this.contextRunner .withUserConfiguration( OAuth2ClientRegistrationRepositoryConfiguration.class) @@ -46,8 +45,7 @@ public class OAuth2ClientRegistrationRepositoryConfigurationTests { } @Test - public void clientRegistrationRepositoryBeanShouldBeCreatedWhenPropertiesPresent() - throws Exception { + public void clientRegistrationRepositoryBeanShouldBeCreatedWhenPropertiesPresent() { this.contextRunner .withUserConfiguration( OAuth2ClientRegistrationRepositoryConfiguration.class) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2WebSecurityConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2WebSecurityConfigurationTests.java index 40404b67e5..1d28ee21a9 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2WebSecurityConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2WebSecurityConfigurationTests.java @@ -58,7 +58,7 @@ public class OAuth2WebSecurityConfigurationTests { private final ApplicationContextRunner contextRunner = new ApplicationContextRunner(); @Test - public void securityConfigurerConfiguresOAuth2Login() throws Exception { + public void securityConfigurerConfiguresOAuth2Login() { this.contextRunner.withUserConfiguration(ClientRepositoryConfiguration.class, OAuth2WebSecurityConfiguration.class).run((context) -> { ClientRegistrationRepository expected = context @@ -74,8 +74,7 @@ public class OAuth2WebSecurityConfigurationTests { } @Test - public void securityConfigurerBacksOffWhenClientRegistrationBeanAbsent() - throws Exception { + public void securityConfigurerBacksOffWhenClientRegistrationBeanAbsent() { this.contextRunner .withUserConfiguration(TestConfig.class, OAuth2WebSecurityConfiguration.class) @@ -83,7 +82,7 @@ public class OAuth2WebSecurityConfigurationTests { } @Test - public void configurationRegistersAuthorizedClientServiceBean() throws Exception { + public void configurationRegistersAuthorizedClientServiceBean() { this.contextRunner.withUserConfiguration(ClientRepositoryConfiguration.class, OAuth2WebSecurityConfiguration.class).run((context) -> { OAuth2AuthorizedClientService bean = context @@ -96,8 +95,7 @@ public class OAuth2WebSecurityConfigurationTests { } @Test - public void securityConfigurerBacksOffWhenOtherWebSecurityAdapterPresent() - throws Exception { + public void securityConfigurerBacksOffWhenOtherWebSecurityAdapterPresent() { this.contextRunner.withUserConfiguration(TestWebSecurityConfigurerConfig.class, OAuth2WebSecurityConfiguration.class).run((context) -> { assertThat(getAuthCodeFilters(context)).isEmpty(); @@ -107,7 +105,7 @@ public class OAuth2WebSecurityConfigurationTests { } @Test - public void authorizedClientServiceBeanIsConditionalOnMissingBean() throws Exception { + public void authorizedClientServiceBeanIsConditionalOnMissingBean() { this.contextRunner .withUserConfiguration(OAuth2AuthorizedClientServiceConfiguration.class, OAuth2WebSecurityConfiguration.class) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/template/TemplateAvailabilityProvidersTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/template/TemplateAvailabilityProvidersTests.java index a7594d31fa..5ff219ab1c 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/template/TemplateAvailabilityProvidersTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/template/TemplateAvailabilityProvidersTests.java @@ -68,15 +68,14 @@ public class TemplateAvailabilityProvidersTests { } @Test - public void createWhenApplicationContextIsNullShouldThrowException() - throws Exception { + public void createWhenApplicationContextIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("ClassLoader must not be null"); new TemplateAvailabilityProviders((ApplicationContext) null); } @Test - public void createWhenUsingApplicationContextShouldLoadProviders() throws Exception { + public void createWhenUsingApplicationContextShouldLoadProviders() { ApplicationContext applicationContext = mock(ApplicationContext.class); given(applicationContext.getClassLoader()).willReturn(this.classLoader); TemplateAvailabilityProviders providers = new TemplateAvailabilityProviders( @@ -86,21 +85,21 @@ public class TemplateAvailabilityProvidersTests { } @Test - public void createWhenClassLoaderIsNullShouldThrowException() throws Exception { + public void createWhenClassLoaderIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("ClassLoader must not be null"); new TemplateAvailabilityProviders((ClassLoader) null); } @Test - public void createWhenUsingClassLoaderShouldLoadProviders() throws Exception { + public void createWhenUsingClassLoaderShouldLoadProviders() { TemplateAvailabilityProviders providers = new TemplateAvailabilityProviders( this.classLoader); assertThat(providers.getProviders()).isNotEmpty(); } @Test - public void createWhenProvidersIsNullShouldThrowException() throws Exception { + public void createWhenProvidersIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Providers must not be null"); new TemplateAvailabilityProviders( @@ -108,22 +107,21 @@ public class TemplateAvailabilityProvidersTests { } @Test - public void createWhenUsingProvidersShouldUseProviders() throws Exception { + public void createWhenUsingProvidersShouldUseProviders() { TemplateAvailabilityProviders providers = new TemplateAvailabilityProviders( Collections.singleton(this.provider)); assertThat(providers.getProviders()).containsOnly(this.provider); } @Test - public void getProviderWhenApplicationContextIsNullShouldThrowException() - throws Exception { + public void getProviderWhenApplicationContextIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("ApplicationContext must not be null"); this.providers.getProvider(this.view, null); } @Test - public void getProviderWhenViewIsNullShouldThrowException() throws Exception { + public void getProviderWhenViewIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("View must not be null"); this.providers.getProvider(null, this.environment, this.classLoader, @@ -131,7 +129,7 @@ public class TemplateAvailabilityProvidersTests { } @Test - public void getProviderWhenEnvironmentIsNullShouldThrowException() throws Exception { + public void getProviderWhenEnvironmentIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Environment must not be null"); this.providers.getProvider(this.view, null, this.classLoader, @@ -139,7 +137,7 @@ public class TemplateAvailabilityProvidersTests { } @Test - public void getProviderWhenClassLoaderIsNullShouldThrowException() throws Exception { + public void getProviderWhenClassLoaderIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("ClassLoader must not be null"); this.providers.getProvider(this.view, this.environment, null, @@ -147,15 +145,14 @@ public class TemplateAvailabilityProvidersTests { } @Test - public void getProviderWhenResourceLoaderIsNullShouldThrowException() - throws Exception { + public void getProviderWhenResourceLoaderIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("ResourceLoader must not be null"); this.providers.getProvider(this.view, this.environment, this.classLoader, null); } @Test - public void getProviderWhenNoneMatchShouldReturnNull() throws Exception { + public void getProviderWhenNoneMatchShouldReturnNull() { TemplateAvailabilityProvider found = this.providers.getProvider(this.view, this.environment, this.classLoader, this.resourceLoader); assertThat(found).isNull(); @@ -164,7 +161,7 @@ public class TemplateAvailabilityProvidersTests { } @Test - public void getProviderWhenMatchShouldReturnProvider() throws Exception { + public void getProviderWhenMatchShouldReturnProvider() { given(this.provider.isTemplateAvailable(this.view, this.environment, this.classLoader, this.resourceLoader)).willReturn(true); TemplateAvailabilityProvider found = this.providers.getProvider(this.view, @@ -174,7 +171,7 @@ public class TemplateAvailabilityProvidersTests { } @Test - public void getProviderShouldCacheMatchResult() throws Exception { + public void getProviderShouldCacheMatchResult() { given(this.provider.isTemplateAvailable(this.view, this.environment, this.classLoader, this.resourceLoader)).willReturn(true); this.providers.getProvider(this.view, this.environment, this.classLoader, @@ -186,7 +183,7 @@ public class TemplateAvailabilityProvidersTests { } @Test - public void getProviderShouldCacheNoMatchResult() throws Exception { + public void getProviderShouldCacheNoMatchResult() { this.providers.getProvider(this.view, this.environment, this.classLoader, this.resourceLoader); this.providers.getProvider(this.view, this.environment, this.classLoader, @@ -196,7 +193,7 @@ public class TemplateAvailabilityProvidersTests { } @Test - public void getProviderWhenCacheDisabledShouldNotUseCache() throws Exception { + public void getProviderWhenCacheDisabledShouldNotUseCache() { given(this.provider.isTemplateAvailable(this.view, this.environment, this.classLoader, this.resourceLoader)).willReturn(true); this.environment.setProperty("spring.template.provider.cache", "false"); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafReactiveAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafReactiveAutoConfigurationTests.java index 058ab89a37..934a7860ae 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafReactiveAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafReactiveAutoConfigurationTests.java @@ -69,7 +69,7 @@ public class ThymeleafReactiveAutoConfigurationTests { } @Test - public void createFromConfigClass() throws Exception { + public void createFromConfigClass() { load(BaseConfiguration.class, "spring.thymeleaf.suffix:.html"); TemplateEngine engine = this.context.getBean(TemplateEngine.class); Context attrs = new Context(Locale.UK, Collections.singletonMap("foo", "bar")); @@ -78,7 +78,7 @@ public class ThymeleafReactiveAutoConfigurationTests { } @Test - public void overrideCharacterEncoding() throws Exception { + public void overrideCharacterEncoding() { load(BaseConfiguration.class, "spring.thymeleaf.encoding:UTF-16"); ITemplateResolver resolver = this.context.getBean(ITemplateResolver.class); assertThat(resolver instanceof SpringResourceTemplateResolver).isTrue(); @@ -90,7 +90,7 @@ public class ThymeleafReactiveAutoConfigurationTests { } @Test - public void overrideMediaTypes() throws Exception { + public void overrideMediaTypes() { load(BaseConfiguration.class, "spring.thymeleaf.reactive.media-types:text/html,text/plain"); ThymeleafReactiveViewResolver views = this.context @@ -100,14 +100,14 @@ public class ThymeleafReactiveAutoConfigurationTests { } @Test - public void overrideTemplateResolverOrder() throws Exception { + public void overrideTemplateResolverOrder() { load(BaseConfiguration.class, "spring.thymeleaf.templateResolverOrder:25"); ITemplateResolver resolver = this.context.getBean(ITemplateResolver.class); assertThat(resolver.getOrder()).isEqualTo(Integer.valueOf(25)); } @Test - public void overrideViewNames() throws Exception { + public void overrideViewNames() { load(BaseConfiguration.class, "spring.thymeleaf.viewNames:foo,bar"); ThymeleafReactiveViewResolver views = this.context .getBean(ThymeleafReactiveViewResolver.class); @@ -115,7 +115,7 @@ public class ThymeleafReactiveAutoConfigurationTests { } @Test - public void overrideMaxChunkSize() throws Exception { + public void overrideMaxChunkSize() { load(BaseConfiguration.class, "spring.thymeleaf.reactive.maxChunkSize:8192"); ThymeleafReactiveViewResolver views = this.context .getBean(ThymeleafReactiveViewResolver.class); @@ -123,7 +123,7 @@ public class ThymeleafReactiveAutoConfigurationTests { } @Test - public void overrideFullModeViewNames() throws Exception { + public void overrideFullModeViewNames() { load(BaseConfiguration.class, "spring.thymeleaf.reactive.fullModeViewNames:foo,bar"); ThymeleafReactiveViewResolver views = this.context @@ -132,7 +132,7 @@ public class ThymeleafReactiveAutoConfigurationTests { } @Test - public void overrideChunkedModeViewNames() throws Exception { + public void overrideChunkedModeViewNames() { load(BaseConfiguration.class, "spring.thymeleaf.reactive.chunkedModeViewNames:foo,bar"); ThymeleafReactiveViewResolver views = this.context @@ -156,14 +156,14 @@ public class ThymeleafReactiveAutoConfigurationTests { } @Test - public void templateLocationDoesNotExist() throws Exception { + public void templateLocationDoesNotExist() { load(BaseConfiguration.class, "spring.thymeleaf.prefix:classpath:/no-such-directory/"); this.output.expect(containsString("Cannot find template location")); } @Test - public void templateLocationEmpty() throws Exception { + public void templateLocationEmpty() { new File("target/test-classes/templates/empty-directory").mkdir(); load(BaseConfiguration.class, "spring.thymeleaf.prefix:classpath:/templates/empty-directory/"); @@ -171,7 +171,7 @@ public class ThymeleafReactiveAutoConfigurationTests { } @Test - public void useDataDialect() throws Exception { + public void useDataDialect() { load(BaseConfiguration.class); ISpringWebFluxTemplateEngine engine = this.context .getBean(ISpringWebFluxTemplateEngine.class); @@ -181,7 +181,7 @@ public class ThymeleafReactiveAutoConfigurationTests { } @Test - public void useJava8TimeDialect() throws Exception { + public void useJava8TimeDialect() { load(BaseConfiguration.class); ISpringWebFluxTemplateEngine engine = this.context .getBean(ISpringWebFluxTemplateEngine.class); @@ -191,7 +191,7 @@ public class ThymeleafReactiveAutoConfigurationTests { } @Test - public void renderTemplate() throws Exception { + public void renderTemplate() { load(BaseConfiguration.class); ISpringWebFluxTemplateEngine engine = this.context .getBean(ISpringWebFluxTemplateEngine.class); @@ -201,7 +201,7 @@ public class ThymeleafReactiveAutoConfigurationTests { } @Test - public void layoutDialectCanBeCustomized() throws Exception { + public void layoutDialectCanBeCustomized() { load(LayoutDialectConfiguration.class); LayoutDialect layoutDialect = this.context.getBean(LayoutDialect.class); assertThat(ReflectionTestUtils.getField(layoutDialect, "sortingStrategy")) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafServletAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafServletAutoConfigurationTests.java index 9362d91f81..e482fecdce 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafServletAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafServletAutoConfigurationTests.java @@ -77,7 +77,7 @@ public class ThymeleafServletAutoConfigurationTests { } @Test - public void createFromConfigClass() throws Exception { + public void createFromConfigClass() { load(BaseConfiguration.class, "spring.thymeleaf.mode:HTML", "spring.thymeleaf.suffix:"); TemplateEngine engine = this.context.getBean(TemplateEngine.class); @@ -87,7 +87,7 @@ public class ThymeleafServletAutoConfigurationTests { } @Test - public void overrideCharacterEncoding() throws Exception { + public void overrideCharacterEncoding() { load(BaseConfiguration.class, "spring.thymeleaf.encoding:UTF-16"); ITemplateResolver resolver = this.context.getBean(ITemplateResolver.class); assertThat(resolver instanceof SpringResourceTemplateResolver).isTrue(); @@ -99,14 +99,14 @@ public class ThymeleafServletAutoConfigurationTests { } @Test - public void overrideTemplateResolverOrder() throws Exception { + public void overrideTemplateResolverOrder() { load(BaseConfiguration.class, "spring.thymeleaf.templateResolverOrder:25"); ITemplateResolver resolver = this.context.getBean(ITemplateResolver.class); assertThat(resolver.getOrder()).isEqualTo(Integer.valueOf(25)); } @Test - public void overrideViewNames() throws Exception { + public void overrideViewNames() { load(BaseConfiguration.class, "spring.thymeleaf.viewNames:foo,bar"); ThymeleafViewResolver views = this.context.getBean(ThymeleafViewResolver.class); assertThat(views.getViewNames()).isEqualTo(new String[] { "foo", "bar" }); @@ -127,14 +127,14 @@ public class ThymeleafServletAutoConfigurationTests { } @Test - public void templateLocationDoesNotExist() throws Exception { + public void templateLocationDoesNotExist() { load(BaseConfiguration.class, "spring.thymeleaf.prefix:classpath:/no-such-directory/"); this.output.expect(containsString("Cannot find template location")); } @Test - public void templateLocationEmpty() throws Exception { + public void templateLocationEmpty() { new File("target/test-classes/templates/empty-directory").mkdir(); load(BaseConfiguration.class, "spring.thymeleaf.prefix:classpath:/templates/empty-directory/"); @@ -161,7 +161,7 @@ public class ThymeleafServletAutoConfigurationTests { } @Test - public void useDataDialect() throws Exception { + public void useDataDialect() { load(BaseConfiguration.class); TemplateEngine engine = this.context.getBean(TemplateEngine.class); Context attrs = new Context(Locale.UK, Collections.singletonMap("foo", "bar")); @@ -170,7 +170,7 @@ public class ThymeleafServletAutoConfigurationTests { } @Test - public void useJava8TimeDialect() throws Exception { + public void useJava8TimeDialect() { load(BaseConfiguration.class); TemplateEngine engine = this.context.getBean(TemplateEngine.class); Context attrs = new Context(Locale.UK); @@ -179,7 +179,7 @@ public class ThymeleafServletAutoConfigurationTests { } @Test - public void renderTemplate() throws Exception { + public void renderTemplate() { load(BaseConfiguration.class); TemplateEngine engine = this.context.getBean(TemplateEngine.class); Context attrs = new Context(Locale.UK, Collections.singletonMap("foo", "bar")); @@ -188,7 +188,7 @@ public class ThymeleafServletAutoConfigurationTests { } @Test - public void renderNonWebAppTemplate() throws Exception { + public void renderNonWebAppTemplate() { try (AnnotationConfigApplicationContext customContext = new AnnotationConfigApplicationContext( ThymeleafAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class)) { @@ -203,21 +203,20 @@ public class ThymeleafServletAutoConfigurationTests { } @Test - public void registerResourceHandlingFilterDisabledByDefault() throws Exception { + public void registerResourceHandlingFilterDisabledByDefault() { load(BaseConfiguration.class); assertThat(this.context.getBeansOfType(ResourceUrlEncodingFilter.class)) .isEmpty(); } @Test - public void registerResourceHandlingFilterOnlyIfResourceChainIsEnabled() - throws Exception { + public void registerResourceHandlingFilterOnlyIfResourceChainIsEnabled() { load(BaseConfiguration.class, "spring.resources.chain.enabled:true"); assertThat(this.context.getBean(ResourceUrlEncodingFilter.class)).isNotNull(); } @Test - public void layoutDialectCanBeCustomized() throws Exception { + public void layoutDialectCanBeCustomized() { load(LayoutDialectConfiguration.class); LayoutDialect layoutDialect = this.context.getBean(LayoutDialect.class); assertThat(ReflectionTestUtils.getField(layoutDialect, "sortingStrategy")) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/transaction/TransactionAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/transaction/TransactionAutoConfigurationTests.java index e5932698ab..5323ebed76 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/transaction/TransactionAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/transaction/TransactionAutoConfigurationTests.java @@ -95,7 +95,7 @@ public class TransactionAutoConfigurationTests { } @Test - public void platformTransactionManagerCustomizers() throws Exception { + public void platformTransactionManagerCustomizers() { load(SeveralTransactionManagersConfiguration.class); TransactionManagerCustomizers customizers = this.context .getBean(TransactionManagerCustomizers.class); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/transaction/TransactionManagerCustomizersTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/transaction/TransactionManagerCustomizersTests.java index 3124aaefaf..c350434370 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/transaction/TransactionManagerCustomizersTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/transaction/TransactionManagerCustomizersTests.java @@ -35,13 +35,13 @@ import static org.mockito.Mockito.mock; public class TransactionManagerCustomizersTests { @Test - public void customizeWithNullCustomizersShouldDoNothing() throws Exception { + public void customizeWithNullCustomizersShouldDoNothing() { new TransactionManagerCustomizers(null) .customize(mock(PlatformTransactionManager.class)); } @Test - public void customizeShouldCheckGeneric() throws Exception { + public void customizeShouldCheckGeneric() { List> list = new ArrayList<>(); list.add(new TestCustomizer<>()); list.add(new TestJtaCustomizer()); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/transaction/jta/JtaAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/transaction/jta/JtaAutoConfigurationTests.java index e122066eba..2c00326c80 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/transaction/jta/JtaAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/transaction/jta/JtaAutoConfigurationTests.java @@ -95,7 +95,7 @@ public class JtaAutoConfigurationTests { } @Test - public void customPlatformTransactionManager() throws Exception { + public void customPlatformTransactionManager() { this.context = new AnnotationConfigApplicationContext( CustomTransactionManagerConfig.class, JtaAutoConfiguration.class); this.thrown.expect(NoSuchBeanDefinitionException.class); @@ -115,7 +115,7 @@ public class JtaAutoConfigurationTests { } @Test - public void atomikosSanityCheck() throws Exception { + public void atomikosSanityCheck() { this.context = new AnnotationConfigApplicationContext(JtaProperties.class, AtomikosJtaConfiguration.class); this.context.getBean(AtomikosProperties.class); @@ -129,7 +129,7 @@ public class JtaAutoConfigurationTests { } @Test - public void bitronixSanityCheck() throws Exception { + public void bitronixSanityCheck() { this.context = new AnnotationConfigApplicationContext(JtaProperties.class, BitronixJtaConfiguration.class); this.context.getBean(bitronix.tm.Configuration.class); @@ -141,7 +141,7 @@ public class JtaAutoConfigurationTests { } @Test - public void narayanaSanityCheck() throws Exception { + public void narayanaSanityCheck() { this.context = new AnnotationConfigApplicationContext(JtaProperties.class, NarayanaJtaConfiguration.class); this.context.getBean(NarayanaConfigurationBean.class); @@ -164,7 +164,7 @@ public class JtaAutoConfigurationTests { } @Test - public void customBitronixServerId() throws UnknownHostException { + public void customBitronixServerId() { this.context = new AnnotationConfigApplicationContext(); TestPropertyValues.of("spring.jta.transactionManagerId:custom") .applyTo(this.context); @@ -177,7 +177,7 @@ public class JtaAutoConfigurationTests { } @Test - public void defaultAtomikosTransactionManagerName() throws UnknownHostException { + public void defaultAtomikosTransactionManagerName() { this.context = new AnnotationConfigApplicationContext(); TestPropertyValues.of("spring.jta.logDir:target/transaction-logs") .applyTo(this.context); @@ -254,7 +254,7 @@ public class JtaAutoConfigurationTests { } @Test - public void atomikosCustomizeJtaTransactionManagerUsingProperties() throws Exception { + public void atomikosCustomizeJtaTransactionManagerUsingProperties() { this.context = new AnnotationConfigApplicationContext(); TestPropertyValues .of("spring.transaction.default-timeout:30", @@ -270,7 +270,7 @@ public class JtaAutoConfigurationTests { } @Test - public void bitronixCustomizeJtaTransactionManagerUsingProperties() throws Exception { + public void bitronixCustomizeJtaTransactionManagerUsingProperties() { this.context = new AnnotationConfigApplicationContext(); TestPropertyValues .of("spring.transaction.default-timeout:30", diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java index 8a2870dc75..19cad45ae0 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java @@ -55,45 +55,45 @@ public class ServerPropertiesTests { } @Test - public void testPortBinding() throws Exception { + public void testPortBinding() { bind("server.port", "9000"); assertThat(this.properties.getPort().intValue()).isEqualTo(9000); } @Test - public void testServerHeaderDefault() throws Exception { + public void testServerHeaderDefault() { assertThat(this.properties.getServerHeader()).isNull(); } @Test - public void testServerHeader() throws Exception { + public void testServerHeader() { bind("server.server-header", "Custom Server"); assertThat(this.properties.getServerHeader()).isEqualTo("Custom Server"); } @Test - public void testConnectionTimeout() throws Exception { + public void testConnectionTimeout() { bind("server.connection-timeout", "60s"); assertThat(this.properties.getConnectionTimeout()) .isEqualTo(Duration.ofMillis(60000)); } @Test - public void testServletPathAsMapping() throws Exception { + public void testServletPathAsMapping() { bind("server.servlet.path", "/foo/*"); assertThat(this.properties.getServlet().getServletMapping()).isEqualTo("/foo/*"); assertThat(this.properties.getServlet().getServletPrefix()).isEqualTo("/foo"); } @Test - public void testServletPathAsPrefix() throws Exception { + public void testServletPathAsPrefix() { bind("server.servlet.path", "/foo"); assertThat(this.properties.getServlet().getServletMapping()).isEqualTo("/foo/*"); assertThat(this.properties.getServlet().getServletPrefix()).isEqualTo("/foo"); } @Test - public void testTomcatBinding() throws Exception { + public void testTomcatBinding() { Map map = new HashMap<>(); map.put("server.tomcat.accesslog.pattern", "%h %t '%r' %s %b"); map.put("server.tomcat.accesslog.prefix", "foo"); @@ -122,7 +122,7 @@ public class ServerPropertiesTests { } @Test - public void redirectContextRootIsNotConfiguredByDefault() throws Exception { + public void redirectContextRootIsNotConfiguredByDefault() { bind(new HashMap<>()); ServerProperties.Tomcat tomcat = this.properties.getTomcat(); assertThat(tomcat.getRedirectContextRoot()).isNull(); @@ -141,32 +141,32 @@ public class ServerPropertiesTests { } @Test - public void testCustomizeUriEncoding() throws Exception { + public void testCustomizeUriEncoding() { bind("server.tomcat.uri-encoding", "US-ASCII"); assertThat(this.properties.getTomcat().getUriEncoding()) .isEqualTo(StandardCharsets.US_ASCII); } @Test - public void testCustomizeHeaderSize() throws Exception { + public void testCustomizeHeaderSize() { bind("server.max-http-header-size", "9999"); assertThat(this.properties.getMaxHttpHeaderSize()).isEqualTo(9999); } @Test - public void testCustomizeJettyAcceptors() throws Exception { + public void testCustomizeJettyAcceptors() { bind("server.jetty.acceptors", "10"); assertThat(this.properties.getJetty().getAcceptors()).isEqualTo(10); } @Test - public void testCustomizeJettySelectors() throws Exception { + public void testCustomizeJettySelectors() { bind("server.jetty.selectors", "10"); assertThat(this.properties.getJetty().getSelectors()).isEqualTo(10); } @Test - public void testCustomizeJettyAccessLog() throws Exception { + public void testCustomizeJettyAccessLog() { Map map = new HashMap<>(); map.put("server.jetty.accesslog.enabled", "true"); map.put("server.jetty.accesslog.filename", "foo.txt"); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/client/RestTemplateAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/client/RestTemplateAutoConfigurationTests.java index b7749e088b..db0135f2a6 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/client/RestTemplateAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/client/RestTemplateAutoConfigurationTests.java @@ -99,7 +99,7 @@ public class RestTemplateAutoConfigurationTests { } @Test - public void restTemplateShouldApplyCustomizer() throws Exception { + public void restTemplateShouldApplyCustomizer() { load(RestTemplateCustomizerConfig.class, RestTemplateConfig.class); RestTemplate restTemplate = this.context.getBean(RestTemplate.class); RestTemplateCustomizer customizer = this.context @@ -108,7 +108,7 @@ public class RestTemplateAutoConfigurationTests { } @Test - public void builderShouldBeFreshForEachUse() throws Exception { + public void builderShouldBeFreshForEachUse() { load(DirtyRestTemplateConfig.class); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/DefaultReactiveWebServerCustomizerTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/DefaultReactiveWebServerCustomizerTests.java index 5448297c98..ebdb02e239 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/DefaultReactiveWebServerCustomizerTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/DefaultReactiveWebServerCustomizerTests.java @@ -39,12 +39,12 @@ public class DefaultReactiveWebServerCustomizerTests { private DefaultReactiveWebServerCustomizer customizer; @Before - public void setup() throws Exception { + public void setup() { this.customizer = new DefaultReactiveWebServerCustomizer(this.properties); } @Test - public void testCustomizeServerPort() throws Exception { + public void testCustomizeServerPort() { ConfigurableReactiveWebServerFactory factory = mock( ConfigurableReactiveWebServerFactory.class); this.properties.setPort(9000); @@ -53,7 +53,7 @@ public class DefaultReactiveWebServerCustomizerTests { } @Test - public void testCustomizeServerAddress() throws Exception { + public void testCustomizeServerAddress() { ConfigurableReactiveWebServerFactory factory = mock( ConfigurableReactiveWebServerFactory.class); InetAddress address = mock(InetAddress.class); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/WebFluxAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/WebFluxAutoConfigurationTests.java index 0cf8775409..f7d3af48ab 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/WebFluxAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/WebFluxAutoConfigurationTests.java @@ -75,7 +75,7 @@ public class WebFluxAutoConfigurationTests { private AnnotationConfigReactiveWebApplicationContext context; @Test - public void shouldNotProcessIfExistingWebReactiveConfiguration() throws Exception { + public void shouldNotProcessIfExistingWebReactiveConfiguration() { load(WebFluxConfigurationSupport.class); assertThat(this.context.getBeansOfType(RequestMappingHandlerMapping.class).size()) .isEqualTo(1); @@ -84,7 +84,7 @@ public class WebFluxAutoConfigurationTests { } @Test - public void shouldCreateDefaultBeans() throws Exception { + public void shouldCreateDefaultBeans() { load(); assertThat(this.context.getBeansOfType(RequestMappingHandlerMapping.class).size()) .isEqualTo(1); @@ -98,7 +98,7 @@ public class WebFluxAutoConfigurationTests { @SuppressWarnings("unchecked") @Test - public void shouldRegisterCustomHandlerMethodArgumentResolver() throws Exception { + public void shouldRegisterCustomHandlerMethodArgumentResolver() { load(CustomArgumentResolvers.class); RequestMappingHandlerAdapter adapter = this.context .getBean(RequestMappingHandlerAdapter.class); @@ -112,7 +112,7 @@ public class WebFluxAutoConfigurationTests { } @Test - public void shouldCustomizeCodecs() throws Exception { + public void shouldCustomizeCodecs() { load(CustomCodecCustomizers.class); CodecCustomizer codecCustomizer = this.context.getBean("firstCodecCustomizer", CodecCustomizer.class); @@ -121,7 +121,7 @@ public class WebFluxAutoConfigurationTests { } @Test - public void shouldRegisterResourceHandlerMapping() throws Exception { + public void shouldRegisterResourceHandlerMapping() { load(); SimpleUrlHandlerMapping hm = this.context.getBean("resourceHandlerMapping", SimpleUrlHandlerMapping.class); @@ -138,7 +138,7 @@ public class WebFluxAutoConfigurationTests { } @Test - public void shouldMapResourcesToCustomPath() throws Exception { + public void shouldMapResourcesToCustomPath() { load("spring.webflux.static-path-pattern:/static/**"); SimpleUrlHandlerMapping hm = this.context.getBean("resourceHandlerMapping", SimpleUrlHandlerMapping.class); @@ -150,14 +150,14 @@ public class WebFluxAutoConfigurationTests { } @Test - public void shouldNotMapResourcesWhenDisabled() throws Exception { + public void shouldNotMapResourcesWhenDisabled() { load("spring.resources.add-mappings:false"); assertThat(this.context.getBean("resourceHandlerMapping")) .isNotInstanceOf(SimpleUrlHandlerMapping.class); } @Test - public void resourceHandlerChainEnabled() throws Exception { + public void resourceHandlerChainEnabled() { load("spring.resources.chain.enabled:true"); SimpleUrlHandlerMapping hm = this.context.getBean("resourceHandlerMapping", SimpleUrlHandlerMapping.class); @@ -170,7 +170,7 @@ public class WebFluxAutoConfigurationTests { } @Test - public void shouldRegisterViewResolvers() throws Exception { + public void shouldRegisterViewResolvers() { load(ViewResolvers.class); ViewResolutionResultHandler resultHandler = this.context .getBean(ViewResolutionResultHandler.class); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorAttributesTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorAttributesTests.java index 2439a6aed8..2f37dcf922 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorAttributesTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorAttributesTests.java @@ -61,7 +61,7 @@ public class DefaultErrorAttributesTests { .getReaders(); @Test - public void missingExceptionAttribute() throws Exception { + public void missingExceptionAttribute() { this.thrown.expect(IllegalStateException.class); this.thrown.expectMessage("Missing exception attribute in ServerWebExchange"); MockServerWebExchange exchange = MockServerWebExchange @@ -71,7 +71,7 @@ public class DefaultErrorAttributesTests { } @Test - public void includeTimeStamp() throws Exception { + public void includeTimeStamp() { MockServerHttpRequest request = MockServerHttpRequest.get("/test").build(); Map attributes = this.errorAttributes .getErrorAttributes(buildServerRequest(request, NOT_FOUND), false); @@ -79,7 +79,7 @@ public class DefaultErrorAttributesTests { } @Test - public void defaultStatusCode() throws Exception { + public void defaultStatusCode() { Error error = new OutOfMemoryError("Test error"); MockServerHttpRequest request = MockServerHttpRequest.get("/test").build(); Map attributes = this.errorAttributes @@ -90,7 +90,7 @@ public class DefaultErrorAttributesTests { } @Test - public void includeStatusCode() throws Exception { + public void includeStatusCode() { MockServerHttpRequest request = MockServerHttpRequest.get("/test").build(); Map attributes = this.errorAttributes .getErrorAttributes(buildServerRequest(request, NOT_FOUND), false); @@ -100,7 +100,7 @@ public class DefaultErrorAttributesTests { } @Test - public void getError() throws Exception { + public void getError() { Error error = new OutOfMemoryError("Test error"); MockServerHttpRequest request = MockServerHttpRequest.get("/test").build(); ServerRequest serverRequest = buildServerRequest(request, error); @@ -112,7 +112,7 @@ public class DefaultErrorAttributesTests { } @Test - public void includeException() throws Exception { + public void includeException() { RuntimeException error = new RuntimeException("Test"); this.errorAttributes = new DefaultErrorAttributes(true); MockServerHttpRequest request = MockServerHttpRequest.get("/test").build(); @@ -126,7 +126,7 @@ public class DefaultErrorAttributesTests { } @Test - public void notIncludeTrace() throws Exception { + public void notIncludeTrace() { RuntimeException ex = new RuntimeException("Test"); MockServerHttpRequest request = MockServerHttpRequest.get("/test").build(); Map attributes = this.errorAttributes @@ -135,7 +135,7 @@ public class DefaultErrorAttributesTests { } @Test - public void includeTrace() throws Exception { + public void includeTrace() { RuntimeException ex = new RuntimeException("Test"); MockServerHttpRequest request = MockServerHttpRequest.get("/test").build(); Map attributes = this.errorAttributes @@ -144,7 +144,7 @@ public class DefaultErrorAttributesTests { } @Test - public void includePath() throws Exception { + public void includePath() { MockServerHttpRequest request = MockServerHttpRequest.get("/test").build(); Map attributes = this.errorAttributes .getErrorAttributes(buildServerRequest(request, NOT_FOUND), false); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/function/client/WebClientAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/function/client/WebClientAutoConfigurationTests.java index 7e8df62961..94c2d5bc95 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/function/client/WebClientAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/function/client/WebClientAutoConfigurationTests.java @@ -58,7 +58,7 @@ public class WebClientAutoConfigurationTests { } @Test - public void shouldCustomizeClientCodecs() throws Exception { + public void shouldCustomizeClientCodecs() { load(CodecConfiguration.class); WebClient.Builder builder = this.context.getBean(WebClient.Builder.class); CodecCustomizer codecCustomizer = this.context.getBean(CodecCustomizer.class); @@ -70,7 +70,7 @@ public class WebClientAutoConfigurationTests { } @Test - public void webClientShouldApplyCustomizers() throws Exception { + public void webClientShouldApplyCustomizers() { load(WebClientCustomizerConfig.class); WebClient.Builder builder = this.context.getBean(WebClient.Builder.class); WebClientCustomizer customizer = this.context.getBean(WebClientCustomizer.class); @@ -79,7 +79,7 @@ public class WebClientAutoConfigurationTests { } @Test - public void shouldGetPrototypeScopedBean() throws Exception { + public void shouldGetPrototypeScopedBean() { load(WebClientCustomizerConfig.class); ClientHttpResponse response = mock(ClientHttpResponse.class); ClientHttpConnector firstConnector = mock(ClientHttpConnector.class); @@ -105,7 +105,7 @@ public class WebClientAutoConfigurationTests { } @Test - public void shouldNotCreateClientBuilderIfAlreadyPresent() throws Exception { + public void shouldNotCreateClientBuilderIfAlreadyPresent() { load(WebClientCustomizerConfig.class, CustomWebClientBuilderConfig.class); WebClient.Builder builder = this.context.getBean(WebClient.Builder.class); assertThat(builder).isInstanceOf(MyWebClientBuilder.class); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/DefaultServletWebServerFactoryCustomizerTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/DefaultServletWebServerFactoryCustomizerTests.java index bc3e6868c5..86326d599e 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/DefaultServletWebServerFactoryCustomizerTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/DefaultServletWebServerFactoryCustomizerTests.java @@ -83,7 +83,7 @@ public class DefaultServletWebServerFactoryCustomizerTests { private ArgumentCaptor initializersCaptor; @Before - public void setup() throws Exception { + public void setup() { MockitoAnnotations.initMocks(this); this.customizer = new DefaultServletWebServerFactoryCustomizer(this.properties); } @@ -153,7 +153,7 @@ public class DefaultServletWebServerFactoryCustomizerTests { } @Test - public void redirectContextRootCanBeConfigured() throws Exception { + public void redirectContextRootCanBeConfigured() { Map map = new HashMap<>(); map.put("server.tomcat.redirect-context-root", "false"); bindProperties(map); @@ -185,7 +185,7 @@ public class DefaultServletWebServerFactoryCustomizerTests { } @Test - public void testCustomizeTomcat() throws Exception { + public void testCustomizeTomcat() { ConfigurableServletWebServerFactory factory = mock( ConfigurableServletWebServerFactory.class); this.customizer.customize(factory); @@ -193,7 +193,7 @@ public class DefaultServletWebServerFactoryCustomizerTests { } @Test - public void testDefaultDisplayName() throws Exception { + public void testDefaultDisplayName() { ConfigurableServletWebServerFactory factory = mock( ConfigurableServletWebServerFactory.class); this.customizer.customize(factory); @@ -201,7 +201,7 @@ public class DefaultServletWebServerFactoryCustomizerTests { } @Test - public void testCustomizeDisplayName() throws Exception { + public void testCustomizeDisplayName() { ConfigurableServletWebServerFactory factory = mock( ConfigurableServletWebServerFactory.class); this.properties.setDisplayName("TestName"); @@ -242,7 +242,7 @@ public class DefaultServletWebServerFactoryCustomizerTests { } @Test - public void testCustomizeTomcatPort() throws Exception { + public void testCustomizeTomcatPort() { ConfigurableServletWebServerFactory factory = mock( ConfigurableServletWebServerFactory.class); this.properties.setPort(8080); @@ -251,7 +251,7 @@ public class DefaultServletWebServerFactoryCustomizerTests { } @Test - public void customizeTomcatDisplayName() throws Exception { + public void customizeTomcatDisplayName() { Map map = new HashMap<>(); map.put("server.display-name", "MyBootApp"); bindProperties(map); @@ -261,7 +261,7 @@ public class DefaultServletWebServerFactoryCustomizerTests { } @Test - public void disableTomcatRemoteIpValve() throws Exception { + public void disableTomcatRemoteIpValve() { Map map = new HashMap<>(); map.put("server.tomcat.remote-ip-header", ""); map.put("server.tomcat.protocol-header", ""); @@ -272,7 +272,7 @@ public class DefaultServletWebServerFactoryCustomizerTests { } @Test - public void defaultTomcatBackgroundProcessorDelay() throws Exception { + public void defaultTomcatBackgroundProcessorDelay() { TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory(); this.customizer.customize(factory); TomcatWebServer webServer = (TomcatWebServer) factory.getWebServer(); @@ -282,7 +282,7 @@ public class DefaultServletWebServerFactoryCustomizerTests { } @Test - public void customTomcatBackgroundProcessorDelay() throws Exception { + public void customTomcatBackgroundProcessorDelay() { Map map = new HashMap<>(); map.put("server.tomcat.background-processor-delay", "5"); bindProperties(map); @@ -295,7 +295,7 @@ public class DefaultServletWebServerFactoryCustomizerTests { } @Test - public void defaultTomcatRemoteIpValve() throws Exception { + public void defaultTomcatRemoteIpValve() { Map map = new HashMap<>(); // Since 1.1.7 you need to specify at least the protocol map.put("server.tomcat.protocol-header", "X-Forwarded-Proto"); @@ -305,14 +305,14 @@ public class DefaultServletWebServerFactoryCustomizerTests { } @Test - public void setUseForwardHeadersTomcat() throws Exception { + public void setUseForwardHeadersTomcat() { // Since 1.3.0 no need to explicitly set header names if use-forward-header=true this.properties.setUseForwardHeaders(true); testRemoteIpValveConfigured(); } @Test - public void deduceUseForwardHeadersTomcat() throws Exception { + public void deduceUseForwardHeadersTomcat() { this.customizer.setEnvironment(new MockEnvironment().withProperty("DYNO", "-")); testRemoteIpValveConfigured(); } @@ -338,7 +338,7 @@ public class DefaultServletWebServerFactoryCustomizerTests { } @Test - public void customTomcatRemoteIpValve() throws Exception { + public void customTomcatRemoteIpValve() { Map map = new HashMap<>(); map.put("server.tomcat.remote-ip-header", "x-my-remote-ip-header"); map.put("server.tomcat.protocol-header", "x-my-protocol-header"); @@ -453,7 +453,7 @@ public class DefaultServletWebServerFactoryCustomizerTests { } @Test - public void testCustomizeTomcatMinSpareThreads() throws Exception { + public void testCustomizeTomcatMinSpareThreads() { Map map = new HashMap<>(); map.put("server.tomcat.min-spare-threads", "10"); bindProperties(map); @@ -486,7 +486,7 @@ public class DefaultServletWebServerFactoryCustomizerTests { } @Test - public void defaultUseForwardHeadersUndertow() throws Exception { + public void defaultUseForwardHeadersUndertow() { UndertowServletWebServerFactory factory = spy( new UndertowServletWebServerFactory()); this.customizer.customize(factory); @@ -494,7 +494,7 @@ public class DefaultServletWebServerFactoryCustomizerTests { } @Test - public void setUseForwardHeadersUndertow() throws Exception { + public void setUseForwardHeadersUndertow() { this.properties.setUseForwardHeaders(true); UndertowServletWebServerFactory factory = spy( new UndertowServletWebServerFactory()); @@ -503,7 +503,7 @@ public class DefaultServletWebServerFactoryCustomizerTests { } @Test - public void deduceUseForwardHeadersUndertow() throws Exception { + public void deduceUseForwardHeadersUndertow() { this.customizer.setEnvironment(new MockEnvironment().withProperty("DYNO", "-")); UndertowServletWebServerFactory factory = spy( new UndertowServletWebServerFactory()); @@ -512,14 +512,14 @@ public class DefaultServletWebServerFactoryCustomizerTests { } @Test - public void defaultUseForwardHeadersJetty() throws Exception { + public void defaultUseForwardHeadersJetty() { JettyServletWebServerFactory factory = spy(new JettyServletWebServerFactory()); this.customizer.customize(factory); verify(factory).setUseForwardHeaders(false); } @Test - public void setUseForwardHeadersJetty() throws Exception { + public void setUseForwardHeadersJetty() { this.properties.setUseForwardHeaders(true); JettyServletWebServerFactory factory = spy(new JettyServletWebServerFactory()); this.customizer.customize(factory); @@ -527,7 +527,7 @@ public class DefaultServletWebServerFactoryCustomizerTests { } @Test - public void deduceUseForwardHeadersJetty() throws Exception { + public void deduceUseForwardHeadersJetty() { this.customizer.setEnvironment(new MockEnvironment().withProperty("DYNO", "-")); JettyServletWebServerFactory factory = spy(new JettyServletWebServerFactory()); this.customizer.customize(factory); @@ -535,7 +535,7 @@ public class DefaultServletWebServerFactoryCustomizerTests { } @Test - public void sessionStoreDir() throws Exception { + public void sessionStoreDir() { Map map = new HashMap<>(); map.put("server.session.store-dir", "myfolder"); bindProperties(map); @@ -613,7 +613,7 @@ public class DefaultServletWebServerFactoryCustomizerTests { } @Test - public void skipNullElementsForUndertow() throws Exception { + public void skipNullElementsForUndertow() { UndertowServletWebServerFactory factory = mock( UndertowServletWebServerFactory.class); this.customizer.customize(factory); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/DispatcherServletAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/DispatcherServletAutoConfigurationTests.java index f7e56b2df1..03d1e5ae27 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/DispatcherServletAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/DispatcherServletAutoConfigurationTests.java @@ -57,7 +57,7 @@ public class DispatcherServletAutoConfigurationTests { } @Test - public void registrationProperties() throws Exception { + public void registrationProperties() { this.context = new AnnotationConfigWebApplicationContext(); this.context.register(DispatcherServletAutoConfiguration.class); this.context.setServletContext(new MockServletContext()); @@ -69,7 +69,7 @@ public class DispatcherServletAutoConfigurationTests { } @Test - public void registrationNonServletBean() throws Exception { + public void registrationNonServletBean() { this.context = new AnnotationConfigWebApplicationContext(); this.context.register(NonServletConfiguration.class, DispatcherServletAutoConfiguration.class); @@ -84,7 +84,7 @@ public class DispatcherServletAutoConfigurationTests { // If a DispatcherServlet instance is registered with a name different // from the default one, we're registering one anyway @Test - public void registrationOverrideWithDispatcherServletWrongName() throws Exception { + public void registrationOverrideWithDispatcherServletWrongName() { this.context = new AnnotationConfigWebApplicationContext(); this.context.register(CustomDispatcherServletWrongName.class, DispatcherServletAutoConfiguration.class); @@ -99,7 +99,7 @@ public class DispatcherServletAutoConfigurationTests { } @Test - public void registrationOverrideWithAutowiredServlet() throws Exception { + public void registrationOverrideWithAutowiredServlet() { this.context = new AnnotationConfigWebApplicationContext(); this.context.register(CustomAutowiredRegistration.class, DispatcherServletAutoConfiguration.class); @@ -114,7 +114,7 @@ public class DispatcherServletAutoConfigurationTests { } @Test - public void servletPath() throws Exception { + public void servletPath() { this.context = new AnnotationConfigWebApplicationContext(); this.context.setServletContext(new MockServletContext()); this.context.register(DispatcherServletAutoConfiguration.class); @@ -128,7 +128,7 @@ public class DispatcherServletAutoConfigurationTests { } @Test - public void multipartConfig() throws Exception { + public void multipartConfig() { this.context = new AnnotationConfigWebApplicationContext(); this.context.setServletContext(new MockServletContext()); this.context.register(MultipartConfiguration.class, @@ -140,7 +140,7 @@ public class DispatcherServletAutoConfigurationTests { } @Test - public void renamesMultipartResolver() throws Exception { + public void renamesMultipartResolver() { this.context = new AnnotationConfigWebApplicationContext(); this.context.setServletContext(new MockServletContext()); this.context.register(MultipartResolverConfiguration.class, diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/HttpEncodingAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/HttpEncodingAutoConfigurationTests.java index f3a7468c1e..cc65700888 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/HttpEncodingAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/HttpEncodingAutoConfigurationTests.java @@ -98,7 +98,7 @@ public class HttpEncodingAutoConfigurationTests { } @Test - public void forceRequest() throws Exception { + public void forceRequest() { load(EmptyConfiguration.class, "spring.http.encoding.force-request:false"); CharacterEncodingFilter filter = this.context .getBean(CharacterEncodingFilter.class); @@ -106,7 +106,7 @@ public class HttpEncodingAutoConfigurationTests { } @Test - public void forceResponse() throws Exception { + public void forceResponse() { load(EmptyConfiguration.class, "spring.http.encoding.force-response:true"); CharacterEncodingFilter filter = this.context .getBean(CharacterEncodingFilter.class); @@ -114,7 +114,7 @@ public class HttpEncodingAutoConfigurationTests { } @Test - public void forceRequestOverridesForce() throws Exception { + public void forceRequestOverridesForce() { load(EmptyConfiguration.class, "spring.http.encoding.force:true", "spring.http.encoding.force-request:false"); CharacterEncodingFilter filter = this.context @@ -123,7 +123,7 @@ public class HttpEncodingAutoConfigurationTests { } @Test - public void forceResponseOverridesForce() throws Exception { + public void forceResponseOverridesForce() { load(EmptyConfiguration.class, "spring.http.encoding.force:true", "spring.http.encoding.force-response:false"); CharacterEncodingFilter filter = this.context @@ -132,7 +132,7 @@ public class HttpEncodingAutoConfigurationTests { } @Test - public void filterIsOrderedHighest() throws Exception { + public void filterIsOrderedHighest() { load(OrderedConfiguration.class); List beans = new ArrayList<>( this.context.getBeansOfType(Filter.class).values()); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/MultipartAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/MultipartAutoConfigurationTests.java index 4d65282a82..c35e95add4 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/MultipartAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/MultipartAutoConfigurationTests.java @@ -131,7 +131,7 @@ public class MultipartAutoConfigurationTests { } @Test - public void webServerWithAutomatedMultipartTomcatConfiguration() throws Exception { + public void webServerWithAutomatedMultipartTomcatConfiguration() { this.context = new AnnotationConfigServletWebServerApplicationContext( WebServerWithEverythingTomcat.class, BaseConfiguration.class); new RestTemplate().getForObject( @@ -177,7 +177,7 @@ public class MultipartAutoConfigurationTests { } @Test - public void webServerWithCustomMultipartResolver() throws Exception { + public void webServerWithCustomMultipartResolver() { this.context = new AnnotationConfigServletWebServerApplicationContext( WebServerWithCustomMultipartResolver.class, BaseConfiguration.class); MultipartResolver multipartResolver = this.context diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/ServletWebServerFactoryAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/ServletWebServerFactoryAutoConfigurationTests.java index 9531d00e0b..c79650b0e7 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/ServletWebServerFactoryAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/ServletWebServerFactoryAutoConfigurationTests.java @@ -53,21 +53,21 @@ public class ServletWebServerFactoryAutoConfigurationTests { private AnnotationConfigServletWebServerApplicationContext context; @Test - public void createFromConfigClass() throws Exception { + public void createFromConfigClass() { this.context = new AnnotationConfigServletWebServerApplicationContext( BaseConfiguration.class); verifyContext(); } @Test - public void contextAlreadyHasDispatcherServletWithDefaultName() throws Exception { + public void contextAlreadyHasDispatcherServletWithDefaultName() { this.context = new AnnotationConfigServletWebServerApplicationContext( DispatcherServletConfiguration.class, BaseConfiguration.class); verifyContext(); } @Test - public void contextAlreadyHasDispatcherServlet() throws Exception { + public void contextAlreadyHasDispatcherServlet() { this.context = new AnnotationConfigServletWebServerApplicationContext( SpringServletConfiguration.class, BaseConfiguration.class); verifyContext(); @@ -76,7 +76,7 @@ public class ServletWebServerFactoryAutoConfigurationTests { } @Test - public void contextAlreadyHasNonDispatcherServlet() throws Exception { + public void contextAlreadyHasNonDispatcherServlet() { this.context = new AnnotationConfigServletWebServerApplicationContext( NonSpringServletConfiguration.class, BaseConfiguration.class); verifyContext(); // the non default servlet is still registered @@ -85,7 +85,7 @@ public class ServletWebServerFactoryAutoConfigurationTests { } @Test - public void contextAlreadyHasNonServlet() throws Exception { + public void contextAlreadyHasNonServlet() { this.context = new AnnotationConfigServletWebServerApplicationContext( NonServletConfiguration.class, BaseConfiguration.class); assertThat(this.context.getBeanNamesForType(DispatcherServlet.class).length) @@ -94,7 +94,7 @@ public class ServletWebServerFactoryAutoConfigurationTests { } @Test - public void contextAlreadyHasDispatcherServletAndRegistration() throws Exception { + public void contextAlreadyHasDispatcherServletAndRegistration() { this.context = new AnnotationConfigServletWebServerApplicationContext( DispatcherServletWithRegistrationConfiguration.class, BaseConfiguration.class); @@ -104,14 +104,14 @@ public class ServletWebServerFactoryAutoConfigurationTests { } @Test - public void webServerHasNoServletContext() throws Exception { + public void webServerHasNoServletContext() { this.context = new AnnotationConfigServletWebServerApplicationContext( EnsureWebServerHasNoServletContext.class, BaseConfiguration.class); verifyContext(); } @Test - public void customizeWebServerFactoryThroughCallback() throws Exception { + public void customizeWebServerFactoryThroughCallback() { this.context = new AnnotationConfigServletWebServerApplicationContext( CallbackEmbeddedServerFactoryCustomizer.class, BaseConfiguration.class); verifyContext(); @@ -192,7 +192,7 @@ public class ServletWebServerFactoryAutoConfigurationTests { return new FrameworkServlet() { @Override protected void doService(HttpServletRequest request, - HttpServletResponse response) throws Exception { + HttpServletResponse response) { } }; } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfigurationTests.java index aacbd0e375..537ea4275c 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfigurationTests.java @@ -162,7 +162,7 @@ public class WebMvcAutoConfigurationTests { } @Test - public void resourceHandlerMappingOverrideWebjars() throws Exception { + public void resourceHandlerMappingOverrideWebjars() { this.contextRunner.withUserConfiguration(WebJars.class).run((context) -> { Map> locations = getResourceMappingLocations(context); assertThat(locations.get("/webjars/**")).hasSize(1); @@ -172,7 +172,7 @@ public class WebMvcAutoConfigurationTests { } @Test - public void resourceHandlerMappingOverrideAll() throws Exception { + public void resourceHandlerMappingOverrideAll() { this.contextRunner.withUserConfiguration(AllResources.class).run((context) -> { Map> locations = getResourceMappingLocations(context); assertThat(locations.get("/**")).hasSize(1); @@ -182,7 +182,7 @@ public class WebMvcAutoConfigurationTests { } @Test - public void resourceHandlerMappingDisabled() throws Exception { + public void resourceHandlerMappingDisabled() { this.contextRunner.withPropertyValues("spring.resources.add-mappings:false") .run((context) -> { Map> locations = getResourceMappingLocations( @@ -192,7 +192,7 @@ public class WebMvcAutoConfigurationTests { } @Test - public void resourceHandlerChainEnabled() throws Exception { + public void resourceHandlerChainEnabled() { this.contextRunner.withPropertyValues("spring.resources.chain.enabled:true") .run((context) -> { assertThat(getResourceResolvers(context, "/webjars/**")).hasSize(2); @@ -209,7 +209,7 @@ public class WebMvcAutoConfigurationTests { } @Test - public void resourceHandlerFixedStrategyEnabled() throws Exception { + public void resourceHandlerFixedStrategyEnabled() { this.contextRunner .withPropertyValues("spring.resources.chain.strategy.fixed.enabled:true", "spring.resources.chain.strategy.fixed.version:test", @@ -235,7 +235,7 @@ public class WebMvcAutoConfigurationTests { } @Test - public void resourceHandlerContentStrategyEnabled() throws Exception { + public void resourceHandlerContentStrategyEnabled() { this.contextRunner .withPropertyValues( "spring.resources.chain.strategy.content.enabled:true", @@ -294,13 +294,13 @@ public class WebMvcAutoConfigurationTests { } @Test - public void noLocaleResolver() throws Exception { + public void noLocaleResolver() { this.contextRunner.run( (context) -> assertThat(context).doesNotHaveBean(LocaleResolver.class)); } @Test - public void overrideLocale() throws Exception { + public void overrideLocale() { this.contextRunner.withPropertyValues("spring.mvc.locale:en_UK", "spring.mvc.locale-resolver=fixed").run((loader) -> { // mock request and set user preferred locale @@ -413,7 +413,7 @@ public class WebMvcAutoConfigurationTests { } @Test - public void customContentNegotiatingViewResolver() throws Exception { + public void customContentNegotiatingViewResolver() { this.contextRunner .withUserConfiguration(CustomContentNegotiatingViewResolver.class) .run((context) -> assertThat(context) @@ -443,7 +443,7 @@ public class WebMvcAutoConfigurationTests { } @Test - public void faviconMappingDisabled() throws IllegalAccessException { + public void faviconMappingDisabled() { this.contextRunner.withPropertyValues("spring.mvc.favicon.enabled:false") .run((context) -> { assertThat(context).getBeans(ResourceHttpRequestHandler.class) @@ -454,14 +454,14 @@ public class WebMvcAutoConfigurationTests { } @Test - public void defaultAsyncRequestTimeout() throws Exception { + public void defaultAsyncRequestTimeout() { this.contextRunner.run((context) -> assertThat(ReflectionTestUtils.getField( context.getBean(RequestMappingHandlerAdapter.class), "asyncRequestTimeout")).isNull()); } @Test - public void customAsyncRequestTimeout() throws Exception { + public void customAsyncRequestTimeout() { this.contextRunner.withPropertyValues("spring.mvc.async.request-timeout:12345") .run((context) -> assertThat(ReflectionTestUtils.getField( context.getBean(RequestMappingHandlerAdapter.class), @@ -469,7 +469,7 @@ public class WebMvcAutoConfigurationTests { } @Test - public void customMediaTypes() throws Exception { + public void customMediaTypes() { this.contextRunner.withPropertyValues("spring.mvc.mediaTypes.yaml:text/yaml") .run((context) -> { RequestMappingHandlerAdapter adapter = context @@ -498,7 +498,7 @@ public class WebMvcAutoConfigurationTests { } @Test - public void httpPutFormContentFilterCanBeDisabled() throws Exception { + public void httpPutFormContentFilterCanBeDisabled() { this.contextRunner .withPropertyValues("spring.mvc.formcontent.putfilter.enabled=false") .run((context) -> assertThat(context) @@ -710,7 +710,7 @@ public class WebMvcAutoConfigurationTests { } @Test - public void cachePeriod() throws Exception { + public void cachePeriod() { this.contextRunner.withPropertyValues("spring.resources.cache.period:5") .run((context) -> assertCachePeriod(context)); } @@ -731,7 +731,7 @@ public class WebMvcAutoConfigurationTests { } @Test - public void cacheControl() throws Exception { + public void cacheControl() { this.contextRunner .withPropertyValues("spring.resources.cache.cachecontrol.max-age:5", "spring.resources.cache.cachecontrol.proxy-revalidate:true") @@ -760,7 +760,7 @@ public class WebMvcAutoConfigurationTests { } protected Map> getResourceMappingLocations( - ApplicationContext context) throws IllegalAccessException { + ApplicationContext context) { return getMappingLocations( context.getBean("resourceHandlerMapping", HandlerMapping.class)); } @@ -877,7 +877,7 @@ public class WebMvcAutoConfigurationTests { private static class MyViewResolver implements ViewResolver { @Override - public View resolveViewName(String viewName, Locale locale) throws Exception { + public View resolveViewName(String viewName, Locale locale) { return null; } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/WelcomePageHandlerMappingTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/WelcomePageHandlerMappingTests.java index 89d93b071e..f7b814cb6a 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/WelcomePageHandlerMappingTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/WelcomePageHandlerMappingTests.java @@ -96,7 +96,7 @@ public class WelcomePageHandlerMappingTests { } @Test - public void handlesRequestWithEmptyAcceptHeader() throws Exception { + public void handlesRequestWithEmptyAcceptHeader() { this.contextRunner.withUserConfiguration(StaticResourceConfiguration.class) .run((context) -> MockMvcBuilders.webAppContextSetup(context).build() .perform(get("/").header(HttpHeaders.ACCEPT, "")) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/error/BasicErrorControllerIntegrationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/error/BasicErrorControllerIntegrationTests.java index 71bcba7353..87559add99 100755 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/error/BasicErrorControllerIntegrationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/error/BasicErrorControllerIntegrationTests.java @@ -83,7 +83,7 @@ public class BasicErrorControllerIntegrationTests { @Test @SuppressWarnings("rawtypes") - public void testErrorForMachineClient() throws Exception { + public void testErrorForMachineClient() { load(); ResponseEntity entity = new TestRestTemplate() .getForEntity(createUrl("?trace=true"), Map.class); @@ -94,7 +94,7 @@ public class BasicErrorControllerIntegrationTests { @Test @SuppressWarnings("rawtypes") - public void testErrorForMachineClientTraceParamStacktrace() throws Exception { + public void testErrorForMachineClientTraceParamStacktrace() { load("--server.error.include-exception=true", "--server.error.include-stacktrace=on-trace-param"); ResponseEntity entity = new TestRestTemplate() @@ -106,7 +106,7 @@ public class BasicErrorControllerIntegrationTests { @Test @SuppressWarnings("rawtypes") - public void testErrorForMachineClientNoStacktrace() throws Exception { + public void testErrorForMachineClientNoStacktrace() { load("--server.error.include-stacktrace=never"); ResponseEntity entity = new TestRestTemplate() .getForEntity(createUrl("?trace=true"), Map.class); @@ -117,7 +117,7 @@ public class BasicErrorControllerIntegrationTests { @Test @SuppressWarnings("rawtypes") - public void testErrorForMachineClientAlwaysStacktrace() throws Exception { + public void testErrorForMachineClientAlwaysStacktrace() { load("--server.error.include-stacktrace=always"); ResponseEntity entity = new TestRestTemplate() .getForEntity(createUrl("?trace=false"), Map.class); @@ -128,7 +128,7 @@ public class BasicErrorControllerIntegrationTests { @Test @SuppressWarnings("rawtypes") - public void testErrorForAnnotatedException() throws Exception { + public void testErrorForAnnotatedException() { load("--server.error.include-exception=true"); ResponseEntity entity = new TestRestTemplate() .getForEntity(createUrl("/annotated"), Map.class); @@ -139,7 +139,7 @@ public class BasicErrorControllerIntegrationTests { @Test @SuppressWarnings("rawtypes") - public void testErrorForAnnotatedNoReasonException() throws Exception { + public void testErrorForAnnotatedNoReasonException() { load("--server.error.include-exception=true"); ResponseEntity entity = new TestRestTemplate() .getForEntity(createUrl("/annotatedNoReason"), Map.class); @@ -150,7 +150,7 @@ public class BasicErrorControllerIntegrationTests { @Test @SuppressWarnings("rawtypes") - public void testBindingExceptionForMachineClient() throws Exception { + public void testBindingExceptionForMachineClient() { load("--server.error.include-exception=true"); RequestEntity request = RequestEntity.get(URI.create(createUrl("/bind"))) .accept(MediaType.APPLICATION_JSON).build(); @@ -164,7 +164,7 @@ public class BasicErrorControllerIntegrationTests { @Test @SuppressWarnings("rawtypes") - public void testRequestBodyValidationForMachineClient() throws Exception { + public void testRequestBodyValidationForMachineClient() { load("--server.error.include-exception=true"); RequestEntity request = RequestEntity .post(URI.create(createUrl("/bodyValidation"))) @@ -179,7 +179,7 @@ public class BasicErrorControllerIntegrationTests { @Test @SuppressWarnings("rawtypes") - public void testNoExceptionByDefaultForMachineClient() throws Exception { + public void testNoExceptionByDefaultForMachineClient() { load(); RequestEntity request = RequestEntity.get(URI.create(createUrl("/bind"))) .accept(MediaType.APPLICATION_JSON).build(); @@ -189,7 +189,7 @@ public class BasicErrorControllerIntegrationTests { } @Test - public void testConventionTemplateMapping() throws Exception { + public void testConventionTemplateMapping() { load(); RequestEntity request = RequestEntity.get(URI.create(createUrl("/noStorage"))) .accept(MediaType.TEXT_HTML).build(); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/error/DefaultErrorViewResolverTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/error/DefaultErrorViewResolverTests.java index 9664b0fee7..03c8272258 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/error/DefaultErrorViewResolverTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/error/DefaultErrorViewResolverTests.java @@ -86,30 +86,28 @@ public class DefaultErrorViewResolverTests { } @Test - public void createWhenApplicationContextIsNullShouldThrowException() - throws Exception { + public void createWhenApplicationContextIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("ApplicationContext must not be null"); new DefaultErrorViewResolver(null, new ResourceProperties()); } @Test - public void createWhenResourcePropertiesIsNullShouldThrowException() - throws Exception { + public void createWhenResourcePropertiesIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("ResourceProperties must not be null"); new DefaultErrorViewResolver(mock(ApplicationContext.class), null); } @Test - public void resolveWhenNoMatchShouldReturnNull() throws Exception { + public void resolveWhenNoMatchShouldReturnNull() { ModelAndView resolved = this.resolver.resolveErrorView(this.request, HttpStatus.NOT_FOUND, this.model); assertThat(resolved).isNull(); } @Test - public void resolveWhenExactTemplateMatchShouldReturnTemplate() throws Exception { + public void resolveWhenExactTemplateMatchShouldReturnTemplate() { given(this.templateAvailabilityProvider.isTemplateAvailable(eq("error/404"), any(Environment.class), any(ClassLoader.class), any(ResourceLoader.class))).willReturn(true); @@ -124,7 +122,7 @@ public class DefaultErrorViewResolverTests { } @Test - public void resolveWhenSeries5xxTemplateMatchShouldReturnTemplate() throws Exception { + public void resolveWhenSeries5xxTemplateMatchShouldReturnTemplate() { given(this.templateAvailabilityProvider.isTemplateAvailable(eq("error/5xx"), any(Environment.class), any(ClassLoader.class), any(ResourceLoader.class))).willReturn(true); @@ -134,7 +132,7 @@ public class DefaultErrorViewResolverTests { } @Test - public void resolveWhenSeries4xxTemplateMatchShouldReturnTemplate() throws Exception { + public void resolveWhenSeries4xxTemplateMatchShouldReturnTemplate() { given(this.templateAvailabilityProvider.isTemplateAvailable(eq("error/4xx"), any(Environment.class), any(ClassLoader.class), any(ResourceLoader.class))).willReturn(true); @@ -174,8 +172,7 @@ public class DefaultErrorViewResolverTests { } @Test - public void resolveWhenTemplateAndResourceMatchShouldFavorTemplate() - throws Exception { + public void resolveWhenTemplateAndResourceMatchShouldFavorTemplate() { setResourceLocation("/exact"); given(this.templateAvailabilityProvider.isTemplateAvailable(eq("error/404"), any(Environment.class), any(ClassLoader.class), @@ -200,12 +197,12 @@ public class DefaultErrorViewResolverTests { } @Test - public void orderShouldBeLowest() throws Exception { + public void orderShouldBeLowest() { assertThat(this.resolver.getOrder()).isEqualTo(Ordered.LOWEST_PRECEDENCE); } @Test - public void setOrderShouldChangeOrder() throws Exception { + public void setOrderShouldChangeOrder() { this.resolver.setOrder(123); assertThat(this.resolver.getOrder()).isEqualTo(123); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/error/RemappedErrorViewIntegrationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/error/RemappedErrorViewIntegrationTests.java index 8ac1ab35bc..16698fb643 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/error/RemappedErrorViewIntegrationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/error/RemappedErrorViewIntegrationTests.java @@ -57,7 +57,7 @@ public class RemappedErrorViewIntegrationTests { private TestRestTemplate template = new TestRestTemplate(); @Test - public void directAccessToErrorPage() throws Exception { + public void directAccessToErrorPage() { String content = this.template.getForObject( "http://localhost:" + this.port + "/spring/error", String.class); assertThat(content).contains("error"); @@ -65,7 +65,7 @@ public class RemappedErrorViewIntegrationTests { } @Test - public void forwardToErrorPage() throws Exception { + public void forwardToErrorPage() { String content = this.template .getForObject("http://localhost:" + this.port + "/spring/", String.class); assertThat(content).contains("error"); diff --git a/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/GrabCommandIntegrationTests.java b/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/GrabCommandIntegrationTests.java index 22a39d3d9c..037246b5b6 100644 --- a/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/GrabCommandIntegrationTests.java +++ b/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/GrabCommandIntegrationTests.java @@ -63,8 +63,7 @@ public class GrabCommandIntegrationTests { } @Test - public void duplicateDependencyManagementBomAnnotationsProducesAnError() - throws Exception { + public void duplicateDependencyManagementBomAnnotationsProducesAnError() { try { this.cli.grab("duplicateDependencyManagementBom.groovy"); fail(); diff --git a/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/app/SpringApplicationLauncherTests.java b/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/app/SpringApplicationLauncherTests.java index f2ca3d8845..522fe0f8e1 100644 --- a/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/app/SpringApplicationLauncherTests.java +++ b/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/app/SpringApplicationLauncherTests.java @@ -41,7 +41,7 @@ public class SpringApplicationLauncherTests { } @Test - public void defaultLaunch() throws Exception { + public void defaultLaunch() { assertThat(launch()).contains("org.springframework.boot.SpringApplication"); } diff --git a/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/CommandRunnerTests.java b/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/CommandRunnerTests.java index 41d277cd23..7d56193ece 100644 --- a/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/CommandRunnerTests.java +++ b/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/CommandRunnerTests.java @@ -127,14 +127,14 @@ public class CommandRunnerTests { } @Test - public void handlesSuccess() throws Exception { + public void handlesSuccess() { int status = this.commandRunner.runAndHandleErrors("command"); assertThat(status).isEqualTo(0); assertThat(this.calls).isEmpty(); } @Test - public void handlesNoSuchCommand() throws Exception { + public void handlesNoSuchCommand() { int status = this.commandRunner.runAndHandleErrors("missing"); assertThat(status).isEqualTo(1); assertThat(this.calls).containsOnly(Call.ERROR_MESSAGE); @@ -175,7 +175,7 @@ public class CommandRunnerTests { } @Test - public void exceptionMessages() throws Exception { + public void exceptionMessages() { assertThat(new NoSuchCommandException("name").getMessage()) .isEqualTo("'name' is not a valid command. See 'help'."); } diff --git a/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/archive/ResourceMatcherTests.java b/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/archive/ResourceMatcherTests.java index fe1275cf5e..39bc86d156 100644 --- a/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/archive/ResourceMatcherTests.java +++ b/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/archive/ResourceMatcherTests.java @@ -50,7 +50,7 @@ public class ResourceMatcherTests { @SuppressWarnings("unchecked") @Test - public void defaults() throws Exception { + public void defaults() { ResourceMatcher resourceMatcher = new ResourceMatcher(Arrays.asList(""), Arrays.asList("")); Collection includes = (Collection) ReflectionTestUtils @@ -79,7 +79,7 @@ public class ResourceMatcherTests { @SuppressWarnings("unchecked") @Test - public void includedDeltas() throws Exception { + public void includedDeltas() { ResourceMatcher resourceMatcher = new ResourceMatcher(Arrays.asList("-static/**"), Arrays.asList("")); Collection includes = (Collection) ReflectionTestUtils @@ -90,7 +90,7 @@ public class ResourceMatcherTests { @SuppressWarnings("unchecked") @Test - public void includedDeltasAndNewEntries() throws Exception { + public void includedDeltasAndNewEntries() { ResourceMatcher resourceMatcher = new ResourceMatcher( Arrays.asList("-static/**", "foo.jar"), Arrays.asList("-**/*.jar")); Collection includes = (Collection) ReflectionTestUtils @@ -105,7 +105,7 @@ public class ResourceMatcherTests { @SuppressWarnings("unchecked") @Test - public void excludedDeltas() throws Exception { + public void excludedDeltas() { ResourceMatcher resourceMatcher = new ResourceMatcher(Arrays.asList(""), Arrays.asList("-**/*.jar")); Collection excludes = (Collection) ReflectionTestUtils diff --git a/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/ProjectGenerationRequestTests.java b/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/ProjectGenerationRequestTests.java index 3dd2b296f5..4ccd46a2fd 100644 --- a/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/ProjectGenerationRequestTests.java +++ b/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/ProjectGenerationRequestTests.java @@ -205,7 +205,7 @@ public class ProjectGenerationRequestTests { } @Test - public void invalidType() throws Exception { + public void invalidType() { this.request.setType("does-not-exist"); this.thrown.expect(ReportableException.class); this.request.generateUrl(createDefaultMetadata()); diff --git a/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/shell/EscapeAwareWhiteSpaceArgumentDelimiterTests.java b/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/shell/EscapeAwareWhiteSpaceArgumentDelimiterTests.java index d8d2e9b7b7..e820ce2e2f 100644 --- a/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/shell/EscapeAwareWhiteSpaceArgumentDelimiterTests.java +++ b/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/shell/EscapeAwareWhiteSpaceArgumentDelimiterTests.java @@ -31,7 +31,7 @@ public class EscapeAwareWhiteSpaceArgumentDelimiterTests { private final EscapeAwareWhiteSpaceArgumentDelimiter delimiter = new EscapeAwareWhiteSpaceArgumentDelimiter(); @Test - public void simple() throws Exception { + public void simple() { String s = "one two"; assertThat(this.delimiter.delimit(s, 0).getArguments()).containsExactly("one", "two"); @@ -42,7 +42,7 @@ public class EscapeAwareWhiteSpaceArgumentDelimiterTests { } @Test - public void escaped() throws Exception { + public void escaped() { String s = "o\\ ne two"; assertThat(this.delimiter.delimit(s, 0).getArguments()).containsExactly("o\\ ne", "two"); @@ -54,7 +54,7 @@ public class EscapeAwareWhiteSpaceArgumentDelimiterTests { } @Test - public void quoted() throws Exception { + public void quoted() { String s = "'o ne' 't w o'"; assertThat(this.delimiter.delimit(s, 0).getArguments()).containsExactly("'o ne'", "'t w o'"); @@ -62,7 +62,7 @@ public class EscapeAwareWhiteSpaceArgumentDelimiterTests { } @Test - public void doubleQuoted() throws Exception { + public void doubleQuoted() { String s = "\"o ne\" \"t w o\""; assertThat(this.delimiter.delimit(s, 0).getArguments()) .containsExactly("\"o ne\"", "\"t w o\""); @@ -70,7 +70,7 @@ public class EscapeAwareWhiteSpaceArgumentDelimiterTests { } @Test - public void nestedQuotes() throws Exception { + public void nestedQuotes() { String s = "\"o 'n''e\" 't \"w o'"; assertThat(this.delimiter.delimit(s, 0).getArguments()) .containsExactly("\"o 'n''e\"", "'t \"w o'"); @@ -79,7 +79,7 @@ public class EscapeAwareWhiteSpaceArgumentDelimiterTests { } @Test - public void escapedQuotes() throws Exception { + public void escapedQuotes() { String s = "\\'a b"; ArgumentList argumentList = this.delimiter.delimit(s, 0); assertThat(argumentList.getArguments()).isEqualTo(new String[] { "\\'a", "b" }); @@ -87,7 +87,7 @@ public class EscapeAwareWhiteSpaceArgumentDelimiterTests { } @Test - public void escapes() throws Exception { + public void escapes() { String s = "\\ \\\\.\\\\\\t"; assertThat(this.delimiter.parseArguments(s)).containsExactly(" \\.\\\t"); } diff --git a/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/dependencies/DependencyManagementArtifactCoordinatesResolverTests.java b/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/dependencies/DependencyManagementArtifactCoordinatesResolverTests.java index ea510ffd6c..05ae4835e7 100644 --- a/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/dependencies/DependencyManagementArtifactCoordinatesResolverTests.java +++ b/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/dependencies/DependencyManagementArtifactCoordinatesResolverTests.java @@ -49,19 +49,19 @@ public class DependencyManagementArtifactCoordinatesResolverTests { } @Test - public void getGroupIdForBootArtifact() throws Exception { + public void getGroupIdForBootArtifact() { assertThat(this.resolver.getGroupId("spring-boot-something")) .isEqualTo("org.springframework.boot"); verify(this.dependencyManagement, never()).find(anyString()); } @Test - public void getGroupIdFound() throws Exception { + public void getGroupIdFound() { assertThat(this.resolver.getGroupId("a1")).isEqualTo("g1"); } @Test - public void getGroupIdNotFound() throws Exception { + public void getGroupIdNotFound() { assertThat(this.resolver.getGroupId("a2")).isNull(); } diff --git a/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/grape/SettingsXmlRepositorySystemSessionAutoConfigurationTests.java b/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/grape/SettingsXmlRepositorySystemSessionAutoConfigurationTests.java index 1492423a03..872a2ff89d 100644 --- a/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/grape/SettingsXmlRepositorySystemSessionAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/grape/SettingsXmlRepositorySystemSessionAutoConfigurationTests.java @@ -19,7 +19,6 @@ package org.springframework.boot.cli.compiler.grape; import java.io.File; import org.apache.maven.repository.internal.MavenRepositorySystemUtils; -import org.apache.maven.settings.building.SettingsBuildingException; import org.eclipse.aether.DefaultRepositorySystemSession; import org.eclipse.aether.RepositorySystem; import org.eclipse.aether.internal.impl.SimpleLocalRepositoryManagerFactory; @@ -56,17 +55,17 @@ public class SettingsXmlRepositorySystemSessionAutoConfigurationTests { } @Test - public void basicSessionCustomization() throws SettingsBuildingException { + public void basicSessionCustomization() { assertSessionCustomization("src/test/resources/maven-settings/basic"); } @Test - public void encryptedSettingsSessionCustomization() throws SettingsBuildingException { + public void encryptedSettingsSessionCustomization() { assertSessionCustomization("src/test/resources/maven-settings/encrypted"); } @Test - public void propertyInterpolation() throws SettingsBuildingException { + public void propertyInterpolation() { final DefaultRepositorySystemSession session = MavenRepositorySystemUtils .newSession(); given(this.repositorySystem.newLocalRepositoryManager(eq(session), diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/RemoteUrlPropertyExtractorTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/RemoteUrlPropertyExtractorTests.java index fe57ee8f0d..91d274eefa 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/RemoteUrlPropertyExtractorTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/RemoteUrlPropertyExtractorTests.java @@ -47,14 +47,14 @@ public class RemoteUrlPropertyExtractorTests { } @Test - public void missingUrl() throws Exception { + public void missingUrl() { this.thrown.expect(IllegalStateException.class); this.thrown.expectMessage("No remote URL specified"); doTest(); } @Test - public void malformedUrl() throws Exception { + public void malformedUrl() { this.thrown.expect(IllegalStateException.class); this.thrown.expectMessage("Malformed URL '::://wibble'"); doTest("::://wibble"); @@ -62,14 +62,14 @@ public class RemoteUrlPropertyExtractorTests { } @Test - public void multipleUrls() throws Exception { + public void multipleUrls() { this.thrown.expect(IllegalStateException.class); this.thrown.expectMessage("Multiple URLs specified"); doTest("http://localhost:8080", "http://localhost:9090"); } @Test - public void validUrl() throws Exception { + public void validUrl() { ApplicationContext context = doTest("http://localhost:8080"); assertThat(context.getEnvironment().getProperty("remoteUrl")) .isEqualTo("http://localhost:8080"); @@ -78,7 +78,7 @@ public class RemoteUrlPropertyExtractorTests { } @Test - public void cleanValidUrl() throws Exception { + public void cleanValidUrl() { ApplicationContext context = doTest("http://localhost:8080/"); assertThat(context.getEnvironment().getProperty("remoteUrl")) .isEqualTo("http://localhost:8080"); diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfigurationTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfigurationTests.java index fc111d7da3..90e9186558 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfigurationTests.java @@ -86,7 +86,7 @@ public class LocalDevToolsAutoConfigurationTests { } @Test - public void thymeleafCacheIsFalse() throws Exception { + public void thymeleafCacheIsFalse() { this.context = initializeAndRun(Config.class); SpringResourceTemplateResolver resolver = this.context .getBean(SpringResourceTemplateResolver.class); @@ -94,7 +94,7 @@ public class LocalDevToolsAutoConfigurationTests { } @Test - public void defaultPropertyCanBeOverriddenFromCommandLine() throws Exception { + public void defaultPropertyCanBeOverriddenFromCommandLine() { this.context = initializeAndRun(Config.class, "--spring.thymeleaf.cache=true"); SpringResourceTemplateResolver resolver = this.context .getBean(SpringResourceTemplateResolver.class); @@ -102,7 +102,7 @@ public class LocalDevToolsAutoConfigurationTests { } @Test - public void defaultPropertyCanBeOverriddenFromUserHomeProperties() throws Exception { + public void defaultPropertyCanBeOverriddenFromUserHomeProperties() { String userHome = System.getProperty("user.home"); System.setProperty("user.home", new File("src/test/resources/user-home").getAbsolutePath()); @@ -118,21 +118,21 @@ public class LocalDevToolsAutoConfigurationTests { } @Test - public void resourceCachePeriodIsZero() throws Exception { + public void resourceCachePeriodIsZero() { this.context = initializeAndRun(WebResourcesConfig.class); ResourceProperties properties = this.context.getBean(ResourceProperties.class); assertThat(properties.getCache().getPeriod()).isEqualTo(Duration.ZERO); } @Test - public void liveReloadServer() throws Exception { + public void liveReloadServer() { this.context = initializeAndRun(Config.class); LiveReloadServer server = this.context.getBean(LiveReloadServer.class); assertThat(server.isStarted()).isTrue(); } @Test - public void liveReloadTriggeredOnContextRefresh() throws Exception { + public void liveReloadTriggeredOnContextRefresh() { this.context = initializeAndRun(ConfigWithMockLiveReload.class); LiveReloadServer server = this.context.getBean(LiveReloadServer.class); reset(server); @@ -141,7 +141,7 @@ public class LocalDevToolsAutoConfigurationTests { } @Test - public void liveReloadTriggeredOnClassPathChangeWithoutRestart() throws Exception { + public void liveReloadTriggeredOnClassPathChangeWithoutRestart() { this.context = initializeAndRun(ConfigWithMockLiveReload.class); LiveReloadServer server = this.context.getBean(LiveReloadServer.class); reset(server); @@ -152,7 +152,7 @@ public class LocalDevToolsAutoConfigurationTests { } @Test - public void liveReloadNotTriggeredOnClassPathChangeWithRestart() throws Exception { + public void liveReloadNotTriggeredOnClassPathChangeWithRestart() { this.context = initializeAndRun(ConfigWithMockLiveReload.class); LiveReloadServer server = this.context.getBean(LiveReloadServer.class); reset(server); @@ -163,7 +163,7 @@ public class LocalDevToolsAutoConfigurationTests { } @Test - public void liveReloadDisabled() throws Exception { + public void liveReloadDisabled() { Map properties = new HashMap<>(); properties.put("spring.devtools.livereload.enabled", false); this.context = initializeAndRun(Config.class, properties); @@ -172,7 +172,7 @@ public class LocalDevToolsAutoConfigurationTests { } @Test - public void restartTriggeredOnClassPathChangeWithRestart() throws Exception { + public void restartTriggeredOnClassPathChangeWithRestart() { this.context = initializeAndRun(Config.class); ClassPathChangedEvent event = new ClassPathChangedEvent(this.context, Collections.emptySet(), true); @@ -181,7 +181,7 @@ public class LocalDevToolsAutoConfigurationTests { } @Test - public void restartNotTriggeredOnClassPathChangeWithRestart() throws Exception { + public void restartNotTriggeredOnClassPathChangeWithRestart() { this.context = initializeAndRun(Config.class); ClassPathChangedEvent event = new ClassPathChangedEvent(this.context, Collections.emptySet(), false); @@ -190,7 +190,7 @@ public class LocalDevToolsAutoConfigurationTests { } @Test - public void restartWatchingClassPath() throws Exception { + public void restartWatchingClassPath() { this.context = initializeAndRun(Config.class); ClassPathFileSystemWatcher watcher = this.context .getBean(ClassPathFileSystemWatcher.class); @@ -198,7 +198,7 @@ public class LocalDevToolsAutoConfigurationTests { } @Test - public void restartDisabled() throws Exception { + public void restartDisabled() { Map properties = new HashMap<>(); properties.put("spring.devtools.restart.enabled", false); this.context = initializeAndRun(Config.class, properties); @@ -207,7 +207,7 @@ public class LocalDevToolsAutoConfigurationTests { } @Test - public void restartWithTriggerFile() throws Exception { + public void restartWithTriggerFile() { Map properties = new HashMap<>(); properties.put("spring.devtools.restart.trigger-file", "somefile.txt"); this.context = initializeAndRun(Config.class, properties); @@ -220,7 +220,7 @@ public class LocalDevToolsAutoConfigurationTests { } @Test - public void watchingAdditionalPaths() throws Exception { + public void watchingAdditionalPaths() { Map properties = new HashMap<>(); properties.put("spring.devtools.restart.additional-paths", "src/main/java,src/test/java"); diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/RemoteDevToolsAutoConfigurationTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/RemoteDevToolsAutoConfigurationTests.java index b72507c2cd..fee5588e37 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/RemoteDevToolsAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/RemoteDevToolsAutoConfigurationTests.java @@ -16,8 +16,6 @@ package org.springframework.boot.devtools.autoconfigure; -import java.io.IOException; - import org.junit.After; import org.junit.Before; import org.junit.Rule; @@ -88,7 +86,7 @@ public class RemoteDevToolsAutoConfigurationTests { } @Test - public void disabledIfRemoteSecretIsMissing() throws Exception { + public void disabledIfRemoteSecretIsMissing() { loadContext("a:b"); this.thrown.expect(NoSuchBeanDefinitionException.class); this.context.getBean(DispatcherFilter.class); @@ -145,7 +143,7 @@ public class RemoteDevToolsAutoConfigurationTests { } @Test - public void disableRestart() throws Exception { + public void disableRestart() { loadContext("spring.devtools.remote.secret:supersecret", "spring.devtools.remote.restart.enabled:false"); this.thrown.expect(NoSuchBeanDefinitionException.class); @@ -211,8 +209,7 @@ public class RemoteDevToolsAutoConfigurationTests { } @Override - public void handle(ServerHttpRequest request, ServerHttpResponse response) - throws IOException { + public void handle(ServerHttpRequest request, ServerHttpResponse response) { } } @@ -229,8 +226,7 @@ public class RemoteDevToolsAutoConfigurationTests { } @Override - public void handle(ServerHttpRequest request, ServerHttpResponse response) - throws IOException { + public void handle(ServerHttpRequest request, ServerHttpResponse response) { this.invoked = true; } diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/TriggerFileFilterTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/TriggerFileFilterTests.java index 9a0961af16..f84352ce96 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/TriggerFileFilterTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/TriggerFileFilterTests.java @@ -39,7 +39,7 @@ public class TriggerFileFilterTests { public TemporaryFolder temp = new TemporaryFolder(); @Test - public void nameMustNotBeNull() throws Exception { + public void nameMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Name must not be null"); new TriggerFileFilter(null); diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathChangedEventTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathChangedEventTests.java index 3c21de473e..e1cd9652bb 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathChangedEventTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathChangedEventTests.java @@ -40,14 +40,14 @@ public class ClassPathChangedEventTests { private Object source = new Object(); @Test - public void changeSetMustNotBeNull() throws Exception { + public void changeSetMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("ChangeSet must not be null"); new ClassPathChangedEvent(this.source, null, false); } @Test - public void getChangeSet() throws Exception { + public void getChangeSet() { Set changeSet = new LinkedHashSet<>(); ClassPathChangedEvent event = new ClassPathChangedEvent(this.source, changeSet, false); @@ -55,7 +55,7 @@ public class ClassPathChangedEventTests { } @Test - public void getRestartRequired() throws Exception { + public void getRestartRequired() { Set changeSet = new LinkedHashSet<>(); ClassPathChangedEvent event; event = new ClassPathChangedEvent(this.source, changeSet, false); diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathFileChangeListenerTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathFileChangeListenerTests.java index 6bbc692305..dd126b41e1 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathFileChangeListenerTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathFileChangeListenerTests.java @@ -69,7 +69,7 @@ public class ClassPathFileChangeListenerTests { } @Test - public void eventPublisherMustNotBeNull() throws Exception { + public void eventPublisherMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("EventPublisher must not be null"); new ClassPathFileChangeListener(null, this.restartStrategy, @@ -77,7 +77,7 @@ public class ClassPathFileChangeListenerTests { } @Test - public void restartStrategyMustNotBeNull() throws Exception { + public void restartStrategyMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("RestartStrategy must not be null"); new ClassPathFileChangeListener(this.eventPublisher, null, @@ -85,13 +85,13 @@ public class ClassPathFileChangeListenerTests { } @Test - public void sendsEventWithoutRestart() throws Exception { + public void sendsEventWithoutRestart() { testSendsEvent(false); verify(this.fileSystemWatcher, never()).stop(); } @Test - public void sendsEventWithRestart() throws Exception { + public void sendsEventWithRestart() { testSendsEvent(true); verify(this.fileSystemWatcher).stop(); } diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathFileSystemWatcherTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathFileSystemWatcherTests.java index 217f11f638..93265d3e47 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathFileSystemWatcherTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathFileSystemWatcherTests.java @@ -56,7 +56,7 @@ public class ClassPathFileSystemWatcherTests { public TemporaryFolder temp = new TemporaryFolder(); @Test - public void urlsMustNotBeNull() throws Exception { + public void urlsMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Urls must not be null"); URL[] urls = null; diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/PatternClassPathRestartStrategyTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/PatternClassPathRestartStrategyTests.java index 312c6d71ee..49f1833a11 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/PatternClassPathRestartStrategyTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/PatternClassPathRestartStrategyTests.java @@ -34,19 +34,19 @@ import static org.assertj.core.api.Assertions.assertThat; public class PatternClassPathRestartStrategyTests { @Test - public void nullPattern() throws Exception { + public void nullPattern() { ClassPathRestartStrategy strategy = createStrategy(null); assertRestartRequired(strategy, "a/b.txt", true); } @Test - public void emptyPattern() throws Exception { + public void emptyPattern() { ClassPathRestartStrategy strategy = createStrategy(""); assertRestartRequired(strategy, "a/b.txt", true); } @Test - public void singlePattern() throws Exception { + public void singlePattern() { ClassPathRestartStrategy strategy = createStrategy("static/**"); assertRestartRequired(strategy, "static/file.txt", false); assertRestartRequired(strategy, "static/folder/file.txt", false); @@ -55,7 +55,7 @@ public class PatternClassPathRestartStrategyTests { } @Test - public void multiplePatterns() throws Exception { + public void multiplePatterns() { ClassPathRestartStrategy strategy = createStrategy("static/**,public/**"); assertRestartRequired(strategy, "static/file.txt", false); assertRestartRequired(strategy, "static/folder/file.txt", false); @@ -66,7 +66,7 @@ public class PatternClassPathRestartStrategyTests { } @Test - public void pomChange() throws Exception { + public void pomChange() { ClassPathRestartStrategy strategy = createStrategy("META-INF/maven/**"); assertRestartRequired(strategy, "pom.xml", true); String mavenFolder = "META-INF/maven/org.springframework.boot/spring-boot-devtools"; diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/env/DevToolPropertiesIntegrationTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/env/DevToolPropertiesIntegrationTests.java index 12e3d3a12c..1570e65166 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/env/DevToolPropertiesIntegrationTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/env/DevToolPropertiesIntegrationTests.java @@ -79,8 +79,7 @@ public class DevToolPropertiesIntegrationTests { } @Test - public void postProcessWhenRestarterDisabledAndRemoteSecretNotSetShouldNotAddPropertySource() - throws Exception { + public void postProcessWhenRestarterDisabledAndRemoteSecretNotSetShouldNotAddPropertySource() { Restarter.clearInstance(); Restarter.disable(); SpringApplication application = new SpringApplication( @@ -92,8 +91,7 @@ public class DevToolPropertiesIntegrationTests { } @Test - public void postProcessWhenRestarterDisabledAndRemoteSecretSetShouldAddPropertySource() - throws Exception { + public void postProcessWhenRestarterDisabledAndRemoteSecretSetShouldAddPropertySource() { Restarter.clearInstance(); Restarter.disable(); SpringApplication application = new SpringApplication( diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/env/DevToolsHomePropertiesPostProcessorTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/env/DevToolsHomePropertiesPostProcessorTests.java index 538e16fadd..5ad7201027 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/env/DevToolsHomePropertiesPostProcessorTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/env/DevToolsHomePropertiesPostProcessorTests.java @@ -65,7 +65,7 @@ public class DevToolsHomePropertiesPostProcessorTests { } @Test - public void ignoresMissingHomeProperties() throws Exception { + public void ignoresMissingHomeProperties() { ConfigurableEnvironment environment = new MockEnvironment(); MockDevToolHomePropertiesPostProcessor postProcessor = new MockDevToolHomePropertiesPostProcessor(); postProcessor.postProcessEnvironment(environment, null); diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/filewatch/FileSnapshotTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/filewatch/FileSnapshotTests.java index cfc1745365..6ead7a9907 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/filewatch/FileSnapshotTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/filewatch/FileSnapshotTests.java @@ -49,7 +49,7 @@ public class FileSnapshotTests { public TemporaryFolder temporaryFolder = new TemporaryFolder(); @Test - public void fileMustNotBeNull() throws Exception { + public void fileMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("File must not be null"); new FileSnapshot(null); diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/filewatch/FileSystemWatcherTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/filewatch/FileSystemWatcherTests.java index 0d83ef5859..693cb145ce 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/filewatch/FileSystemWatcherTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/filewatch/FileSystemWatcherTests.java @@ -59,40 +59,40 @@ public class FileSystemWatcherTests { public TemporaryFolder temp = new TemporaryFolder(); @Before - public void setup() throws Exception { + public void setup() { setupWatcher(20, 10); } @Test - public void pollIntervalMustBePositive() throws Exception { + public void pollIntervalMustBePositive() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("PollInterval must be positive"); new FileSystemWatcher(true, Duration.ofMillis(0), Duration.ofMillis(1)); } @Test - public void quietPeriodMustBePositive() throws Exception { + public void quietPeriodMustBePositive() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("QuietPeriod must be positive"); new FileSystemWatcher(true, Duration.ofMillis(1), Duration.ofMillis(0)); } @Test - public void pollIntervalMustBeGreaterThanQuietPeriod() throws Exception { + public void pollIntervalMustBeGreaterThanQuietPeriod() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("PollInterval must be greater than QuietPeriod"); new FileSystemWatcher(true, Duration.ofMillis(1), Duration.ofMillis(1)); } @Test - public void listenerMustNotBeNull() throws Exception { + public void listenerMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("FileChangeListener must not be null"); this.watcher.addListener(null); } @Test - public void cannotAddListenerToStartedListener() throws Exception { + public void cannotAddListenerToStartedListener() { this.thrown.expect(IllegalStateException.class); this.thrown.expectMessage("FileSystemWatcher already started"); this.watcher.start(); @@ -100,14 +100,14 @@ public class FileSystemWatcherTests { } @Test - public void sourceFolderMustNotBeNull() throws Exception { + public void sourceFolderMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Folder must not be null"); this.watcher.addSourceFolder(null); } @Test - public void sourceFolderMustExist() throws Exception { + public void sourceFolderMustExist() { File folder = new File("does/not/exist"); assertThat(folder.exists()).isFalse(); this.thrown.expect(IllegalArgumentException.class); @@ -117,7 +117,7 @@ public class FileSystemWatcherTests { } @Test - public void sourceFolderMustBeADirectory() throws Exception { + public void sourceFolderMustBeADirectory() { File folder = new File("pom.xml"); assertThat(folder.isFile()).isTrue(); this.thrown.expect(IllegalArgumentException.class); diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/filewatch/FolderSnapshotTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/filewatch/FolderSnapshotTests.java index c3644e2e88..1a20ea3613 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/filewatch/FolderSnapshotTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/filewatch/FolderSnapshotTests.java @@ -68,7 +68,7 @@ public class FolderSnapshotTests { } @Test - public void equalsWhenNothingHasChanged() throws Exception { + public void equalsWhenNothingHasChanged() { FolderSnapshot updatedSnapshot = new FolderSnapshot(this.folder); assertThat(this.initialSnapshot).isEqualTo(updatedSnapshot); assertThat(this.initialSnapshot.hashCode()).isEqualTo(updatedSnapshot.hashCode()); @@ -82,7 +82,7 @@ public class FolderSnapshotTests { } @Test - public void notEqualsWhenAFileIsDeleted() throws Exception { + public void notEqualsWhenAFileIsDeleted() { new File(new File(this.folder, "folder1"), "file1").delete(); FolderSnapshot updatedSnapshot = new FolderSnapshot(this.folder); assertThat(this.initialSnapshot).isNotEqualTo(updatedSnapshot); @@ -97,7 +97,7 @@ public class FolderSnapshotTests { } @Test - public void getChangedFilesSnapshotMustNotBeNull() throws Exception { + public void getChangedFilesSnapshotMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Snapshot must not be null"); this.initialSnapshot.getChangedFiles(null, null); @@ -112,7 +112,7 @@ public class FolderSnapshotTests { } @Test - public void getChangedFilesWhenNothingHasChanged() throws Exception { + public void getChangedFilesWhenNothingHasChanged() { FolderSnapshot updatedSnapshot = new FolderSnapshot(this.folder); this.initialSnapshot.getChangedFiles(updatedSnapshot, null); } diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/integrationtest/HttpTunnelIntegrationTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/integrationtest/HttpTunnelIntegrationTests.java index 5868b9dc48..335bbdd46a 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/integrationtest/HttpTunnelIntegrationTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/integrationtest/HttpTunnelIntegrationTests.java @@ -62,7 +62,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class HttpTunnelIntegrationTests { @Test - public void httpServerDirect() throws Exception { + public void httpServerDirect() { AnnotationConfigServletWebServerApplicationContext context = new AnnotationConfigServletWebServerApplicationContext(); context.register(ServerConfiguration.class); context.refresh(); @@ -75,7 +75,7 @@ public class HttpTunnelIntegrationTests { } @Test - public void viaTunnel() throws Exception { + public void viaTunnel() { AnnotationConfigServletWebServerApplicationContext serverContext = new AnnotationConfigServletWebServerApplicationContext(); serverContext.register(ServerConfiguration.class); serverContext.refresh(); diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/livereload/FrameTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/livereload/FrameTests.java index 805289cb3c..fe64171451 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/livereload/FrameTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/livereload/FrameTests.java @@ -37,28 +37,28 @@ public class FrameTests { public ExpectedException thrown = ExpectedException.none(); @Test - public void payloadMustNotBeNull() throws Exception { + public void payloadMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Payload must not be null"); new Frame((String) null); } @Test - public void typeMustNotBeNull() throws Exception { + public void typeMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Type must not be null"); new Frame((Frame.Type) null); } @Test - public void textPayload() throws Exception { + public void textPayload() { Frame frame = new Frame("abc"); assertThat(frame.getType()).isEqualTo(Frame.Type.TEXT); assertThat(frame.getPayload()).isEqualTo("abc".getBytes()); } @Test - public void typedPayload() throws Exception { + public void typedPayload() { Frame frame = new Frame(Frame.Type.CLOSE); assertThat(frame.getType()).isEqualTo(Frame.Type.CLOSE); assertThat(frame.getPayload()).isEqualTo(new byte[] {}); diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/livereload/LiveReloadServerTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/livereload/LiveReloadServerTests.java index de975ac1ec..7fda28bb12 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/livereload/LiveReloadServerTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/livereload/LiveReloadServerTests.java @@ -226,8 +226,7 @@ public class LiveReloadServerTests { } @Override - protected void handleTextMessage(WebSocketSession session, TextMessage message) - throws Exception { + protected void handleTextMessage(WebSocketSession session, TextMessage message) { if (message.getPayload().contains("hello")) { this.helloLatch.countDown(); } @@ -235,14 +234,12 @@ public class LiveReloadServerTests { } @Override - protected void handlePongMessage(WebSocketSession session, PongMessage message) - throws Exception { + protected void handlePongMessage(WebSocketSession session, PongMessage message) { this.pongCount++; } @Override - public void afterConnectionClosed(WebSocketSession session, CloseStatus status) - throws Exception { + public void afterConnectionClosed(WebSocketSession session, CloseStatus status) { this.closeStatus = status; } diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/client/ClassPathChangeUploaderTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/client/ClassPathChangeUploaderTests.java index b7c9598406..b8596014d2 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/client/ClassPathChangeUploaderTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/client/ClassPathChangeUploaderTests.java @@ -73,28 +73,28 @@ public class ClassPathChangeUploaderTests { } @Test - public void urlMustNotBeNull() throws Exception { + public void urlMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("URL must not be empty"); new ClassPathChangeUploader(null, this.requestFactory); } @Test - public void urlMustNotBeEmpty() throws Exception { + public void urlMustNotBeEmpty() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("URL must not be empty"); new ClassPathChangeUploader("", this.requestFactory); } @Test - public void requestFactoryMustNotBeNull() throws Exception { + public void requestFactoryMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("RequestFactory must not be null"); new ClassPathChangeUploader("http://localhost:8080", null); } @Test - public void urlMustNotBeMalformed() throws Exception { + public void urlMustNotBeMalformed() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Malformed URL 'htttttp:///ttest'"); new ClassPathChangeUploader("htttttp:///ttest", this.requestFactory); diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/client/DelayedLiveReloadTriggerTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/client/DelayedLiveReloadTriggerTests.java index c8b23b6d3a..b92c3decfe 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/client/DelayedLiveReloadTriggerTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/client/DelayedLiveReloadTriggerTests.java @@ -83,28 +83,28 @@ public class DelayedLiveReloadTriggerTests { } @Test - public void liveReloadServerMustNotBeNull() throws Exception { + public void liveReloadServerMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("LiveReloadServer must not be null"); new DelayedLiveReloadTrigger(null, this.requestFactory, URL); } @Test - public void requestFactoryMustNotBeNull() throws Exception { + public void requestFactoryMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("RequestFactory must not be null"); new DelayedLiveReloadTrigger(this.liveReloadServer, null, URL); } @Test - public void urlMustNotBeNull() throws Exception { + public void urlMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("URL must not be empty"); new DelayedLiveReloadTrigger(this.liveReloadServer, this.requestFactory, null); } @Test - public void urlMustNotBeEmpty() throws Exception { + public void urlMustNotBeEmpty() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("URL must not be empty"); new DelayedLiveReloadTrigger(this.liveReloadServer, this.requestFactory, ""); diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/client/RemoteClientConfigurationTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/client/RemoteClientConfigurationTests.java index bb3f079ee5..76a699eaba 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/client/RemoteClientConfigurationTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/client/RemoteClientConfigurationTests.java @@ -85,25 +85,25 @@ public class RemoteClientConfigurationTests { } @Test - public void warnIfRestartDisabled() throws Exception { + public void warnIfRestartDisabled() { configure("spring.devtools.remote.restart.enabled:false"); assertThat(this.output.toString()).contains("Remote restart is disabled"); } @Test - public void warnIfNotHttps() throws Exception { + public void warnIfNotHttps() { configure("http://localhost", true); assertThat(this.output.toString()).contains("is insecure"); } @Test - public void doesntWarnIfUsingHttps() throws Exception { + public void doesntWarnIfUsingHttps() { configure("https://localhost", true); assertThat(this.output.toString()).doesNotContain("is insecure"); } @Test - public void failIfNoSecret() throws Exception { + public void failIfNoSecret() { this.thrown.expect(BeanCreationException.class); this.thrown.expectMessage("required to secure your connection"); configure("http://localhost", false); @@ -124,14 +124,14 @@ public class RemoteClientConfigurationTests { } @Test - public void liveReloadDisabled() throws Exception { + public void liveReloadDisabled() { configure("spring.devtools.livereload.enabled:false"); this.thrown.expect(NoSuchBeanDefinitionException.class); this.context.getBean(OptionalLiveReloadServer.class); } @Test - public void remoteRestartDisabled() throws Exception { + public void remoteRestartDisabled() { configure("spring.devtools.remote.restart.enabled:false"); this.thrown.expect(NoSuchBeanDefinitionException.class); this.context.getBean(ClassPathFileSystemWatcher.class); diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/server/DispatcherFilterTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/server/DispatcherFilterTests.java index 4c496ae94c..4299473341 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/server/DispatcherFilterTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/server/DispatcherFilterTests.java @@ -70,13 +70,13 @@ public class DispatcherFilterTests { private DispatcherFilter filter; @Before - public void setup() throws Exception { + public void setup() { MockitoAnnotations.initMocks(this); this.filter = new DispatcherFilter(this.dispatcher); } @Test - public void dispatcherMustNotBeNull() throws Exception { + public void dispatcherMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Dispatcher must not be null"); new DispatcherFilter(null); diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/server/DispatcherTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/server/DispatcherTests.java index a79bee4d1f..9c1ee5a1bd 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/server/DispatcherTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/server/DispatcherTests.java @@ -76,14 +76,14 @@ public class DispatcherTests { } @Test - public void accessManagerMustNotBeNull() throws Exception { + public void accessManagerMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("AccessManager must not be null"); new Dispatcher(null, Collections.emptyList()); } @Test - public void mappersMustNotBeNull() throws Exception { + public void mappersMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Mappers must not be null"); new Dispatcher(this.accessManager, null); diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/server/HttpHeaderAccessManagerTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/server/HttpHeaderAccessManagerTests.java index 9bdd8b7e8b..84939b40c8 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/server/HttpHeaderAccessManagerTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/server/HttpHeaderAccessManagerTests.java @@ -56,52 +56,52 @@ public class HttpHeaderAccessManagerTests { } @Test - public void headerNameMustNotBeNull() throws Exception { + public void headerNameMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("HeaderName must not be empty"); new HttpHeaderAccessManager(null, SECRET); } @Test - public void headerNameMustNotBeEmpty() throws Exception { + public void headerNameMustNotBeEmpty() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("HeaderName must not be empty"); new HttpHeaderAccessManager("", SECRET); } @Test - public void expectedSecretMustNotBeNull() throws Exception { + public void expectedSecretMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("ExpectedSecret must not be empty"); new HttpHeaderAccessManager(HEADER, null); } @Test - public void expectedSecretMustNotBeEmpty() throws Exception { + public void expectedSecretMustNotBeEmpty() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("ExpectedSecret must not be empty"); new HttpHeaderAccessManager(HEADER, ""); } @Test - public void allowsMatching() throws Exception { + public void allowsMatching() { this.request.addHeader(HEADER, SECRET); assertThat(this.manager.isAllowed(this.serverRequest)).isTrue(); } @Test - public void disallowsWrongSecret() throws Exception { + public void disallowsWrongSecret() { this.request.addHeader(HEADER, "wrong"); assertThat(this.manager.isAllowed(this.serverRequest)).isFalse(); } @Test - public void disallowsNoSecret() throws Exception { + public void disallowsNoSecret() { assertThat(this.manager.isAllowed(this.serverRequest)).isFalse(); } @Test - public void disallowsWrongHeader() throws Exception { + public void disallowsWrongHeader() { this.request.addHeader("X-WRONG", SECRET); assertThat(this.manager.isAllowed(this.serverRequest)).isFalse(); } diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/server/HttpStatusHandlerTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/server/HttpStatusHandlerTests.java index c805d44ae9..39c2ab7a11 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/server/HttpStatusHandlerTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/server/HttpStatusHandlerTests.java @@ -58,7 +58,7 @@ public class HttpStatusHandlerTests { } @Test - public void statusMustNotBeNull() throws Exception { + public void statusMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Status must not be null"); new HttpStatusHandler(null); diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/server/UrlHandlerMapperTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/server/UrlHandlerMapperTests.java index c0cdacdc1d..bd30412827 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/server/UrlHandlerMapperTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/server/UrlHandlerMapperTests.java @@ -43,28 +43,28 @@ public class UrlHandlerMapperTests { private Handler handler = mock(Handler.class); @Test - public void requestUriMustNotBeNull() throws Exception { + public void requestUriMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("URL must not be empty"); new UrlHandlerMapper(null, this.handler); } @Test - public void requestUriMustNotBeEmpty() throws Exception { + public void requestUriMustNotBeEmpty() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("URL must not be empty"); new UrlHandlerMapper("", this.handler); } @Test - public void requestUrlMustStartWithSlash() throws Exception { + public void requestUrlMustStartWithSlash() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("URL must start with '/'"); new UrlHandlerMapper("tunnel", this.handler); } @Test - public void handlesMatchedUrl() throws Exception { + public void handlesMatchedUrl() { UrlHandlerMapper mapper = new UrlHandlerMapper("/tunnel", this.handler); HttpServletRequest servletRequest = new MockHttpServletRequest("GET", "/tunnel"); ServerHttpRequest request = new ServletServerHttpRequest(servletRequest); @@ -72,7 +72,7 @@ public class UrlHandlerMapperTests { } @Test - public void ignoresDifferentUrl() throws Exception { + public void ignoresDifferentUrl() { UrlHandlerMapper mapper = new UrlHandlerMapper("/tunnel", this.handler); HttpServletRequest servletRequest = new MockHttpServletRequest("GET", "/tunnel/other"); diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/ClassLoaderFilesResourcePatternResolverTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/ClassLoaderFilesResourcePatternResolverTests.java index 63af6551e0..b6d24b67bb 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/ClassLoaderFilesResourcePatternResolverTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/ClassLoaderFilesResourcePatternResolverTests.java @@ -69,19 +69,18 @@ public class ClassLoaderFilesResourcePatternResolverTests { } @Test - public void getClassLoaderShouldReturnClassLoader() throws Exception { + public void getClassLoaderShouldReturnClassLoader() { assertThat(this.resolver.getClassLoader()).isNotNull(); } @Test - public void getResourceShouldReturnResource() throws Exception { + public void getResourceShouldReturnResource() { Resource resource = this.resolver.getResource("index.html"); assertThat(resource).isNotNull().isInstanceOf(ClassPathResource.class); } @Test - public void getResourceWhenHasServletContextShouldReturnServletResource() - throws Exception { + public void getResourceWhenHasServletContextShouldReturnServletResource() { GenericWebApplicationContext context = new GenericWebApplicationContext( new MockServletContext()); this.resolver = new ClassLoaderFilesResourcePatternResolver(context, this.files); @@ -121,7 +120,7 @@ public class ClassLoaderFilesResourcePatternResolverTests { } @Test - public void customResourceLoaderIsUsedInNonWebApplication() throws Exception { + public void customResourceLoaderIsUsedInNonWebApplication() { GenericApplicationContext context = new GenericApplicationContext(); ResourceLoader resourceLoader = mock(ResourceLoader.class); context.setResourceLoader(resourceLoader); @@ -131,7 +130,7 @@ public class ClassLoaderFilesResourcePatternResolverTests { } @Test - public void customProtocolResolverIsUsedInNonWebApplication() throws Exception { + public void customProtocolResolverIsUsedInNonWebApplication() { GenericApplicationContext context = new GenericApplicationContext(); Resource resource = mock(Resource.class); ProtocolResolver resolver = mockProtocolResolver("foo:some-file.txt", resource); @@ -143,7 +142,7 @@ public class ClassLoaderFilesResourcePatternResolverTests { } @Test - public void customResourceLoaderIsUsedInWebApplication() throws Exception { + public void customResourceLoaderIsUsedInWebApplication() { GenericWebApplicationContext context = new GenericWebApplicationContext( new MockServletContext()); ResourceLoader resourceLoader = mock(ResourceLoader.class); @@ -154,7 +153,7 @@ public class ClassLoaderFilesResourcePatternResolverTests { } @Test - public void customProtocolResolverIsUsedInWebApplication() throws Exception { + public void customProtocolResolverIsUsedInWebApplication() { GenericWebApplicationContext context = new GenericWebApplicationContext( new MockServletContext()); Resource resource = mock(Resource.class); diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/DefaultRestartInitializerTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/DefaultRestartInitializerTests.java index 58635a2958..a22f161425 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/DefaultRestartInitializerTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/DefaultRestartInitializerTests.java @@ -32,13 +32,13 @@ import static org.hamcrest.Matchers.nullValue; public class DefaultRestartInitializerTests { @Test - public void nullForTests() throws Exception { + public void nullForTests() { MockRestartInitializer initializer = new MockRestartInitializer(true); assertThat(initializer.getInitialUrls(Thread.currentThread())).isNull(); } @Test - public void validMainThread() throws Exception { + public void validMainThread() { MockRestartInitializer initializer = new MockRestartInitializer(false); ClassLoader classLoader = new MockAppClassLoader(getClass().getClassLoader()); Thread thread = new Thread(); @@ -49,7 +49,7 @@ public class DefaultRestartInitializerTests { } @Test - public void threadNotNamedMain() throws Exception { + public void threadNotNamedMain() { MockRestartInitializer initializer = new MockRestartInitializer(false); ClassLoader classLoader = new MockAppClassLoader(getClass().getClassLoader()); Thread thread = new Thread(); @@ -60,7 +60,7 @@ public class DefaultRestartInitializerTests { } @Test - public void threadNotUsingAppClassLoader() throws Exception { + public void threadNotUsingAppClassLoader() { MockRestartInitializer initializer = new MockRestartInitializer(false); ClassLoader classLoader = new MockLauncherClassLoader( getClass().getClassLoader()); @@ -72,17 +72,17 @@ public class DefaultRestartInitializerTests { } @Test - public void skipsDueToJUnitStacks() throws Exception { + public void skipsDueToJUnitStacks() { testSkipStack("org.junit.runners.Something", true); } @Test - public void skipsDueToSpringTest() throws Exception { + public void skipsDueToSpringTest() { testSkipStack("org.springframework.boot.test.Something", true); } @Test - public void skipsDueToCucumber() throws Exception { + public void skipsDueToCucumber() { testSkipStack("cucumber.runtime.Runtime.run", true); } diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/MainMethodTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/MainMethodTests.java index ec5d06acf5..3c6aea2170 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/MainMethodTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/MainMethodTests.java @@ -47,7 +47,7 @@ public class MainMethodTests { } @Test - public void threadMustNotBeNull() throws Exception { + public void threadMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Thread must not be null"); new MainMethod(null); diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/OnInitializedRestarterConditionTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/OnInitializedRestarterConditionTests.java index b52ca26388..9c8f76397a 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/OnInitializedRestarterConditionTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/OnInitializedRestarterConditionTests.java @@ -48,7 +48,7 @@ public class OnInitializedRestarterConditionTests { } @Test - public void noInstance() throws Exception { + public void noInstance() { Restarter.clearInstance(); ConfigurableApplicationContext context = new AnnotationConfigApplicationContext( Config.class); @@ -57,7 +57,7 @@ public class OnInitializedRestarterConditionTests { } @Test - public void noInitialization() throws Exception { + public void noInitialization() { Restarter.initialize(new String[0], false, RestartInitializer.NONE); ConfigurableApplicationContext context = new AnnotationConfigApplicationContext( Config.class); diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/RestartApplicationListenerTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/RestartApplicationListenerTests.java index c09cb158b4..7c36406b9c 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/RestartApplicationListenerTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/RestartApplicationListenerTests.java @@ -55,13 +55,13 @@ public class RestartApplicationListenerTests { } @Test - public void isHighestPriority() throws Exception { + public void isHighestPriority() { assertThat(new RestartApplicationListener().getOrder()) .isEqualTo(Ordered.HIGHEST_PRECEDENCE); } @Test - public void initializeWithReady() throws Exception { + public void initializeWithReady() { testInitialize(false); assertThat(ReflectionTestUtils.getField(Restarter.getInstance(), "args")) .isEqualTo(ARGS); @@ -71,7 +71,7 @@ public class RestartApplicationListenerTests { } @Test - public void initializeWithFail() throws Exception { + public void initializeWithFail() { testInitialize(true); assertThat(ReflectionTestUtils.getField(Restarter.getInstance(), "args")) .isEqualTo(ARGS); @@ -81,7 +81,7 @@ public class RestartApplicationListenerTests { } @Test - public void disableWithSystemProperty() throws Exception { + public void disableWithSystemProperty() { System.setProperty(ENABLED_PROPERTY, "false"); testInitialize(false); assertThat(ReflectionTestUtils.getField(Restarter.getInstance(), "enabled")) diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/RestartScopeInitializerTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/RestartScopeInitializerTests.java index a5090d2dbb..6ce1a0e0d8 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/RestartScopeInitializerTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/RestartScopeInitializerTests.java @@ -42,7 +42,7 @@ public class RestartScopeInitializerTests { private static AtomicInteger refreshCount; @Test - public void restartScope() throws Exception { + public void restartScope() { createCount = new AtomicInteger(); refreshCount = new AtomicInteger(); ConfigurableApplicationContext context = runApplication(); diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/RestarterTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/RestarterTests.java index 7ff3e1cfa4..49299daf35 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/RestarterTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/RestarterTests.java @@ -73,7 +73,7 @@ public class RestarterTests { } @Test - public void cantGetInstanceBeforeInitialize() throws Exception { + public void cantGetInstanceBeforeInitialize() { Restarter.clearInstance(); this.thrown.expect(IllegalStateException.class); this.thrown.expectMessage("Restarter has not been initialized"); @@ -94,14 +94,14 @@ public class RestarterTests { @Test @SuppressWarnings("rawtypes") - public void getOrAddAttributeWithNewAttribute() throws Exception { + public void getOrAddAttributeWithNewAttribute() { ObjectFactory objectFactory = mock(ObjectFactory.class); given(objectFactory.getObject()).willReturn("abc"); Object attribute = Restarter.getInstance().getOrAddAttribute("x", objectFactory); assertThat(attribute).isEqualTo("abc"); } - public void addUrlsMustNotBeNull() throws Exception { + public void addUrlsMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Urls must not be null"); Restarter.getInstance().addUrls(null); @@ -120,7 +120,7 @@ public class RestarterTests { } @Test - public void addClassLoaderFilesMustNotBeNull() throws Exception { + public void addClassLoaderFilesMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("ClassLoaderFiles must not be null"); Restarter.getInstance().addClassLoaderFiles(null); @@ -141,7 +141,7 @@ public class RestarterTests { @Test @SuppressWarnings("rawtypes") - public void getOrAddAttributeWithExistingAttribute() throws Exception { + public void getOrAddAttributeWithExistingAttribute() { Restarter.getInstance().getOrAddAttribute("x", () -> "abc"); ObjectFactory objectFactory = mock(ObjectFactory.class); Object attribute = Restarter.getInstance().getOrAddAttribute("x", objectFactory); @@ -259,13 +259,13 @@ public class RestarterTests { } @Override - protected Throwable relaunch(ClassLoader classLoader) throws Exception { + protected Throwable relaunch(ClassLoader classLoader) { this.relaunchClassLoader = classLoader; return null; } @Override - protected void stop() throws Exception { + protected void stop() { } public ClassLoader getRelaunchClassLoader() { diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/classloader/ClassLoaderFileTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/classloader/ClassLoaderFileTests.java index fd47a0fc65..73c70c6796 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/classloader/ClassLoaderFileTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/classloader/ClassLoaderFileTests.java @@ -44,42 +44,42 @@ public class ClassLoaderFileTests { } @Test - public void addedContentsMustNotBeNull() throws Exception { + public void addedContentsMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Contents must not be null"); new ClassLoaderFile(Kind.ADDED, null); } @Test - public void modifiedContentsMustNotBeNull() throws Exception { + public void modifiedContentsMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Contents must not be null"); new ClassLoaderFile(Kind.MODIFIED, null); } @Test - public void deletedContentsMustBeNull() throws Exception { + public void deletedContentsMustBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Contents must be null"); new ClassLoaderFile(Kind.DELETED, new byte[10]); } @Test - public void added() throws Exception { + public void added() { ClassLoaderFile file = new ClassLoaderFile(Kind.ADDED, BYTES); assertThat(file.getKind()).isEqualTo(ClassLoaderFile.Kind.ADDED); assertThat(file.getContents()).isEqualTo(BYTES); } @Test - public void modified() throws Exception { + public void modified() { ClassLoaderFile file = new ClassLoaderFile(Kind.MODIFIED, BYTES); assertThat(file.getKind()).isEqualTo(ClassLoaderFile.Kind.MODIFIED); assertThat(file.getContents()).isEqualTo(BYTES); } @Test - public void deleted() throws Exception { + public void deleted() { ClassLoaderFile file = new ClassLoaderFile(Kind.DELETED, null); assertThat(file.getKind()).isEqualTo(ClassLoaderFile.Kind.DELETED); assertThat(file.getContents()).isNull(); diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/classloader/ClassLoaderFilesTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/classloader/ClassLoaderFilesTests.java index 8c30d30980..881a11c3c4 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/classloader/ClassLoaderFilesTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/classloader/ClassLoaderFilesTests.java @@ -45,38 +45,38 @@ public class ClassLoaderFilesTests { private ClassLoaderFiles files = new ClassLoaderFiles(); @Test - public void addFileNameMustNotBeNull() throws Exception { + public void addFileNameMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Name must not be null"); this.files.addFile(null, mock(ClassLoaderFile.class)); } @Test - public void addFileFileMustNotBeNull() throws Exception { + public void addFileFileMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("File must not be null"); this.files.addFile("test", null); } @Test - public void getFileWithNullName() throws Exception { + public void getFileWithNullName() { assertThat(this.files.getFile(null)).isNull(); } @Test - public void addAndGet() throws Exception { + public void addAndGet() { ClassLoaderFile file = new ClassLoaderFile(Kind.ADDED, new byte[10]); this.files.addFile("myfile", file); assertThat(this.files.getFile("myfile")).isEqualTo(file); } @Test - public void getMissing() throws Exception { + public void getMissing() { assertThat(this.files.getFile("missing")).isNull(); } @Test - public void addTwice() throws Exception { + public void addTwice() { ClassLoaderFile file1 = new ClassLoaderFile(Kind.ADDED, new byte[10]); ClassLoaderFile file2 = new ClassLoaderFile(Kind.MODIFIED, new byte[10]); this.files.addFile("myfile", file1); @@ -85,7 +85,7 @@ public class ClassLoaderFilesTests { } @Test - public void addTwiceInDifferentSourceFolders() throws Exception { + public void addTwiceInDifferentSourceFolders() { ClassLoaderFile file1 = new ClassLoaderFile(Kind.ADDED, new byte[10]); ClassLoaderFile file2 = new ClassLoaderFile(Kind.MODIFIED, new byte[10]); this.files.addFile("a", "myfile", file1); @@ -98,7 +98,7 @@ public class ClassLoaderFilesTests { } @Test - public void getSourceFolders() throws Exception { + public void getSourceFolders() { ClassLoaderFile file1 = new ClassLoaderFile(Kind.ADDED, new byte[10]); ClassLoaderFile file2 = new ClassLoaderFile(Kind.MODIFIED, new byte[10]); ClassLoaderFile file3 = new ClassLoaderFile(Kind.MODIFIED, new byte[10]); @@ -132,7 +132,7 @@ public class ClassLoaderFilesTests { } @Test - public void addAll() throws Exception { + public void addAll() { ClassLoaderFile file1 = new ClassLoaderFile(Kind.ADDED, new byte[10]); this.files.addFile("a", "myfile1", file1); ClassLoaderFiles toAdd = new ClassLoaderFiles(); @@ -151,7 +151,7 @@ public class ClassLoaderFilesTests { } @Test - public void getSize() throws Exception { + public void getSize() { this.files.addFile("s1", "n1", mock(ClassLoaderFile.class)); this.files.addFile("s1", "n2", mock(ClassLoaderFile.class)); this.files.addFile("s2", "n3", mock(ClassLoaderFile.class)); @@ -160,14 +160,14 @@ public class ClassLoaderFilesTests { } @Test - public void classLoaderFilesMustNotBeNull() throws Exception { + public void classLoaderFilesMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("ClassLoaderFiles must not be null"); new ClassLoaderFiles(null); } @Test - public void constructFromExistingSet() throws Exception { + public void constructFromExistingSet() { this.files.addFile("s1", "n1", mock(ClassLoaderFile.class)); this.files.addFile("s1", "n2", mock(ClassLoaderFile.class)); ClassLoaderFiles copy = new ClassLoaderFiles(this.files); diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/classloader/RestartClassLoaderTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/classloader/RestartClassLoaderTests.java index 6a70d51a5a..b985174649 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/classloader/RestartClassLoaderTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/classloader/RestartClassLoaderTests.java @@ -94,14 +94,14 @@ public class RestartClassLoaderTests { } @Test - public void parentMustNotBeNull() throws Exception { + public void parentMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Parent must not be null"); new RestartClassLoader(null, new URL[] {}); } @Test - public void updatedFilesMustNotBeNull() throws Exception { + public void updatedFilesMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("UpdatedFiles must not be null"); new RestartClassLoader(this.parentClassLoader, new URL[] {}, null); @@ -141,14 +141,14 @@ public class RestartClassLoaderTests { } @Test - public void getDeletedResource() throws Exception { + public void getDeletedResource() { String name = PACKAGE_PATH + "/Sample.txt"; this.updatedFiles.addFile(name, new ClassLoaderFile(Kind.DELETED, null)); assertThat(this.reloadClassLoader.getResource(name)).isEqualTo(null); } @Test - public void getDeletedResourceAsStream() throws Exception { + public void getDeletedResourceAsStream() { String name = PACKAGE_PATH + "/Sample.txt"; this.updatedFiles.addFile(name, new ClassLoaderFile(Kind.DELETED, null)); assertThat(this.reloadClassLoader.getResourceAsStream(name)).isEqualTo(null); diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/server/HttpRestartServerHandlerTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/server/HttpRestartServerHandlerTests.java index d51cda428b..43ec171324 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/server/HttpRestartServerHandlerTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/server/HttpRestartServerHandlerTests.java @@ -37,7 +37,7 @@ public class HttpRestartServerHandlerTests { public ExpectedException thrown = ExpectedException.none(); @Test - public void serverMustNotBeNull() throws Exception { + public void serverMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Server must not be null"); new HttpRestartServerHandler(null); diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/server/HttpRestartServerTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/server/HttpRestartServerTests.java index 1e52b24599..0ce748f009 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/server/HttpRestartServerTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/server/HttpRestartServerTests.java @@ -66,14 +66,14 @@ public class HttpRestartServerTests { } @Test - public void sourceFolderUrlFilterMustNotBeNull() throws Exception { + public void sourceFolderUrlFilterMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("SourceFolderUrlFilter must not be null"); new HttpRestartServer((SourceFolderUrlFilter) null); } @Test - public void restartServerMustNotBeNull() throws Exception { + public void restartServerMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("RestartServer must not be null"); new HttpRestartServer((RestartServer) null); diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/server/RestartServerTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/server/RestartServerTests.java index e2a9c4979f..d6d2704d08 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/server/RestartServerTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/server/RestartServerTests.java @@ -50,7 +50,7 @@ public class RestartServerTests { public TemporaryFolder temp = new TemporaryFolder(); @Test - public void sourceFolderUrlFilterMustNotBeNull() throws Exception { + public void sourceFolderUrlFilterMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("SourceFolderUrlFilter must not be null"); new RestartServer((SourceFolderUrlFilter) null); diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/client/HttpTunnelConnectionTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/client/HttpTunnelConnectionTests.java index 9851716969..8fc588ca30 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/client/HttpTunnelConnectionTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/client/HttpTunnelConnectionTests.java @@ -78,21 +78,21 @@ public class HttpTunnelConnectionTests { } @Test - public void urlMustNotBeNull() throws Exception { + public void urlMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("URL must not be empty"); new HttpTunnelConnection(null, this.requestFactory); } @Test - public void urlMustNotBeEmpty() throws Exception { + public void urlMustNotBeEmpty() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("URL must not be empty"); new HttpTunnelConnection("", this.requestFactory); } @Test - public void urlMustNotBeMalformed() throws Exception { + public void urlMustNotBeMalformed() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Malformed URL 'htttttp:///ttest'"); new HttpTunnelConnection("htttttp:///ttest", this.requestFactory); diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/client/TunnelClientTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/client/TunnelClientTests.java index 546c9f906d..b9e292d150 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/client/TunnelClientTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/client/TunnelClientTests.java @@ -47,14 +47,14 @@ public class TunnelClientTests { private MockTunnelConnection tunnelConnection = new MockTunnelConnection(); @Test - public void listenPortMustNotBeNegative() throws Exception { + public void listenPortMustNotBeNegative() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("ListenPort must be greater than or equal to 0"); new TunnelClient(-5, this.tunnelConnection); } @Test - public void tunnelConnectionMustNotBeNull() throws Exception { + public void tunnelConnectionMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("TunnelConnection must not be null"); new TunnelClient(1, null); @@ -123,7 +123,7 @@ public class TunnelClientTests { @Override public WritableByteChannel open(WritableByteChannel incomingChannel, - Closeable closeable) throws Exception { + Closeable closeable) { this.openedTimes++; this.open = true; return new TunnelChannel(incomingChannel, closeable); diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/payload/HttpTunnelPayloadForwarderTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/payload/HttpTunnelPayloadForwarderTests.java index 428463a59d..9f43bca767 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/payload/HttpTunnelPayloadForwarderTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/payload/HttpTunnelPayloadForwarderTests.java @@ -38,7 +38,7 @@ public class HttpTunnelPayloadForwarderTests { public ExpectedException thrown = ExpectedException.none(); @Test - public void targetChannelMustNotBeNull() throws Exception { + public void targetChannelMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("TargetChannel must not be null"); new HttpTunnelPayloadForwarder(null); diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/payload/HttpTunnelPayloadTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/payload/HttpTunnelPayloadTests.java index b2bdd511b8..26823629f9 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/payload/HttpTunnelPayloadTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/payload/HttpTunnelPayloadTests.java @@ -52,21 +52,21 @@ public class HttpTunnelPayloadTests { public ExpectedException thrown = ExpectedException.none(); @Test - public void sequenceMustBePositive() throws Exception { + public void sequenceMustBePositive() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Sequence must be positive"); new HttpTunnelPayload(0, ByteBuffer.allocate(1)); } @Test - public void dataMustNotBeNull() throws Exception { + public void dataMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Data must not be null"); new HttpTunnelPayload(1, null); } @Test - public void getSequence() throws Exception { + public void getSequence() { HttpTunnelPayload payload = new HttpTunnelPayload(1, ByteBuffer.allocate(1)); assertThat(payload.getSequence()).isEqualTo(1L); } diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/server/HttpTunnelServerHandlerTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/server/HttpTunnelServerHandlerTests.java index f82baa7f46..00023fe5ba 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/server/HttpTunnelServerHandlerTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/server/HttpTunnelServerHandlerTests.java @@ -37,7 +37,7 @@ public class HttpTunnelServerHandlerTests { public ExpectedException thrown = ExpectedException.none(); @Test - public void serverMustNotBeNull() throws Exception { + public void serverMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Server must not be null"); new HttpTunnelServerHandler(null); diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/server/HttpTunnelServerTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/server/HttpTunnelServerTests.java index 7647b0e5e3..1796cd346f 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/server/HttpTunnelServerTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/server/HttpTunnelServerTests.java @@ -102,7 +102,7 @@ public class HttpTunnelServerTests { } @Test - public void serverConnectionIsRequired() throws Exception { + public void serverConnectionIsRequired() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("ServerConnection must not be null"); new HttpTunnelServer(null); @@ -123,7 +123,7 @@ public class HttpTunnelServerTests { } @Test - public void longPollTimeoutMustBePositiveValue() throws Exception { + public void longPollTimeoutMustBePositiveValue() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("LongPollTimeout must be a positive value"); this.server.setLongPollTimeout(0); @@ -256,7 +256,7 @@ public class HttpTunnelServerTests { } @Test - public void disconnectTimeoutMustBePositive() throws Exception { + public void disconnectTimeoutMustBePositive() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("DisconnectTimeout must be a positive value"); this.server.setDisconnectTimeout(0); @@ -406,7 +406,7 @@ public class HttpTunnelServerTests { } @Override - public void close() throws IOException { + public void close() { this.open.set(false); } diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/server/StaticPortProviderTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/server/StaticPortProviderTests.java index 9a6a17a4a0..bdf4bb146c 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/server/StaticPortProviderTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/server/StaticPortProviderTests.java @@ -33,14 +33,14 @@ public class StaticPortProviderTests { public ExpectedException thrown = ExpectedException.none(); @Test - public void portMustBePositive() throws Exception { + public void portMustBePositive() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Port must be positive"); new StaticPortProvider(0); } @Test - public void getPort() throws Exception { + public void getPort() { StaticPortProvider provider = new StaticPortProvider(123); assertThat(provider.getPort()).isEqualTo(123); } diff --git a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/test/autoconfigure/restdocs/restassured/UserDocumentationTests.java b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/test/autoconfigure/restdocs/restassured/UserDocumentationTests.java index 84578e1e95..2278543125 100644 --- a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/test/autoconfigure/restdocs/restassured/UserDocumentationTests.java +++ b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/test/autoconfigure/restdocs/restassured/UserDocumentationTests.java @@ -44,7 +44,7 @@ public class UserDocumentationTests { private RequestSpecification documentationSpec; @Test - public void listUsers() throws Exception { + public void listUsers() { given(this.documentationSpec).filter(document("list-users")).when() .port(this.port).get("/").then().assertThat().statusCode(is(200)); } diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/OverrideAutoConfigurationContextCustomizerFactoryTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/OverrideAutoConfigurationContextCustomizerFactoryTests.java index 76dcd53b9a..ac34831f75 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/OverrideAutoConfigurationContextCustomizerFactoryTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/OverrideAutoConfigurationContextCustomizerFactoryTests.java @@ -32,31 +32,28 @@ public class OverrideAutoConfigurationContextCustomizerFactoryTests { private OverrideAutoConfigurationContextCustomizerFactory factory = new OverrideAutoConfigurationContextCustomizerFactory(); @Test - public void getContextCustomizerWhenHasNoAnnotationShouldReturnNull() - throws Exception { + public void getContextCustomizerWhenHasNoAnnotationShouldReturnNull() { ContextCustomizer customizer = this.factory .createContextCustomizer(NoAnnotation.class, null); assertThat(customizer).isNull(); } @Test - public void getContextCustomizerWhenHasAnnotationEnabledTrueShouldReturnNull() - throws Exception { + public void getContextCustomizerWhenHasAnnotationEnabledTrueShouldReturnNull() { ContextCustomizer customizer = this.factory .createContextCustomizer(WithAnnotationEnabledTrue.class, null); assertThat(customizer).isNull(); } @Test - public void getContextCustomizerWhenHasAnnotationEnabledFalseShouldReturnCustomizer() - throws Exception { + public void getContextCustomizerWhenHasAnnotationEnabledFalseShouldReturnCustomizer() { ContextCustomizer customizer = this.factory .createContextCustomizer(WithAnnotationEnabledFalse.class, null); assertThat(customizer).isNotNull(); } @Test - public void hashCodeAndEquals() throws Exception { + public void hashCodeAndEquals() { ContextCustomizer customizer1 = this.factory .createContextCustomizer(WithAnnotationEnabledFalse.class, null); ContextCustomizer customizer2 = this.factory diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/SpringBootDependencyInjectionTestExecutionListenerPostConstructIntegrationTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/SpringBootDependencyInjectionTestExecutionListenerPostConstructIntegrationTests.java index 4bfcc400d4..8eb824fb0f 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/SpringBootDependencyInjectionTestExecutionListenerPostConstructIntegrationTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/SpringBootDependencyInjectionTestExecutionListenerPostConstructIntegrationTests.java @@ -51,7 +51,7 @@ public class SpringBootDependencyInjectionTestExecutionListenerPostConstructInte } @Test - public void postConstructShouldBeInvokedOnlyOnce() throws Exception { + public void postConstructShouldBeInvokedOnlyOnce() { // gh-6874 assertThat(this.calls).hasSize(1); } diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/SpringBootDependencyInjectionTestExecutionListenerTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/SpringBootDependencyInjectionTestExecutionListenerTests.java index 9629a2e53d..79e977fa18 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/SpringBootDependencyInjectionTestExecutionListenerTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/SpringBootDependencyInjectionTestExecutionListenerTests.java @@ -53,8 +53,7 @@ public class SpringBootDependencyInjectionTestExecutionListenerTests { private SpringBootDependencyInjectionTestExecutionListener reportListener = new SpringBootDependencyInjectionTestExecutionListener(); @Test - public void orderShouldBeSameAsDependencyInjectionTestExecutionListener() - throws Exception { + public void orderShouldBeSameAsDependencyInjectionTestExecutionListener() { Ordered injectionListener = new DependencyInjectionTestExecutionListener(); assertThat(this.reportListener.getOrder()) .isEqualTo(injectionListener.getOrder()); diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/core/AutoConfigureCacheIntegrationTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/core/AutoConfigureCacheIntegrationTests.java index cb2d82bdeb..ba5e49480c 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/core/AutoConfigureCacheIntegrationTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/core/AutoConfigureCacheIntegrationTests.java @@ -44,7 +44,7 @@ public class AutoConfigureCacheIntegrationTests { private ApplicationContext applicationContext; @Test - public void shouldConfigureNoOpCacheManager() throws Exception { + public void shouldConfigureNoOpCacheManager() { CacheManager bean = this.applicationContext.getBean(CacheManager.class); assertThat(bean).isInstanceOf(NoOpCacheManager.class); } diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/filter/FilterAnnotationsTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/filter/FilterAnnotationsTests.java index b7585ad367..efe9f05c5e 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/filter/FilterAnnotationsTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/filter/FilterAnnotationsTests.java @@ -129,7 +129,7 @@ public class FilterAnnotationsTests { @Override public boolean match(MetadataReader metadataReader, - MetadataReaderFactory metadataReaderFactory) throws IOException { + MetadataReaderFactory metadataReaderFactory) { return metadataReader.getClassMetadata().getClassName() .equals(ExampleWithoutAnnotation.class.getName()); } diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/filter/TypeExcludeFiltersContextCustomizerFactoryTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/filter/TypeExcludeFiltersContextCustomizerFactoryTests.java index b7199c1583..b114e0b92b 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/filter/TypeExcludeFiltersContextCustomizerFactoryTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/filter/TypeExcludeFiltersContextCustomizerFactoryTests.java @@ -16,8 +16,6 @@ package org.springframework.boot.test.autoconfigure.filter; -import java.io.IOException; - import org.junit.Test; import org.springframework.boot.context.TypeExcludeFilter; @@ -47,23 +45,21 @@ public class TypeExcludeFiltersContextCustomizerFactoryTests { private ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(); @Test - public void getContextCustomizerWhenHasNoAnnotationShouldReturnNull() - throws Exception { + public void getContextCustomizerWhenHasNoAnnotationShouldReturnNull() { ContextCustomizer customizer = this.factory .createContextCustomizer(NoAnnotation.class, null); assertThat(customizer).isNull(); } @Test - public void getContextCustomizerWhenHasAnnotationShouldReturnCustomizer() - throws Exception { + public void getContextCustomizerWhenHasAnnotationShouldReturnCustomizer() { ContextCustomizer customizer = this.factory .createContextCustomizer(WithExcludeFilters.class, null); assertThat(customizer).isNotNull(); } @Test - public void hashCodeAndEquals() throws Exception { + public void hashCodeAndEquals() { ContextCustomizer customizer1 = this.factory .createContextCustomizer(WithExcludeFilters.class, null); ContextCustomizer customizer2 = this.factory @@ -117,7 +113,7 @@ public class TypeExcludeFiltersContextCustomizerFactoryTests { @Override public boolean match(MetadataReader metadataReader, - MetadataReaderFactory metadataReaderFactory) throws IOException { + MetadataReaderFactory metadataReaderFactory) { return metadataReader.getClassMetadata().getClassName() .equals(getClass().getName()); } diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/jdbc/AutoConfigureTestDatabaseWithNoDatabaseIntegrationTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/jdbc/AutoConfigureTestDatabaseWithNoDatabaseIntegrationTests.java index 2a5699a83a..b8aab15e6f 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/jdbc/AutoConfigureTestDatabaseWithNoDatabaseIntegrationTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/jdbc/AutoConfigureTestDatabaseWithNoDatabaseIntegrationTests.java @@ -41,7 +41,7 @@ public class AutoConfigureTestDatabaseWithNoDatabaseIntegrationTests { private ApplicationContext context; @Test - public void testContextLoads() throws Exception { + public void testContextLoads() { // gh-6897 assertThat(this.context).isNotNull(); assertThat(this.context.getBeanNamesForType(DataSource.class)).isNotEmpty(); diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/jooq/JooqTestIntegrationTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/jooq/JooqTestIntegrationTests.java index 832195b8da..a608cfd473 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/jooq/JooqTestIntegrationTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/jooq/JooqTestIntegrationTests.java @@ -72,7 +72,7 @@ public class JooqTestIntegrationTests { } @Test - public void didNotInjectExampleComponent() throws Exception { + public void didNotInjectExampleComponent() { this.thrown.expect(NoSuchBeanDefinitionException.class); this.applicationContext.getBean(ExampleComponent.class); } diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/json/JsonTestIntegrationTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/json/JsonTestIntegrationTests.java index f4ce184ae7..155c80a009 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/json/JsonTestIntegrationTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/json/JsonTestIntegrationTests.java @@ -65,7 +65,7 @@ public class JsonTestIntegrationTests { private JsonbTester jsonbJson; @Test - public void basicJson() throws Exception { + public void basicJson() { assertThat(this.basicJson.from("{\"a\":\"b\"}")).hasJsonPathStringValue("@.a"); } diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/json/JsonTestWithAutoConfigureJsonTestersTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/json/JsonTestWithAutoConfigureJsonTestersTests.java index 62b44ac09f..7afab23cb2 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/json/JsonTestWithAutoConfigureJsonTestersTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/json/JsonTestWithAutoConfigureJsonTestersTests.java @@ -55,22 +55,22 @@ public class JsonTestWithAutoConfigureJsonTestersTests { private JsonbTester jsonbTester; @Test - public void basicJson() throws Exception { + public void basicJson() { assertThat(this.basicJson).isNull(); } @Test - public void jackson() throws Exception { + public void jackson() { assertThat(this.jacksonTester).isNull(); } @Test - public void gson() throws Exception { + public void gson() { assertThat(this.gsonTester).isNull(); } @Test - public void jsonb() throws Exception { + public void jsonb() { assertThat(this.jsonbTester).isNull(); } diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/orm/jpa/DataJpaTestIntegrationTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/orm/jpa/DataJpaTestIntegrationTests.java index 779ae4baa7..63a686304a 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/orm/jpa/DataJpaTestIntegrationTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/orm/jpa/DataJpaTestIntegrationTests.java @@ -65,7 +65,7 @@ public class DataJpaTestIntegrationTests { private ApplicationContext applicationContext; @Test - public void testEntityManager() throws Exception { + public void testEntityManager() { ExampleEntity entity = this.entities.persist(new ExampleEntity("spring", "123")); this.entities.flush(); Object id = this.entities.getId(entity); @@ -74,7 +74,7 @@ public class DataJpaTestIntegrationTests { } @Test - public void testEntityManagerPersistAndGetId() throws Exception { + public void testEntityManagerPersistAndGetId() { Long id = this.entities.persistAndGetId(new ExampleEntity("spring", "123"), Long.class); assertThat(id).isNotNull(); @@ -85,7 +85,7 @@ public class DataJpaTestIntegrationTests { } @Test - public void testRepository() throws Exception { + public void testRepository() { this.entities.persist(new ExampleEntity("spring", "123")); this.entities.persist(new ExampleEntity("boot", "124")); this.entities.flush(); @@ -101,7 +101,7 @@ public class DataJpaTestIntegrationTests { } @Test - public void didNotInjectExampleComponent() throws Exception { + public void didNotInjectExampleComponent() { this.thrown.expect(NoSuchBeanDefinitionException.class); this.applicationContext.getBean(ExampleComponent.class); } diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/orm/jpa/TestEntityManagerTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/orm/jpa/TestEntityManagerTests.java index 23a48c8a2b..a24ed8f72b 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/orm/jpa/TestEntityManagerTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/orm/jpa/TestEntityManagerTests.java @@ -64,14 +64,14 @@ public class TestEntityManagerTests { } @Test - public void createWhenEntityManagerIsNullShouldThrowException() throws Exception { + public void createWhenEntityManagerIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("EntityManagerFactory must not be null"); new TestEntityManager(null); } @Test - public void persistAndGetIdShouldPersistAndGetId() throws Exception { + public void persistAndGetIdShouldPersistAndGetId() { bindEntityManager(); TestEntity entity = new TestEntity(); given(this.persistenceUnitUtil.getIdentifier(entity)).willReturn(123); @@ -81,7 +81,7 @@ public class TestEntityManagerTests { } @Test - public void persistAndGetIdForTypeShouldPersistAndGetId() throws Exception { + public void persistAndGetIdForTypeShouldPersistAndGetId() { bindEntityManager(); TestEntity entity = new TestEntity(); given(this.persistenceUnitUtil.getIdentifier(entity)).willReturn(123); @@ -91,7 +91,7 @@ public class TestEntityManagerTests { } @Test - public void persistShouldPersist() throws Exception { + public void persistShouldPersist() { bindEntityManager(); TestEntity entity = new TestEntity(); TestEntity result = this.testEntityManager.persist(entity); @@ -100,7 +100,7 @@ public class TestEntityManagerTests { } @Test - public void persistAndFlushShouldPersistAndFlush() throws Exception { + public void persistAndFlushShouldPersistAndFlush() { bindEntityManager(); TestEntity entity = new TestEntity(); TestEntity result = this.testEntityManager.persistAndFlush(entity); @@ -110,7 +110,7 @@ public class TestEntityManagerTests { } @Test - public void persistFlushFindShouldPersistAndFlushAndFind() throws Exception { + public void persistFlushFindShouldPersistAndFlushAndFind() { bindEntityManager(); TestEntity entity = new TestEntity(); TestEntity found = new TestEntity(); @@ -123,7 +123,7 @@ public class TestEntityManagerTests { } @Test - public void mergeShouldMerge() throws Exception { + public void mergeShouldMerge() { bindEntityManager(); TestEntity entity = new TestEntity(); given(this.entityManager.merge(entity)).willReturn(entity); @@ -133,7 +133,7 @@ public class TestEntityManagerTests { } @Test - public void removeShouldRemove() throws Exception { + public void removeShouldRemove() { bindEntityManager(); TestEntity entity = new TestEntity(); this.testEntityManager.remove(entity); @@ -141,7 +141,7 @@ public class TestEntityManagerTests { } @Test - public void findShouldFind() throws Exception { + public void findShouldFind() { bindEntityManager(); TestEntity entity = new TestEntity(); given(this.entityManager.find(TestEntity.class, 123)).willReturn(entity); @@ -150,14 +150,14 @@ public class TestEntityManagerTests { } @Test - public void flushShouldFlush() throws Exception { + public void flushShouldFlush() { bindEntityManager(); this.testEntityManager.flush(); verify(this.entityManager).flush(); } @Test - public void refreshShouldRefresh() throws Exception { + public void refreshShouldRefresh() { bindEntityManager(); TestEntity entity = new TestEntity(); this.testEntityManager.refresh(entity); @@ -165,14 +165,14 @@ public class TestEntityManagerTests { } @Test - public void clearShouldClear() throws Exception { + public void clearShouldClear() { bindEntityManager(); this.testEntityManager.clear(); verify(this.entityManager).clear(); } @Test - public void detachShouldDetach() throws Exception { + public void detachShouldDetach() { bindEntityManager(); TestEntity entity = new TestEntity(); this.testEntityManager.detach(entity); @@ -180,7 +180,7 @@ public class TestEntityManagerTests { } @Test - public void getIdForTypeShouldGetId() throws Exception { + public void getIdForTypeShouldGetId() { TestEntity entity = new TestEntity(); given(this.persistenceUnitUtil.getIdentifier(entity)).willReturn(123); Integer result = this.testEntityManager.getId(entity, Integer.class); @@ -188,7 +188,7 @@ public class TestEntityManagerTests { } @Test - public void getIdForTypeWhenTypeIsWrongShouldThrowException() throws Exception { + public void getIdForTypeWhenTypeIsWrongShouldThrowException() { TestEntity entity = new TestEntity(); given(this.persistenceUnitUtil.getIdentifier(entity)).willReturn(123); this.thrown.expectMessage("ID mismatch: Object of class [java.lang.Integer] " @@ -197,7 +197,7 @@ public class TestEntityManagerTests { } @Test - public void getIdShouldGetId() throws Exception { + public void getIdShouldGetId() { TestEntity entity = new TestEntity(); given(this.persistenceUnitUtil.getIdentifier(entity)).willReturn(123); Object result = this.testEntityManager.getId(entity); @@ -205,14 +205,14 @@ public class TestEntityManagerTests { } @Test - public void getEntityManagerShouldGetEntityManager() throws Exception { + public void getEntityManagerShouldGetEntityManager() { bindEntityManager(); assertThat(this.testEntityManager.getEntityManager()) .isEqualTo(this.entityManager); } @Test - public void getEntityManagerWhenNotSetShouldThrowException() throws Exception { + public void getEntityManagerWhenNotSetShouldThrowException() { this.thrown.expect(IllegalStateException.class); this.thrown.expectMessage("No transactional EntityManager found"); this.testEntityManager.getEntityManager(); diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/properties/AnnotationsPropertySourceTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/properties/AnnotationsPropertySourceTests.java index e1278c4dc5..73b8655449 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/properties/AnnotationsPropertySourceTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/properties/AnnotationsPropertySourceTests.java @@ -39,14 +39,14 @@ public class AnnotationsPropertySourceTests { public ExpectedException thrown = ExpectedException.none(); @Test - public void createWhenSourceIsNullShouldThrowException() throws Exception { + public void createWhenSourceIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Property source must not be null"); new AnnotationsPropertySource(null); } @Test - public void propertiesWhenHasNoAnnotationShouldBeEmpty() throws Exception { + public void propertiesWhenHasNoAnnotationShouldBeEmpty() { AnnotationsPropertySource source = new AnnotationsPropertySource( NoAnnotation.class); assertThat(source.getPropertyNames()).isEmpty(); @@ -54,16 +54,14 @@ public class AnnotationsPropertySourceTests { } @Test - public void propertiesWhenHasTypeLevelAnnotationShouldUseAttributeName() - throws Exception { + public void propertiesWhenHasTypeLevelAnnotationShouldUseAttributeName() { AnnotationsPropertySource source = new AnnotationsPropertySource(TypeLevel.class); assertThat(source.getPropertyNames()).containsExactly("value"); assertThat(source.getProperty("value")).isEqualTo("abc"); } @Test - public void propertiesWhenHasTypeLevelWithPrefixShouldUsePrefixedName() - throws Exception { + public void propertiesWhenHasTypeLevelWithPrefixShouldUsePrefixedName() { AnnotationsPropertySource source = new AnnotationsPropertySource( TypeLevelWithPrefix.class); assertThat(source.getPropertyNames()).containsExactly("test.value"); @@ -71,8 +69,7 @@ public class AnnotationsPropertySourceTests { } @Test - public void propertiesWhenHasAttributeLevelWithPrefixShouldUsePrefixedName() - throws Exception { + public void propertiesWhenHasAttributeLevelWithPrefixShouldUsePrefixedName() { AnnotationsPropertySource source = new AnnotationsPropertySource( AttributeLevelWithPrefix.class); assertThat(source.getPropertyNames()).containsExactly("test"); @@ -80,8 +77,7 @@ public class AnnotationsPropertySourceTests { } @Test - public void propertiesWhenHasTypeAndAttributeLevelWithPrefixShouldUsePrefixedName() - throws Exception { + public void propertiesWhenHasTypeAndAttributeLevelWithPrefixShouldUsePrefixedName() { AnnotationsPropertySource source = new AnnotationsPropertySource( TypeAndAttributeLevelWithPrefix.class); assertThat(source.getPropertyNames()).containsExactly("test.example"); @@ -89,8 +85,7 @@ public class AnnotationsPropertySourceTests { } @Test - public void propertiesWhenNotMappedAtTypeLevelShouldIgnoreAttributes() - throws Exception { + public void propertiesWhenNotMappedAtTypeLevelShouldIgnoreAttributes() { AnnotationsPropertySource source = new AnnotationsPropertySource( NotMappedAtTypeLevel.class); assertThat(source.getPropertyNames()).containsExactly("value"); @@ -98,8 +93,7 @@ public class AnnotationsPropertySourceTests { } @Test - public void propertiesWhenNotMappedAtAttributeLevelShouldIgnoreAttributes() - throws Exception { + public void propertiesWhenNotMappedAtAttributeLevelShouldIgnoreAttributes() { AnnotationsPropertySource source = new AnnotationsPropertySource( NotMappedAtAttributeLevel.class); assertThat(source.getPropertyNames()).containsExactly("value"); @@ -107,7 +101,7 @@ public class AnnotationsPropertySourceTests { } @Test - public void propertiesWhenContainsArraysShouldExpandNames() throws Exception { + public void propertiesWhenContainsArraysShouldExpandNames() { AnnotationsPropertySource source = new AnnotationsPropertySource(Arrays.class); assertThat(source.getPropertyNames()).contains("strings[0]", "strings[1]", "classes[0]", "classes[1]", "ints[0]", "ints[1]", "longs[0]", "longs[1]", @@ -130,14 +124,14 @@ public class AnnotationsPropertySourceTests { } @Test - public void propertiesWhenHasCamelCaseShouldConvertToKebabCase() throws Exception { + public void propertiesWhenHasCamelCaseShouldConvertToKebabCase() { AnnotationsPropertySource source = new AnnotationsPropertySource( CamelCaseToKebabCase.class); assertThat(source.getPropertyNames()).contains("camel-case-to-kebab-case"); } @Test - public void propertiesFromMetaAnnotationsAreMapped() throws Exception { + public void propertiesFromMetaAnnotationsAreMapped() { AnnotationsPropertySource source = new AnnotationsPropertySource( PropertiesFromSingleMetaAnnotation.class); assertThat(source.getPropertyNames()).containsExactly("value"); @@ -145,8 +139,7 @@ public class AnnotationsPropertySourceTests { } @Test - public void propertiesFromMultipleMetaAnnotationsAreMappedUsingTheirOwnPropertyMapping() - throws Exception { + public void propertiesFromMultipleMetaAnnotationsAreMappedUsingTheirOwnPropertyMapping() { AnnotationsPropertySource source = new AnnotationsPropertySource( PropertiesFromMultipleMetaAnnotations.class); assertThat(source.getPropertyNames()).containsExactly("value", "test.value", @@ -186,14 +179,14 @@ public class AnnotationsPropertySourceTests { } @Test - public void enumValueMapped() throws Exception { + public void enumValueMapped() { AnnotationsPropertySource source = new AnnotationsPropertySource( EnumValueMapped.class); assertThat(source.getProperty("testenum.value")).isEqualTo(EnumItem.TWO); } @Test - public void enumValueNotMapped() throws Exception { + public void enumValueNotMapped() { AnnotationsPropertySource source = new AnnotationsPropertySource( EnumValueNotMapped.class); assertThat(source.containsProperty("testenum.value")).isFalse(); diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/properties/PropertyMappingContextCustomizerFactoryTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/properties/PropertyMappingContextCustomizerFactoryTests.java index dfae4bf5d8..3163747b2f 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/properties/PropertyMappingContextCustomizerFactoryTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/properties/PropertyMappingContextCustomizerFactoryTests.java @@ -78,7 +78,7 @@ public class PropertyMappingContextCustomizerFactoryTests { } @Test - public void hashCodeAndEqualsShouldBeBasedOnPropertyValues() throws Exception { + public void hashCodeAndEqualsShouldBeBasedOnPropertyValues() { ContextCustomizer customizer1 = this.factory .createContextCustomizer(TypeMapping.class, null); ContextCustomizer customizer2 = this.factory @@ -91,7 +91,7 @@ public class PropertyMappingContextCustomizerFactoryTests { } @Test - public void prepareContextShouldAddPropertySource() throws Exception { + public void prepareContextShouldAddPropertySource() { ContextCustomizer customizer = this.factory .createContextCustomizer(AttributeMapping.class, null); AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); @@ -100,7 +100,7 @@ public class PropertyMappingContextCustomizerFactoryTests { } @Test - public void propertyMappingShouldNotBeUsedWithComponent() throws Exception { + public void propertyMappingShouldNotBeUsedWithComponent() { ContextCustomizer customizer = this.factory .createContextCustomizer(AttributeMapping.class, null); AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/properties/PropertyMappingTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/properties/PropertyMappingTests.java index 68fabb14e2..29be65d7bd 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/properties/PropertyMappingTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/properties/PropertyMappingTests.java @@ -38,7 +38,7 @@ public class PropertyMappingTests { private Environment environment; @Test - public void hasProperty() throws Exception { + public void hasProperty() { assertThat(this.environment.getProperty("example-property")).isEqualTo("abc"); } diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/restdocs/RestAssuredRestDocsAutoConfigurationAdvancedConfigurationIntegrationTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/restdocs/RestAssuredRestDocsAutoConfigurationAdvancedConfigurationIntegrationTests.java index 12a940d5d3..c824b1958a 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/restdocs/RestAssuredRestDocsAutoConfigurationAdvancedConfigurationIntegrationTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/restdocs/RestAssuredRestDocsAutoConfigurationAdvancedConfigurationIntegrationTests.java @@ -64,7 +64,7 @@ public class RestAssuredRestDocsAutoConfigurationAdvancedConfigurationIntegratio private RequestSpecification documentationSpec; @Test - public void snippetGeneration() throws Exception { + public void snippetGeneration() { given(this.documentationSpec) .filter(document("default-snippets", preprocessRequest(modifyUris().scheme("https") diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/restdocs/RestAssuredRestDocsAutoConfigurationIntegrationTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/restdocs/RestAssuredRestDocsAutoConfigurationIntegrationTests.java index bb83866447..99d3fa697a 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/restdocs/RestAssuredRestDocsAutoConfigurationIntegrationTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/restdocs/RestAssuredRestDocsAutoConfigurationIntegrationTests.java @@ -60,7 +60,7 @@ public class RestAssuredRestDocsAutoConfigurationIntegrationTests { private RequestSpecification documentationSpec; @Test - public void defaultSnippetsAreWritten() throws Exception { + public void defaultSnippetsAreWritten() { given(this.documentationSpec) .filter(document("default-snippets", preprocessRequest(modifyUris().scheme("https") diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/client/AutoConfigureMockRestServiceServerEnabledFalseIntegrationTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/client/AutoConfigureMockRestServiceServerEnabledFalseIntegrationTests.java index c2f3bd2606..8e88bc7942 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/client/AutoConfigureMockRestServiceServerEnabledFalseIntegrationTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/client/AutoConfigureMockRestServiceServerEnabledFalseIntegrationTests.java @@ -39,7 +39,7 @@ public class AutoConfigureMockRestServiceServerEnabledFalseIntegrationTests { private ApplicationContext applicationContext; @Test(expected = NoSuchBeanDefinitionException.class) - public void mockServerRestTemplateCustomizerShouldNotBeRegistered() throws Exception { + public void mockServerRestTemplateCustomizerShouldNotBeRegistered() { this.applicationContext.getBean(MockServerRestTemplateCustomizer.class); } diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/client/AutoConfigureWebClientWithRestTemplateIntegrationTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/client/AutoConfigureWebClientWithRestTemplateIntegrationTests.java index 8a72e137a7..439e3af875 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/client/AutoConfigureWebClientWithRestTemplateIntegrationTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/client/AutoConfigureWebClientWithRestTemplateIntegrationTests.java @@ -51,7 +51,7 @@ public class AutoConfigureWebClientWithRestTemplateIntegrationTests { private MockRestServiceServer server; @Test - public void restTemplateTest() throws Exception { + public void restTemplateTest() { this.server.expect(requestTo("/test")) .andRespond(withSuccess("hello", MediaType.TEXT_HTML)); ResponseEntity entity = this.restTemplate.getForEntity("/test", diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/client/RestClientRestIntegrationTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/client/RestClientRestIntegrationTests.java index 3776228686..317a96ef4d 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/client/RestClientRestIntegrationTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/client/RestClientRestIntegrationTests.java @@ -45,21 +45,21 @@ public class RestClientRestIntegrationTests { private ExampleRestClient client; @Test - public void mockServerCall1() throws Exception { + public void mockServerCall1() { this.server.expect(requestTo("/test")) .andRespond(withSuccess("1", MediaType.TEXT_HTML)); assertThat(this.client.test()).isEqualTo("1"); } @Test - public void mockServerCall2() throws Exception { + public void mockServerCall2() { this.server.expect(requestTo("/test")) .andRespond(withSuccess("2", MediaType.TEXT_HTML)); assertThat(this.client.test()).isEqualTo("2"); } @Test - public void mockServerCallWithContent() throws Exception { + public void mockServerCallWithContent() { this.server.expect(requestTo("/test")).andExpect(content().string("test")) .andRespond(withSuccess("1", MediaType.TEXT_HTML)); this.client.testPostWithBody("test"); diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/client/RestClientTestNoComponentIntegrationTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/client/RestClientTestNoComponentIntegrationTests.java index bc5a13e740..767c13c3d9 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/client/RestClientTestNoComponentIntegrationTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/client/RestClientTestNoComponentIntegrationTests.java @@ -50,12 +50,12 @@ public class RestClientTestNoComponentIntegrationTests { private MockRestServiceServer server; @Test(expected = NoSuchBeanDefinitionException.class) - public void exampleRestClientIsNotInjected() throws Exception { + public void exampleRestClientIsNotInjected() { this.applicationContext.getBean(ExampleRestClient.class); } @Test - public void manuallyCreateBean() throws Exception { + public void manuallyCreateBean() { ExampleRestClient client = new ExampleRestClient(this.restTemplateBuilder); this.server.expect(requestTo("/test")) .andRespond(withSuccess("hello", MediaType.TEXT_HTML)); diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/client/RestClientTestTwoComponentsIntegrationTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/client/RestClientTestTwoComponentsIntegrationTests.java index b944bc96ad..6fa8e10c2e 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/client/RestClientTestTwoComponentsIntegrationTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/client/RestClientTestTwoComponentsIntegrationTests.java @@ -56,7 +56,7 @@ public class RestClientTestTwoComponentsIntegrationTests { private MockRestServiceServer server; @Test - public void serverShouldNotWork() throws Exception { + public void serverShouldNotWork() { this.thrown.expect(IllegalStateException.class); this.thrown.expectMessage("Unable to use auto-configured"); this.server.expect(requestTo("/test")) @@ -64,7 +64,7 @@ public class RestClientTestTwoComponentsIntegrationTests { } @Test - public void client1RestCallViaCustomizer() throws Exception { + public void client1RestCallViaCustomizer() { this.customizer.getServer(this.client1.getRestTemplate()) .expect(requestTo("/test")) .andRespond(withSuccess("hello", MediaType.TEXT_HTML)); @@ -72,7 +72,7 @@ public class RestClientTestTwoComponentsIntegrationTests { } @Test - public void client2RestCallViaCustomizer() throws Exception { + public void client2RestCallViaCustomizer() { this.customizer.getServer(this.client2.getRestTemplate()) .expect(requestTo("/test")) .andRespond(withSuccess("there", MediaType.TEXT_HTML)); diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/client/RestClientTestWithComponentIntegrationTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/client/RestClientTestWithComponentIntegrationTests.java index 222ca301c7..ef9080b602 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/client/RestClientTestWithComponentIntegrationTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/client/RestClientTestWithComponentIntegrationTests.java @@ -44,7 +44,7 @@ public class RestClientTestWithComponentIntegrationTests { private ExampleRestClient client; @Test - public void mockServerCall() throws Exception { + public void mockServerCall() { this.server.expect(requestTo("/test")) .andRespond(withSuccess("hello", MediaType.TEXT_HTML)); assertThat(this.client.test()).isEqualTo("hello"); diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/reactive/WebTestClientAutoConfigurationTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/reactive/WebTestClientAutoConfigurationTests.java index f9a25cff69..8cda5379d4 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/reactive/WebTestClientAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/reactive/WebTestClientAutoConfigurationTests.java @@ -57,7 +57,7 @@ public class WebTestClientAutoConfigurationTests { } @Test - public void shouldCustomizeClientCodecs() throws Exception { + public void shouldCustomizeClientCodecs() { load(CodecConfiguration.class); WebTestClient webTestClient = this.context.getBean(WebTestClient.class); CodecCustomizer codecCustomizer = this.context.getBean(CodecCustomizer.class); @@ -66,7 +66,7 @@ public class WebTestClientAutoConfigurationTests { } @Test - public void shouldCustomizeTimeout() throws Exception { + public void shouldCustomizeTimeout() { PropertySource propertySource = new MapPropertySource("test", Collections .singletonMap("spring.test.webtestclient.timeout", (Object) "PT15M")); load(propertySource, BaseConfiguration.class); diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/reactive/webclient/WebTestClientSpringBootTestIntegrationTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/reactive/webclient/WebTestClientSpringBootTestIntegrationTests.java index 39464877ef..d2696e3f75 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/reactive/webclient/WebTestClientSpringBootTestIntegrationTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/reactive/webclient/WebTestClientSpringBootTestIntegrationTests.java @@ -64,7 +64,7 @@ public class WebTestClientSpringBootTestIntegrationTests { } @Test - public void shouldHaveRealService() throws Exception { + public void shouldHaveRealService() { assertThat(this.applicationContext.getBeansOfType(ExampleRealService.class)) .hasSize(1); } @@ -73,8 +73,7 @@ public class WebTestClientSpringBootTestIntegrationTests { static class TestConfiguration { @Bean - public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) - throws Exception { + public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) { http.authorizeExchange().anyExchange().permitAll(); return http.build(); } diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/mockmvc/MockMvcSpringBootTestIntegrationTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/mockmvc/MockMvcSpringBootTestIntegrationTests.java index 5736c20295..6f4a1d9f90 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/mockmvc/MockMvcSpringBootTestIntegrationTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/mockmvc/MockMvcSpringBootTestIntegrationTests.java @@ -80,7 +80,7 @@ public class MockMvcSpringBootTestIntegrationTests { } @Test - public void shouldHaveRealService() throws Exception { + public void shouldHaveRealService() { assertThat(this.applicationContext.getBean(ExampleRealService.class)).isNotNull(); } diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/mockmvc/WebMvcTestAllControllersIntegrationTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/mockmvc/WebMvcTestAllControllersIntegrationTests.java index 540a2d4d27..65417a2433 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/mockmvc/WebMvcTestAllControllersIntegrationTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/mockmvc/WebMvcTestAllControllersIntegrationTests.java @@ -85,7 +85,7 @@ public class WebMvcTestAllControllersIntegrationTests { } @Test - public void shouldNotFilterErrorAttributes() throws Exception { + public void shouldNotFilterErrorAttributes() { assertThat(this.errorAttributes).isNotNull(); } diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/mockmvc/WebMvcTestWebDriverCustomScopeIntegrationTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/mockmvc/WebMvcTestWebDriverCustomScopeIntegrationTests.java index e8f2e0b125..7f0f1f600b 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/mockmvc/WebMvcTestWebDriverCustomScopeIntegrationTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/mockmvc/WebMvcTestWebDriverCustomScopeIntegrationTests.java @@ -53,12 +53,12 @@ public class WebMvcTestWebDriverCustomScopeIntegrationTests { private WebDriver webDriver; @Test - public void shouldAutoConfigureWebClient() throws Exception { + public void shouldAutoConfigureWebClient() { WebMvcTestWebDriverCustomScopeIntegrationTests.previousWebDriver = this.webDriver; } @Test - public void shouldBeTheSameWebClient() throws Exception { + public void shouldBeTheSameWebClient() { assertThat(previousWebDriver).isNotNull().isSameAs(this.webDriver); } @@ -92,7 +92,7 @@ public class WebMvcTestWebDriverCustomScopeIntegrationTests { } @Override - public WebDriver getObject() throws Exception { + public WebDriver getObject() { return this.driver; } diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/mockmvc/WebMvcTestWebDriverIntegrationTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/mockmvc/WebMvcTestWebDriverIntegrationTests.java index ee5741ffd8..1d1f74cfcd 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/mockmvc/WebMvcTestWebDriverIntegrationTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/mockmvc/WebMvcTestWebDriverIntegrationTests.java @@ -49,7 +49,7 @@ public class WebMvcTestWebDriverIntegrationTests { private WebDriver webDriver; @Test - public void shouldAutoConfigureWebClient() throws Exception { + public void shouldAutoConfigureWebClient() { this.webDriver.get("/html"); WebElement element = this.webDriver.findElement(By.tagName("body")); assertThat(element.getText()).isEqualTo("Hello"); @@ -57,7 +57,7 @@ public class WebMvcTestWebDriverIntegrationTests { } @Test - public void shouldBeADifferentWebClient() throws Exception { + public void shouldBeADifferentWebClient() { this.webDriver.get("/html"); WebElement element = this.webDriver.findElement(By.tagName("body")); assertThat(element.getText()).isEqualTo("Hello"); diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/mockmvc/WebMvcTestWithAutoConfigureMockMvcIntegrationTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/mockmvc/WebMvcTestWithAutoConfigureMockMvcIntegrationTests.java index 0a0c513849..667cf7861e 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/mockmvc/WebMvcTestWithAutoConfigureMockMvcIntegrationTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/mockmvc/WebMvcTestWithAutoConfigureMockMvcIntegrationTests.java @@ -60,13 +60,13 @@ public class WebMvcTestWithAutoConfigureMockMvcIntegrationTests { } @Test - public void shouldNotHaveWebDriver() throws Exception { + public void shouldNotHaveWebDriver() { this.thrown.expect(NoSuchBeanDefinitionException.class); this.context.getBean(WebDriver.class); } @Test - public void shouldNotHaveWebClient() throws Exception { + public void shouldNotHaveWebClient() { this.thrown.expect(NoSuchBeanDefinitionException.class); this.context.getBean(WebClient.class); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/AbstractSpringBootTestEmbeddedReactiveWebEnvironmentTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/AbstractSpringBootTestEmbeddedReactiveWebEnvironmentTests.java index 501fbb49d8..e48d9ef345 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/AbstractSpringBootTestEmbeddedReactiveWebEnvironmentTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/AbstractSpringBootTestEmbeddedReactiveWebEnvironmentTests.java @@ -84,7 +84,7 @@ public abstract class AbstractSpringBootTestEmbeddedReactiveWebEnvironmentTests } @Test - public void annotationAttributesOverridePropertiesFile() throws Exception { + public void annotationAttributesOverridePropertiesFile() { assertThat(this.value).isEqualTo(123); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/AbstractSpringBootTestWebServerWebEnvironmentTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/AbstractSpringBootTestWebServerWebEnvironmentTests.java index 003100031d..96663e30a3 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/AbstractSpringBootTestWebServerWebEnvironmentTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/AbstractSpringBootTestWebServerWebEnvironmentTests.java @@ -82,7 +82,7 @@ public abstract class AbstractSpringBootTestWebServerWebEnvironmentTests { } @Test - public void annotationAttributesOverridePropertiesFile() throws Exception { + public void annotationAttributesOverridePropertiesFile() { assertThat(this.value).isEqualTo(123); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/ImportsContextCustomizerFactoryIntegrationTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/ImportsContextCustomizerFactoryIntegrationTests.java index 340e0fe267..c8214ae80d 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/ImportsContextCustomizerFactoryIntegrationTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/ImportsContextCustomizerFactoryIntegrationTests.java @@ -46,12 +46,12 @@ public class ImportsContextCustomizerFactoryIntegrationTests { private ImportedBean bean; @Test - public void beanWasImported() throws Exception { + public void beanWasImported() { assertThat(this.bean).isNotNull(); } @Test(expected = NoSuchBeanDefinitionException.class) - public void testItselfIsNotABean() throws Exception { + public void testItselfIsNotABean() { this.context.getBean(getClass()); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/ImportsContextCustomizerFactoryTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/ImportsContextCustomizerFactoryTests.java index 12c3e019d9..2c8cf79c39 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/ImportsContextCustomizerFactoryTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/ImportsContextCustomizerFactoryTests.java @@ -68,7 +68,7 @@ public class ImportsContextCustomizerFactoryTests { } @Test - public void contextCustomizerEqualsAndHashCode() throws Exception { + public void contextCustomizerEqualsAndHashCode() { ContextCustomizer customizer1 = this.factory .createContextCustomizer(TestWithImport.class, null); ContextCustomizer customizer2 = this.factory @@ -85,15 +85,14 @@ public class ImportsContextCustomizerFactoryTests { } @Test - public void getContextCustomizerWhenClassHasBeanMethodsShouldThrowException() - throws Exception { + public void getContextCustomizerWhenClassHasBeanMethodsShouldThrowException() { this.thrown.expect(IllegalStateException.class); this.thrown.expectMessage("Test classes cannot include @Bean methods"); this.factory.createContextCustomizer(TestWithImportAndBeanMethod.class, null); } @Test - public void contextCustomizerImportsBeans() throws Exception { + public void contextCustomizerImportsBeans() { ContextCustomizer customizer = this.factory .createContextCustomizer(TestWithImport.class, null); AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/ImportsContextCustomizerTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/ImportsContextCustomizerTests.java index bb5e851712..eba63d706e 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/ImportsContextCustomizerTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/ImportsContextCustomizerTests.java @@ -43,14 +43,14 @@ import static org.assertj.core.api.Assertions.assertThat; public class ImportsContextCustomizerTests { @Test - public void importSelectorsCouldUseAnyAnnotations() throws Exception { + public void importSelectorsCouldUseAnyAnnotations() { assertThat(new ImportsContextCustomizer(FirstImportSelectorAnnotatedClass.class)) .isNotEqualTo(new ImportsContextCustomizer( SecondImportSelectorAnnotatedClass.class)); } @Test - public void determinableImportSelector() throws Exception { + public void determinableImportSelector() { assertThat(new ImportsContextCustomizer( FirstDeterminableImportSelectorAnnotatedClass.class)) .isEqualTo(new ImportsContextCustomizer( diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootConfigurationFinderTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootConfigurationFinderTests.java index d1c76fd85b..d1899fca71 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootConfigurationFinderTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootConfigurationFinderTests.java @@ -38,14 +38,14 @@ public class SpringBootConfigurationFinderTests { private SpringBootConfigurationFinder finder = new SpringBootConfigurationFinder(); @Test - public void findFromClassWhenSourceIsNullShouldThrowException() throws Exception { + public void findFromClassWhenSourceIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Source must not be null"); this.finder.findFromClass((Class) null); } @Test - public void findFromPackageWhenSourceIsNullShouldThrowException() throws Exception { + public void findFromPackageWhenSourceIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Source must not be null"); this.finder.findFromPackage((String) null); diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootContextLoaderTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootContextLoaderTests.java index deccd2c9a3..c3312e715e 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootContextLoaderTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootContextLoaderTests.java @@ -89,8 +89,7 @@ public class SpringBootContextLoaderTests { assertKey(config, "variables", "foo=FOO\n bar=BAR"); } - private Map getEnvironmentProperties(Class testClass) - throws Exception { + private Map getEnvironmentProperties(Class testClass) { TestContext context = new ExposedTestContextManager(testClass) .getExposedTestContext(); MergedContextConfiguration config = (MergedContextConfiguration) ReflectionTestUtils diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestActiveProfileTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestActiveProfileTests.java index 96bca4a488..c524509ce3 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestActiveProfileTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestActiveProfileTests.java @@ -43,7 +43,7 @@ public class SpringBootTestActiveProfileTests { private ApplicationContext context; @Test - public void profiles() throws Exception { + public void profiles() { assertThat(this.context.getEnvironment().getActiveProfiles()) .containsExactly("override"); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestReactiveWebEnvironmentUserDefinedTestRestTemplateTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestReactiveWebEnvironmentUserDefinedTestRestTemplateTests.java index 8bcf236acd..52ff98cc45 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestReactiveWebEnvironmentUserDefinedTestRestTemplateTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestReactiveWebEnvironmentUserDefinedTestRestTemplateTests.java @@ -44,7 +44,7 @@ public class SpringBootTestReactiveWebEnvironmentUserDefinedTestRestTemplateTest extends AbstractSpringBootTestEmbeddedReactiveWebEnvironmentTests { @Test - public void restTemplateIsUserDefined() throws Exception { + public void restTemplateIsUserDefined() { assertThat(getContext().getBean("testRestTemplate")) .isInstanceOf(RestTemplate.class); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestUserDefinedTestRestTemplateTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestUserDefinedTestRestTemplateTests.java index 02b5c3d1f3..1e97c83121 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestUserDefinedTestRestTemplateTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestUserDefinedTestRestTemplateTests.java @@ -44,7 +44,7 @@ public class SpringBootTestUserDefinedTestRestTemplateTests extends AbstractSpringBootTestWebServerWebEnvironmentTests { @Test - public void restTemplateIsUserDefined() throws Exception { + public void restTemplateIsUserDefined() { assertThat(getContext().getBean("testRestTemplate")) .isInstanceOf(RestTemplate.class); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestWebEnvironmentContextHierarchyTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestWebEnvironmentContextHierarchyTests.java index 2f8e628784..a6fefa8f8e 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestWebEnvironmentContextHierarchyTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestWebEnvironmentContextHierarchyTests.java @@ -54,7 +54,7 @@ public class SpringBootTestWebEnvironmentContextHierarchyTests { private ApplicationContext context; @Test - public void testShouldOnlyStartSingleServer() throws Exception { + public void testShouldOnlyStartSingleServer() { ApplicationContext parent = this.context.getParent(); assertThat(this.context).isInstanceOf(WebApplicationContext.class); assertThat(parent).isNotInstanceOf(WebApplicationContext.class); diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestWebEnvironmentMockTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestWebEnvironmentMockTests.java index 985a7a6c6e..8ae6a30751 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestWebEnvironmentMockTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestWebEnvironmentMockTests.java @@ -59,7 +59,7 @@ public class SpringBootTestWebEnvironmentMockTests { private ServletContext servletContext; @Test - public void annotationAttributesOverridePropertiesFile() throws Exception { + public void annotationAttributesOverridePropertiesFile() { assertThat(this.value).isEqualTo(123); } @@ -71,13 +71,13 @@ public class SpringBootTestWebEnvironmentMockTests { } @Test - public void setsRequestContextHolder() throws Exception { + public void setsRequestContextHolder() { RequestAttributes attributes = RequestContextHolder.getRequestAttributes(); assertThat(attributes).isNotNull(); } @Test - public void resourcePath() throws Exception { + public void resourcePath() { assertThat(ReflectionTestUtils.getField(this.servletContext, "resourceBasePath")) .isEqualTo("src/main/webapp"); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestWebEnvironmentMockWithWebAppConfigurationTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestWebEnvironmentMockWithWebAppConfigurationTests.java index 7d4570e8e3..032ffdb349 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestWebEnvironmentMockWithWebAppConfigurationTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestWebEnvironmentMockWithWebAppConfigurationTests.java @@ -50,7 +50,7 @@ public class SpringBootTestWebEnvironmentMockWithWebAppConfigurationTests { private ServletContext servletContext; @Test - public void resourcePath() throws Exception { + public void resourcePath() { assertThat(ReflectionTestUtils.getField(this.servletContext, "resourceBasePath")) .isEqualTo("src/mymain/mywebapp"); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestWebEnvironmentRandomPortTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestWebEnvironmentRandomPortTests.java index 3180007aa5..1d1233da31 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestWebEnvironmentRandomPortTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestWebEnvironmentRandomPortTests.java @@ -44,7 +44,7 @@ public class SpringBootTestWebEnvironmentRandomPortTests extends AbstractSpringBootTestWebServerWebEnvironmentTests { @Test - public void testRestTemplateShouldUseBuilder() throws Exception { + public void testRestTemplateShouldUseBuilder() { assertThat(getRestTemplate().getRestTemplate().getMessageConverters()) .hasAtLeastOneElementOfType(MyConverter.class); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestWithClassesIntegrationTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestWithClassesIntegrationTests.java index 06ec8408ce..36c140123b 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestWithClassesIntegrationTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestWithClassesIntegrationTests.java @@ -47,7 +47,7 @@ public class SpringBootTestWithClassesIntegrationTests { private ApplicationContext context; @Test - public void injectsOnlyConfig() throws Exception { + public void injectsOnlyConfig() { assertThat(this.context.getBean(Config.class)).isNotNull(); this.thrown.expect(NoSuchBeanDefinitionException.class); this.context.getBean(AdditionalConfig.class); diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestWithContextConfigurationIntegrationTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestWithContextConfigurationIntegrationTests.java index d41c1a0bd0..d4f2e0c66d 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestWithContextConfigurationIntegrationTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestWithContextConfigurationIntegrationTests.java @@ -49,7 +49,7 @@ public class SpringBootTestWithContextConfigurationIntegrationTests { private ApplicationContext context; @Test - public void injectsOnlyConfig() throws Exception { + public void injectsOnlyConfig() { assertThat(this.context.getBean(Config.class)).isNotNull(); this.thrown.expect(NoSuchBeanDefinitionException.class); this.context.getBean(AdditionalConfig.class); diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/assertj/ApplicationContextAssertProviderTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/assertj/ApplicationContextAssertProviderTests.java index 0b78be53fa..d2c2894fc2 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/assertj/ApplicationContextAssertProviderTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/assertj/ApplicationContextAssertProviderTests.java @@ -64,7 +64,7 @@ public class ApplicationContextAssertProviderTests { } @Test - public void getWhenTypeIsNullShouldThrowException() throws Exception { + public void getWhenTypeIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Type must not be null"); ApplicationContextAssertProvider.get(null, ApplicationContext.class, @@ -72,7 +72,7 @@ public class ApplicationContextAssertProviderTests { } @Test - public void getWhenTypeIsClassShouldThrowException() throws Exception { + public void getWhenTypeIsClassShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Type must not be null"); ApplicationContextAssertProvider.get(null, ApplicationContext.class, @@ -80,7 +80,7 @@ public class ApplicationContextAssertProviderTests { } @Test - public void getWhenContextTypeIsNullShouldThrowException() throws Exception { + public void getWhenContextTypeIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Type must be an interface"); ApplicationContextAssertProvider.get( @@ -89,7 +89,7 @@ public class ApplicationContextAssertProviderTests { } @Test - public void getWhenContextTypeIsClassShouldThrowException() throws Exception { + public void getWhenContextTypeIsClassShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("ContextType must not be null"); ApplicationContextAssertProvider.get(TestAssertProviderApplicationContext.class, @@ -97,7 +97,7 @@ public class ApplicationContextAssertProviderTests { } @Test - public void getWhenSupplierIsNullShouldThrowException() throws Exception { + public void getWhenSupplierIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("ContextType must be an interface"); ApplicationContextAssertProvider.get(TestAssertProviderApplicationContext.class, @@ -105,8 +105,7 @@ public class ApplicationContextAssertProviderTests { } @Test - public void getWhenContextStartsShouldReturnProxyThatCallsRealMethods() - throws Exception { + public void getWhenContextStartsShouldReturnProxyThatCallsRealMethods() { ApplicationContextAssertProvider context = get( this.mockContextSupplier); assertThat((Object) context).isNotNull(); @@ -115,8 +114,7 @@ public class ApplicationContextAssertProviderTests { } @Test - public void getWhenContextFailsShouldReturnProxyThatThrowsExceptions() - throws Exception { + public void getWhenContextFailsShouldReturnProxyThatThrowsExceptions() { ApplicationContextAssertProvider context = get( this.startupFailureSupplier); assertThat((Object) context).isNotNull(); @@ -125,15 +123,14 @@ public class ApplicationContextAssertProviderTests { } @Test - public void getSourceContextWhenContextStartsShouldReturnSourceContext() - throws Exception { + public void getSourceContextWhenContextStartsShouldReturnSourceContext() { ApplicationContextAssertProvider context = get( this.mockContextSupplier); assertThat(context.getSourceApplicationContext()).isSameAs(this.mockContext); } @Test - public void getSourceContextWhenContextFailsShouldThrowException() throws Exception { + public void getSourceContextWhenContextFailsShouldThrowException() { ApplicationContextAssertProvider context = get( this.startupFailureSupplier); expectStartupFailure(); @@ -141,8 +138,7 @@ public class ApplicationContextAssertProviderTests { } @Test - public void getSourceContextOfTypeWhenContextStartsShouldReturnSourceContext() - throws Exception { + public void getSourceContextOfTypeWhenContextStartsShouldReturnSourceContext() { ApplicationContextAssertProvider context = get( this.mockContextSupplier); assertThat(context.getSourceApplicationContext(ApplicationContext.class)) @@ -150,8 +146,7 @@ public class ApplicationContextAssertProviderTests { } @Test - public void getSourceContextOfTypeWhenContextFailsToStartShouldThrowException() - throws Exception { + public void getSourceContextOfTypeWhenContextFailsToStartShouldThrowException() { ApplicationContextAssertProvider context = get( this.startupFailureSupplier); expectStartupFailure(); @@ -159,22 +154,21 @@ public class ApplicationContextAssertProviderTests { } @Test - public void getStartupFailureWhenContextStartsShouldReturnNull() throws Exception { + public void getStartupFailureWhenContextStartsShouldReturnNull() { ApplicationContextAssertProvider context = get( this.mockContextSupplier); assertThat(context.getStartupFailure()).isNull(); } @Test - public void getStartupFailureWhenContextFailsToStartShouldReturnException() - throws Exception { + public void getStartupFailureWhenContextFailsToStartShouldReturnException() { ApplicationContextAssertProvider context = get( this.startupFailureSupplier); assertThat(context.getStartupFailure()).isEqualTo(this.startupFailure); } @Test - public void assertThatWhenContextStartsShouldReturnAssertions() throws Exception { + public void assertThatWhenContextStartsShouldReturnAssertions() { ApplicationContextAssertProvider context = get( this.mockContextSupplier); ApplicationContextAssert contextAssert = assertThat(context); @@ -183,7 +177,7 @@ public class ApplicationContextAssertProviderTests { } @Test - public void assertThatWhenContextFailsShouldReturnAssertions() throws Exception { + public void assertThatWhenContextFailsShouldReturnAssertions() { ApplicationContextAssertProvider context = get( this.startupFailureSupplier); ApplicationContextAssert contextAssert = assertThat(context); @@ -192,7 +186,7 @@ public class ApplicationContextAssertProviderTests { } @Test - public void toStringWhenContextStartsShouldReturnSimpleString() throws Exception { + public void toStringWhenContextStartsShouldReturnSimpleString() { ApplicationContextAssertProvider context = get( this.mockContextSupplier); assertThat(context.toString()) @@ -202,8 +196,7 @@ public class ApplicationContextAssertProviderTests { } @Test - public void toStringWhenContextFailsToStartShouldReturnSimpleString() - throws Exception { + public void toStringWhenContextFailsToStartShouldReturnSimpleString() { ApplicationContextAssertProvider context = get( this.startupFailureSupplier); assertThat(context.toString()).isEqualTo("Unstarted application context " @@ -212,7 +205,7 @@ public class ApplicationContextAssertProviderTests { } @Test - public void closeShouldCloseContext() throws Exception { + public void closeShouldCloseContext() { ApplicationContextAssertProvider context = get( this.mockContextSupplier); context.close(); diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/bootstrap/SpringBootTestContextBootstrapperIntegrationTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/bootstrap/SpringBootTestContextBootstrapperIntegrationTests.java index 115141669c..32d144a5cb 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/bootstrap/SpringBootTestContextBootstrapperIntegrationTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/bootstrap/SpringBootTestContextBootstrapperIntegrationTests.java @@ -48,23 +48,22 @@ public class SpringBootTestContextBootstrapperIntegrationTests { boolean defaultTestExecutionListenersPostProcessorCalled = false; @Test - public void findConfigAutomatically() throws Exception { + public void findConfigAutomatically() { assertThat(this.config).isNotNull(); } @Test - public void contextWasCreatedViaSpringApplication() throws Exception { + public void contextWasCreatedViaSpringApplication() { assertThat(this.context.getId()).startsWith("application:"); } @Test - public void testConfigurationWasApplied() throws Exception { + public void testConfigurationWasApplied() { assertThat(this.context.getBean(ExampleBean.class)).isNotNull(); } @Test - public void defaultTestExecutionListenersPostProcessorShouldBeCalled() - throws Exception { + public void defaultTestExecutionListenersPostProcessorShouldBeCalled() { assertThat(this.defaultTestExecutionListenersPostProcessorCalled).isTrue(); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/bootstrap/SpringBootTestContextBootstrapperWithContextConfigurationTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/bootstrap/SpringBootTestContextBootstrapperWithContextConfigurationTests.java index c80c328a6b..b04e59949f 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/bootstrap/SpringBootTestContextBootstrapperWithContextConfigurationTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/bootstrap/SpringBootTestContextBootstrapperWithContextConfigurationTests.java @@ -46,12 +46,12 @@ public class SpringBootTestContextBootstrapperWithContextConfigurationTests { private SpringBootTestContextBootstrapperExampleConfig config; @Test - public void findConfigAutomatically() throws Exception { + public void findConfigAutomatically() { assertThat(this.config).isNotNull(); } @Test - public void contextWasCreatedViaSpringApplication() throws Exception { + public void contextWasCreatedViaSpringApplication() { assertThat(this.context.getId()).startsWith("application:"); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/bootstrap/SpringBootTestContextBootstrapperWithInitializersTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/bootstrap/SpringBootTestContextBootstrapperWithInitializersTests.java index e7783705d0..f4db8941e9 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/bootstrap/SpringBootTestContextBootstrapperWithInitializersTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/bootstrap/SpringBootTestContextBootstrapperWithInitializersTests.java @@ -46,7 +46,7 @@ public class SpringBootTestContextBootstrapperWithInitializersTests { private ApplicationContext context; @Test - public void foundConfiguration() throws Exception { + public void foundConfiguration() { Object bean = this.context .getBean(SpringBootTestContextBootstrapperExampleConfig.class); assertThat(bean).isNotNull(); diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/runner/AbstractApplicationContextRunnerTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/runner/AbstractApplicationContextRunnerTests.java index dcc9abcc3b..fe5619321e 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/runner/AbstractApplicationContextRunnerTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/runner/AbstractApplicationContextRunnerTests.java @@ -61,8 +61,7 @@ public abstract class AbstractApplicationContextRunnerTests { Environment environment = context.getEnvironment(); @@ -116,8 +113,7 @@ public abstract class AbstractApplicationContextRunnerTests { Environment environment = context.getEnvironment(); @@ -126,28 +122,26 @@ public abstract class AbstractApplicationContextRunnerTests assertThat(context).hasBean("foo")); } @Test - public void runWithMultipleConfigurationsShouldRegisterAllConfigurations() - throws Exception { + public void runWithMultipleConfigurationsShouldRegisterAllConfigurations() { get().withUserConfiguration(FooConfig.class) .withConfiguration(UserConfigurations.of(BarConfig.class)) .run((context) -> assertThat(context).hasBean("foo").hasBean("bar")); } @Test - public void runWithFailedContextShouldReturnFailedAssertableContext() - throws Exception { + public void runWithFailedContextShouldReturnFailedAssertableContext() { get().withUserConfiguration(FailingConfig.class) .run((context) -> assertThat(context).hasFailed()); } @Test - public void runWithClassLoaderShouldSetClassLoader() throws Exception { + public void runWithClassLoaderShouldSetClassLoader() { get().withClassLoader(new FilteredClassLoader(Gson.class.getPackage().getName())) .run((context) -> { try { diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/runner/WebApplicationContextRunnerTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/runner/WebApplicationContextRunnerTests.java index b851fe6488..1167199610 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/runner/WebApplicationContextRunnerTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/runner/WebApplicationContextRunnerTests.java @@ -34,7 +34,7 @@ public class WebApplicationContextRunnerTests extends AbstractApplicationContextRunnerTests { @Test - public void contextShouldHaveMockServletContext() throws Exception { + public void contextShouldHaveMockServletContext() { get().run((context) -> assertThat(context.getServletContext()) .isInstanceOf(MockServletContext.class)); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/json/AbstractJsonMarshalTesterTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/json/AbstractJsonMarshalTesterTests.java index 04ded77ad6..84c2f324ef 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/json/AbstractJsonMarshalTesterTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/json/AbstractJsonMarshalTesterTests.java @@ -96,14 +96,14 @@ public abstract class AbstractJsonMarshalTesterTests { } @Test - public void createWhenResourceLoadClassIsNullShouldThrowException() throws Exception { + public void createWhenResourceLoadClassIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("ResourceLoadClass must not be null"); createTester(null, ResolvableType.forClass(ExampleObject.class)); } @Test - public void createWhenTypeIsNullShouldThrowException() throws Exception { + public void createWhenTypeIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Type must not be null"); createTester(getClass(), null); diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/json/BasicJsonTesterTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/json/BasicJsonTesterTests.java index fa051528ba..a34907f748 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/json/BasicJsonTesterTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/json/BasicJsonTesterTests.java @@ -49,29 +49,29 @@ public class BasicJsonTesterTests { private BasicJsonTester json = new BasicJsonTester(getClass()); @Test - public void createWhenResourceLoadClassIsNullShouldThrowException() throws Exception { + public void createWhenResourceLoadClassIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("ResourceLoadClass must not be null"); new BasicJsonTester(null); } @Test - public void fromJsonStringShouldReturnJsonContent() throws Exception { + public void fromJsonStringShouldReturnJsonContent() { assertThat(this.json.from(JSON)).isEqualToJson("source.json"); } @Test - public void fromResourceStringShouldReturnJsonContent() throws Exception { + public void fromResourceStringShouldReturnJsonContent() { assertThat(this.json.from("source.json")).isEqualToJson(JSON); } @Test - public void fromResourceStringWithClassShouldReturnJsonContent() throws Exception { + public void fromResourceStringWithClassShouldReturnJsonContent() { assertThat(this.json.from("source.json", getClass())).isEqualToJson(JSON); } @Test - public void fromByteArrayShouldReturnJsonContent() throws Exception { + public void fromByteArrayShouldReturnJsonContent() { assertThat(this.json.from(JSON.getBytes())).isEqualToJson("source.json"); } @@ -83,13 +83,13 @@ public class BasicJsonTesterTests { } @Test - public void fromInputStreamShouldReturnJsonContent() throws Exception { + public void fromInputStreamShouldReturnJsonContent() { InputStream inputStream = new ByteArrayInputStream(JSON.getBytes()); assertThat(this.json.from(inputStream)).isEqualToJson("source.json"); } @Test - public void fromResourceShouldReturnJsonContent() throws Exception { + public void fromResourceShouldReturnJsonContent() { Resource resource = new ByteArrayResource(JSON.getBytes()); assertThat(this.json.from(resource)).isEqualToJson("source.json"); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/json/JsonContentAssertTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/json/JsonContentAssertTests.java index 543041befb..5c2cc855cf 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/json/JsonContentAssertTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/json/JsonContentAssertTests.java @@ -67,37 +67,37 @@ public class JsonContentAssertTests { public TemporaryFolder tempFolder = new TemporaryFolder(); @Test - public void isEqualToWhenStringIsMatchingShouldPass() throws Exception { + public void isEqualToWhenStringIsMatchingShouldPass() { assertThat(forJson(SOURCE)).isEqualTo(LENIENT_SAME); } @Test(expected = AssertionError.class) - public void isEqualToWhenNullActualShouldFail() throws Exception { + public void isEqualToWhenNullActualShouldFail() { assertThat(forJson(null)).isEqualTo(SOURCE); } @Test(expected = AssertionError.class) - public void isEqualToWhenStringIsNotMatchingShouldFail() throws Exception { + public void isEqualToWhenStringIsNotMatchingShouldFail() { assertThat(forJson(SOURCE)).isEqualTo(DIFFERENT); } @Test - public void isEqualToWhenResourcePathIsMatchingShouldPass() throws Exception { + public void isEqualToWhenResourcePathIsMatchingShouldPass() { assertThat(forJson(SOURCE)).isEqualTo("lenient-same.json"); } @Test(expected = AssertionError.class) - public void isEqualToWhenResourcePathIsNotMatchingShouldFail() throws Exception { + public void isEqualToWhenResourcePathIsNotMatchingShouldFail() { assertThat(forJson(SOURCE)).isEqualTo("different.json"); } @Test - public void isEqualToWhenBytesAreMatchingShouldPass() throws Exception { + public void isEqualToWhenBytesAreMatchingShouldPass() { assertThat(forJson(SOURCE)).isEqualTo(LENIENT_SAME.getBytes()); } @Test(expected = AssertionError.class) - public void isEqualToWhenBytesAreNotMatchingShouldFail() throws Exception { + public void isEqualToWhenBytesAreNotMatchingShouldFail() { assertThat(forJson(SOURCE)).isEqualTo(DIFFERENT.getBytes()); } @@ -132,49 +132,47 @@ public class JsonContentAssertTests { } @Test - public void isEqualToJsonWhenStringIsMatchingShouldPass() throws Exception { + public void isEqualToJsonWhenStringIsMatchingShouldPass() { assertThat(forJson(SOURCE)).isEqualToJson(LENIENT_SAME); } @Test(expected = AssertionError.class) - public void isEqualToJsonWhenNullActualShouldFail() throws Exception { + public void isEqualToJsonWhenNullActualShouldFail() { assertThat(forJson(null)).isEqualToJson(SOURCE); } @Test(expected = AssertionError.class) - public void isEqualToJsonWhenStringIsNotMatchingShouldFail() throws Exception { + public void isEqualToJsonWhenStringIsNotMatchingShouldFail() { assertThat(forJson(SOURCE)).isEqualToJson(DIFFERENT); } @Test - public void isEqualToJsonWhenResourcePathIsMatchingShouldPass() throws Exception { + public void isEqualToJsonWhenResourcePathIsMatchingShouldPass() { assertThat(forJson(SOURCE)).isEqualToJson("lenient-same.json"); } @Test(expected = AssertionError.class) - public void isEqualToJsonWhenResourcePathIsNotMatchingShouldFail() throws Exception { + public void isEqualToJsonWhenResourcePathIsNotMatchingShouldFail() { assertThat(forJson(SOURCE)).isEqualToJson("different.json"); } @Test - public void isEqualToJsonWhenResourcePathAndClassIsMatchingShouldPass() - throws Exception { + public void isEqualToJsonWhenResourcePathAndClassIsMatchingShouldPass() { assertThat(forJson(SOURCE)).isEqualToJson("lenient-same.json", getClass()); } @Test(expected = AssertionError.class) - public void isEqualToJsonWhenResourcePathAndClassIsNotMatchingShouldFail() - throws Exception { + public void isEqualToJsonWhenResourcePathAndClassIsNotMatchingShouldFail() { assertThat(forJson(SOURCE)).isEqualToJson("different.json", getClass()); } @Test - public void isEqualToJsonWhenBytesAreMatchingShouldPass() throws Exception { + public void isEqualToJsonWhenBytesAreMatchingShouldPass() { assertThat(forJson(SOURCE)).isEqualToJson(LENIENT_SAME.getBytes()); } @Test(expected = AssertionError.class) - public void isEqualToJsonWhenBytesAreNotMatchingShouldFail() throws Exception { + public void isEqualToJsonWhenBytesAreNotMatchingShouldFail() { assertThat(forJson(SOURCE)).isEqualToJson(DIFFERENT.getBytes()); } @@ -209,49 +207,43 @@ public class JsonContentAssertTests { } @Test - public void isStrictlyEqualToJsonWhenStringIsMatchingShouldPass() throws Exception { + public void isStrictlyEqualToJsonWhenStringIsMatchingShouldPass() { assertThat(forJson(SOURCE)).isStrictlyEqualToJson(SOURCE); } @Test(expected = AssertionError.class) - public void isStrictlyEqualToJsonWhenStringIsNotMatchingShouldFail() - throws Exception { + public void isStrictlyEqualToJsonWhenStringIsNotMatchingShouldFail() { assertThat(forJson(SOURCE)).isStrictlyEqualToJson(LENIENT_SAME); } @Test - public void isStrictlyEqualToJsonWhenResourcePathIsMatchingShouldPass() - throws Exception { + public void isStrictlyEqualToJsonWhenResourcePathIsMatchingShouldPass() { assertThat(forJson(SOURCE)).isStrictlyEqualToJson("source.json"); } @Test(expected = AssertionError.class) - public void isStrictlyEqualToJsonWhenResourcePathIsNotMatchingShouldFail() - throws Exception { + public void isStrictlyEqualToJsonWhenResourcePathIsNotMatchingShouldFail() { assertThat(forJson(SOURCE)).isStrictlyEqualToJson("lenient-same.json"); } @Test - public void isStrictlyEqualToJsonWhenResourcePathAndClassIsMatchingShouldPass() - throws Exception { + public void isStrictlyEqualToJsonWhenResourcePathAndClassIsMatchingShouldPass() { assertThat(forJson(SOURCE)).isStrictlyEqualToJson("source.json", getClass()); } @Test(expected = AssertionError.class) - public void isStrictlyEqualToJsonWhenResourcePathAndClassIsNotMatchingShouldFail() - throws Exception { + public void isStrictlyEqualToJsonWhenResourcePathAndClassIsNotMatchingShouldFail() { assertThat(forJson(SOURCE)).isStrictlyEqualToJson("lenient-same.json", getClass()); } @Test - public void isStrictlyEqualToJsonWhenBytesAreMatchingShouldPass() throws Exception { + public void isStrictlyEqualToJsonWhenBytesAreMatchingShouldPass() { assertThat(forJson(SOURCE)).isStrictlyEqualToJson(SOURCE.getBytes()); } @Test(expected = AssertionError.class) - public void isStrictlyEqualToJsonWhenBytesAreNotMatchingShouldFail() - throws Exception { + public void isStrictlyEqualToJsonWhenBytesAreNotMatchingShouldFail() { assertThat(forJson(SOURCE)).isStrictlyEqualToJson(LENIENT_SAME.getBytes()); } @@ -290,53 +282,47 @@ public class JsonContentAssertTests { } @Test - public void isEqualToJsonWhenStringIsMatchingAndLenientShouldPass() throws Exception { + public void isEqualToJsonWhenStringIsMatchingAndLenientShouldPass() { assertThat(forJson(SOURCE)).isEqualToJson(LENIENT_SAME, JSONCompareMode.LENIENT); } @Test(expected = AssertionError.class) - public void isEqualToJsonWhenStringIsNotMatchingAndLenientShouldFail() - throws Exception { + public void isEqualToJsonWhenStringIsNotMatchingAndLenientShouldFail() { assertThat(forJson(SOURCE)).isEqualToJson(DIFFERENT, JSONCompareMode.LENIENT); } @Test - public void isEqualToJsonWhenResourcePathIsMatchingAndLenientShouldPass() - throws Exception { + public void isEqualToJsonWhenResourcePathIsMatchingAndLenientShouldPass() { assertThat(forJson(SOURCE)).isEqualToJson("lenient-same.json", JSONCompareMode.LENIENT); } @Test(expected = AssertionError.class) - public void isEqualToJsonWhenResourcePathIsNotMatchingAndLenientShouldFail() - throws Exception { + public void isEqualToJsonWhenResourcePathIsNotMatchingAndLenientShouldFail() { assertThat(forJson(SOURCE)).isEqualToJson("different.json", JSONCompareMode.LENIENT); } @Test - public void isEqualToJsonWhenResourcePathAndClassIsMatchingAndLenientShouldPass() - throws Exception { + public void isEqualToJsonWhenResourcePathAndClassIsMatchingAndLenientShouldPass() { assertThat(forJson(SOURCE)).isEqualToJson("lenient-same.json", getClass(), JSONCompareMode.LENIENT); } @Test(expected = AssertionError.class) - public void isEqualToJsonWhenResourcePathAndClassIsNotMatchingAndLenientShouldFail() - throws Exception { + public void isEqualToJsonWhenResourcePathAndClassIsNotMatchingAndLenientShouldFail() { assertThat(forJson(SOURCE)).isEqualToJson("different.json", getClass(), JSONCompareMode.LENIENT); } @Test - public void isEqualToJsonWhenBytesAreMatchingAndLenientShouldPass() throws Exception { + public void isEqualToJsonWhenBytesAreMatchingAndLenientShouldPass() { assertThat(forJson(SOURCE)).isEqualToJson(LENIENT_SAME.getBytes(), JSONCompareMode.LENIENT); } @Test(expected = AssertionError.class) - public void isEqualToJsonWhenBytesAreNotMatchingAndLenientShouldFail() - throws Exception { + public void isEqualToJsonWhenBytesAreNotMatchingAndLenientShouldFail() { assertThat(forJson(SOURCE)).isEqualToJson(DIFFERENT.getBytes(), JSONCompareMode.LENIENT); } @@ -383,52 +369,44 @@ public class JsonContentAssertTests { } @Test - public void isEqualToJsonWhenStringIsMatchingAndComparatorShouldPass() - throws Exception { + public void isEqualToJsonWhenStringIsMatchingAndComparatorShouldPass() { assertThat(forJson(SOURCE)).isEqualToJson(LENIENT_SAME, COMPARATOR); } @Test(expected = AssertionError.class) - public void isEqualToJsonWhenStringIsNotMatchingAndComparatorShouldFail() - throws Exception { + public void isEqualToJsonWhenStringIsNotMatchingAndComparatorShouldFail() { assertThat(forJson(SOURCE)).isEqualToJson(DIFFERENT, COMPARATOR); } @Test - public void isEqualToJsonWhenResourcePathIsMatchingAndComparatorShouldPass() - throws Exception { + public void isEqualToJsonWhenResourcePathIsMatchingAndComparatorShouldPass() { assertThat(forJson(SOURCE)).isEqualToJson("lenient-same.json", COMPARATOR); } @Test(expected = AssertionError.class) - public void isEqualToJsonWhenResourcePathIsNotMatchingAndComparatorShouldFail() - throws Exception { + public void isEqualToJsonWhenResourcePathIsNotMatchingAndComparatorShouldFail() { assertThat(forJson(SOURCE)).isEqualToJson("different.json", COMPARATOR); } @Test - public void isEqualToJsonWhenResourcePathAndClassAreMatchingAndComparatorShouldPass() - throws Exception { + public void isEqualToJsonWhenResourcePathAndClassAreMatchingAndComparatorShouldPass() { assertThat(forJson(SOURCE)).isEqualToJson("lenient-same.json", getClass(), COMPARATOR); } @Test(expected = AssertionError.class) - public void isEqualToJsonWhenResourcePathAndClassAreNotMatchingAndComparatorShouldFail() - throws Exception { + public void isEqualToJsonWhenResourcePathAndClassAreNotMatchingAndComparatorShouldFail() { assertThat(forJson(SOURCE)).isEqualToJson("different.json", getClass(), COMPARATOR); } @Test - public void isEqualToJsonWhenBytesAreMatchingAndComparatorShouldPass() - throws Exception { + public void isEqualToJsonWhenBytesAreMatchingAndComparatorShouldPass() { assertThat(forJson(SOURCE)).isEqualToJson(LENIENT_SAME.getBytes(), COMPARATOR); } @Test(expected = AssertionError.class) - public void isEqualToJsonWhenBytesAreNotMatchingAndComparatorShouldFail() - throws Exception { + public void isEqualToJsonWhenBytesAreNotMatchingAndComparatorShouldFail() { assertThat(forJson(SOURCE)).isEqualToJson(DIFFERENT.getBytes(), COMPARATOR); } @@ -472,37 +450,37 @@ public class JsonContentAssertTests { } @Test(expected = AssertionError.class) - public void isNotEqualToWhenStringIsMatchingShouldFail() throws Exception { + public void isNotEqualToWhenStringIsMatchingShouldFail() { assertThat(forJson(SOURCE)).isNotEqualTo(LENIENT_SAME); } @Test - public void isNotEqualToWhenNullActualShouldPass() throws Exception { + public void isNotEqualToWhenNullActualShouldPass() { assertThat(forJson(null)).isNotEqualTo(SOURCE); } @Test - public void isNotEqualToWhenStringIsNotMatchingShouldPass() throws Exception { + public void isNotEqualToWhenStringIsNotMatchingShouldPass() { assertThat(forJson(SOURCE)).isNotEqualTo(DIFFERENT); } @Test(expected = AssertionError.class) - public void isNotEqualToWhenResourcePathIsMatchingShouldFail() throws Exception { + public void isNotEqualToWhenResourcePathIsMatchingShouldFail() { assertThat(forJson(SOURCE)).isNotEqualTo("lenient-same.json"); } @Test - public void isNotEqualToWhenResourcePathIsNotMatchingShouldPass() throws Exception { + public void isNotEqualToWhenResourcePathIsNotMatchingShouldPass() { assertThat(forJson(SOURCE)).isNotEqualTo("different.json"); } @Test(expected = AssertionError.class) - public void isNotEqualToWhenBytesAreMatchingShouldFail() throws Exception { + public void isNotEqualToWhenBytesAreMatchingShouldFail() { assertThat(forJson(SOURCE)).isNotEqualTo(LENIENT_SAME.getBytes()); } @Test - public void isNotEqualToWhenBytesAreNotMatchingShouldPass() throws Exception { + public void isNotEqualToWhenBytesAreNotMatchingShouldPass() { assertThat(forJson(SOURCE)).isNotEqualTo(DIFFERENT.getBytes()); } @@ -537,50 +515,47 @@ public class JsonContentAssertTests { } @Test(expected = AssertionError.class) - public void isNotEqualToJsonWhenStringIsMatchingShouldFail() throws Exception { + public void isNotEqualToJsonWhenStringIsMatchingShouldFail() { assertThat(forJson(SOURCE)).isNotEqualToJson(LENIENT_SAME); } @Test - public void isNotEqualToJsonWhenNullActualShouldPass() throws Exception { + public void isNotEqualToJsonWhenNullActualShouldPass() { assertThat(forJson(null)).isNotEqualToJson(SOURCE); } @Test - public void isNotEqualToJsonWhenStringIsNotMatchingShouldPass() throws Exception { + public void isNotEqualToJsonWhenStringIsNotMatchingShouldPass() { assertThat(forJson(SOURCE)).isNotEqualToJson(DIFFERENT); } @Test(expected = AssertionError.class) - public void isNotEqualToJsonWhenResourcePathIsMatchingShouldFail() throws Exception { + public void isNotEqualToJsonWhenResourcePathIsMatchingShouldFail() { assertThat(forJson(SOURCE)).isNotEqualToJson("lenient-same.json"); } @Test - public void isNotEqualToJsonWhenResourcePathIsNotMatchingShouldPass() - throws Exception { + public void isNotEqualToJsonWhenResourcePathIsNotMatchingShouldPass() { assertThat(forJson(SOURCE)).isNotEqualToJson("different.json"); } @Test(expected = AssertionError.class) - public void isNotEqualToJsonWhenResourcePathAndClassAreMatchingShouldFail() - throws Exception { + public void isNotEqualToJsonWhenResourcePathAndClassAreMatchingShouldFail() { assertThat(forJson(SOURCE)).isNotEqualToJson("lenient-same.json", getClass()); } @Test - public void isNotEqualToJsonWhenResourcePathAndClassAreNotMatchingShouldPass() - throws Exception { + public void isNotEqualToJsonWhenResourcePathAndClassAreNotMatchingShouldPass() { assertThat(forJson(SOURCE)).isNotEqualToJson("different.json", getClass()); } @Test(expected = AssertionError.class) - public void isNotEqualToJsonWhenBytesAreMatchingShouldFail() throws Exception { + public void isNotEqualToJsonWhenBytesAreMatchingShouldFail() { assertThat(forJson(SOURCE)).isNotEqualToJson(LENIENT_SAME.getBytes()); } @Test - public void isNotEqualToJsonWhenBytesAreNotMatchingShouldPass() throws Exception { + public void isNotEqualToJsonWhenBytesAreNotMatchingShouldPass() { assertThat(forJson(SOURCE)).isNotEqualToJson(DIFFERENT.getBytes()); } @@ -616,51 +591,43 @@ public class JsonContentAssertTests { } @Test(expected = AssertionError.class) - public void isNotStrictlyEqualToJsonWhenStringIsMatchingShouldFail() - throws Exception { + public void isNotStrictlyEqualToJsonWhenStringIsMatchingShouldFail() { assertThat(forJson(SOURCE)).isNotStrictlyEqualToJson(SOURCE); } @Test - public void isNotStrictlyEqualToJsonWhenStringIsNotMatchingShouldPass() - throws Exception { + public void isNotStrictlyEqualToJsonWhenStringIsNotMatchingShouldPass() { assertThat(forJson(SOURCE)).isNotStrictlyEqualToJson(LENIENT_SAME); } @Test(expected = AssertionError.class) - public void isNotStrictlyEqualToJsonWhenResourcePathIsMatchingShouldFail() - throws Exception { + public void isNotStrictlyEqualToJsonWhenResourcePathIsMatchingShouldFail() { assertThat(forJson(SOURCE)).isNotStrictlyEqualToJson("source.json"); } @Test - public void isNotStrictlyEqualToJsonWhenResourcePathIsNotMatchingShouldPass() - throws Exception { + public void isNotStrictlyEqualToJsonWhenResourcePathIsNotMatchingShouldPass() { assertThat(forJson(SOURCE)).isNotStrictlyEqualToJson("lenient-same.json"); } @Test(expected = AssertionError.class) - public void isNotStrictlyEqualToJsonWhenResourcePathAndClassAreMatchingShouldFail() - throws Exception { + public void isNotStrictlyEqualToJsonWhenResourcePathAndClassAreMatchingShouldFail() { assertThat(forJson(SOURCE)).isNotStrictlyEqualToJson("source.json", getClass()); } @Test - public void isNotStrictlyEqualToJsonWhenResourcePathAndClassAreNotMatchingShouldPass() - throws Exception { + public void isNotStrictlyEqualToJsonWhenResourcePathAndClassAreNotMatchingShouldPass() { assertThat(forJson(SOURCE)).isNotStrictlyEqualToJson("lenient-same.json", getClass()); } @Test(expected = AssertionError.class) - public void isNotStrictlyEqualToJsonWhenBytesAreMatchingShouldFail() - throws Exception { + public void isNotStrictlyEqualToJsonWhenBytesAreMatchingShouldFail() { assertThat(forJson(SOURCE)).isNotStrictlyEqualToJson(SOURCE.getBytes()); } @Test - public void isNotStrictlyEqualToJsonWhenBytesAreNotMatchingShouldPass() - throws Exception { + public void isNotStrictlyEqualToJsonWhenBytesAreNotMatchingShouldPass() { assertThat(forJson(SOURCE)).isNotStrictlyEqualToJson(LENIENT_SAME.getBytes()); } @@ -702,56 +669,48 @@ public class JsonContentAssertTests { } @Test(expected = AssertionError.class) - public void isNotEqualToJsonWhenStringIsMatchingAndLenientShouldFail() - throws Exception { + public void isNotEqualToJsonWhenStringIsMatchingAndLenientShouldFail() { assertThat(forJson(SOURCE)).isNotEqualToJson(LENIENT_SAME, JSONCompareMode.LENIENT); } @Test - public void isNotEqualToJsonWhenStringIsNotMatchingAndLenientShouldPass() - throws Exception { + public void isNotEqualToJsonWhenStringIsNotMatchingAndLenientShouldPass() { assertThat(forJson(SOURCE)).isNotEqualToJson(DIFFERENT, JSONCompareMode.LENIENT); } @Test(expected = AssertionError.class) - public void isNotEqualToJsonWhenResourcePathIsMatchingAndLenientShouldFail() - throws Exception { + public void isNotEqualToJsonWhenResourcePathIsMatchingAndLenientShouldFail() { assertThat(forJson(SOURCE)).isNotEqualToJson("lenient-same.json", JSONCompareMode.LENIENT); } @Test - public void isNotEqualToJsonWhenResourcePathIsNotMatchingAndLenientShouldPass() - throws Exception { + public void isNotEqualToJsonWhenResourcePathIsNotMatchingAndLenientShouldPass() { assertThat(forJson(SOURCE)).isNotEqualToJson("different.json", JSONCompareMode.LENIENT); } @Test(expected = AssertionError.class) - public void isNotEqualToJsonWhenResourcePathAndClassAreMatchingAndLenientShouldFail() - throws Exception { + public void isNotEqualToJsonWhenResourcePathAndClassAreMatchingAndLenientShouldFail() { assertThat(forJson(SOURCE)).isNotEqualToJson("lenient-same.json", getClass(), JSONCompareMode.LENIENT); } @Test - public void isNotEqualToJsonWhenResourcePathAndClassAreNotMatchingAndLenientShouldPass() - throws Exception { + public void isNotEqualToJsonWhenResourcePathAndClassAreNotMatchingAndLenientShouldPass() { assertThat(forJson(SOURCE)).isNotEqualToJson("different.json", getClass(), JSONCompareMode.LENIENT); } @Test(expected = AssertionError.class) - public void isNotEqualToJsonWhenBytesAreMatchingAndLenientShouldFail() - throws Exception { + public void isNotEqualToJsonWhenBytesAreMatchingAndLenientShouldFail() { assertThat(forJson(SOURCE)).isNotEqualToJson(LENIENT_SAME.getBytes(), JSONCompareMode.LENIENT); } @Test - public void isNotEqualToJsonWhenBytesAreNotMatchingAndLenientShouldPass() - throws Exception { + public void isNotEqualToJsonWhenBytesAreNotMatchingAndLenientShouldPass() { assertThat(forJson(SOURCE)).isNotEqualToJson(DIFFERENT.getBytes(), JSONCompareMode.LENIENT); } @@ -799,52 +758,44 @@ public class JsonContentAssertTests { } @Test(expected = AssertionError.class) - public void isNotEqualToJsonWhenStringIsMatchingAndComparatorShouldFail() - throws Exception { + public void isNotEqualToJsonWhenStringIsMatchingAndComparatorShouldFail() { assertThat(forJson(SOURCE)).isNotEqualToJson(LENIENT_SAME, COMPARATOR); } @Test - public void isNotEqualToJsonWhenStringIsNotMatchingAndComparatorShouldPass() - throws Exception { + public void isNotEqualToJsonWhenStringIsNotMatchingAndComparatorShouldPass() { assertThat(forJson(SOURCE)).isNotEqualToJson(DIFFERENT, COMPARATOR); } @Test(expected = AssertionError.class) - public void isNotEqualToJsonWhenResourcePathIsMatchingAndComparatorShouldFail() - throws Exception { + public void isNotEqualToJsonWhenResourcePathIsMatchingAndComparatorShouldFail() { assertThat(forJson(SOURCE)).isNotEqualToJson("lenient-same.json", COMPARATOR); } @Test - public void isNotEqualToJsonWhenResourcePathIsNotMatchingAndComparatorShouldPass() - throws Exception { + public void isNotEqualToJsonWhenResourcePathIsNotMatchingAndComparatorShouldPass() { assertThat(forJson(SOURCE)).isNotEqualToJson("different.json", COMPARATOR); } @Test(expected = AssertionError.class) - public void isNotEqualToJsonWhenResourcePathAndClassAreMatchingAndComparatorShouldFail() - throws Exception { + public void isNotEqualToJsonWhenResourcePathAndClassAreMatchingAndComparatorShouldFail() { assertThat(forJson(SOURCE)).isNotEqualToJson("lenient-same.json", getClass(), COMPARATOR); } @Test - public void isNotEqualToJsonWhenResourcePathAndClassAreNotMatchingAndComparatorShouldPass() - throws Exception { + public void isNotEqualToJsonWhenResourcePathAndClassAreNotMatchingAndComparatorShouldPass() { assertThat(forJson(SOURCE)).isNotEqualToJson("different.json", getClass(), COMPARATOR); } @Test(expected = AssertionError.class) - public void isNotEqualToJsonWhenBytesAreMatchingAndComparatorShouldFail() - throws Exception { + public void isNotEqualToJsonWhenBytesAreMatchingAndComparatorShouldFail() { assertThat(forJson(SOURCE)).isNotEqualToJson(LENIENT_SAME.getBytes(), COMPARATOR); } @Test - public void isNotEqualToJsonWhenBytesAreNotMatchingAndComparatorShouldPass() - throws Exception { + public void isNotEqualToJsonWhenBytesAreNotMatchingAndComparatorShouldPass() { assertThat(forJson(SOURCE)).isNotEqualToJson(DIFFERENT.getBytes(), COMPARATOR); } @@ -890,28 +841,28 @@ public class JsonContentAssertTests { } @Test - public void hasJsonPathValue() throws Exception { + public void hasJsonPathValue() { assertThat(forJson(TYPES)).hasJsonPathValue("$.str"); } @Test - public void hasJsonPathValueForAnEmptyArray() throws Exception { + public void hasJsonPathValueForAnEmptyArray() { assertThat(forJson(TYPES)).hasJsonPathValue("$.emptyArray"); } @Test - public void hasJsonPathValueForAnEmptyMap() throws Exception { + public void hasJsonPathValueForAnEmptyMap() { assertThat(forJson(TYPES)).hasJsonPathValue("$.emptyMap"); } @Test - public void hasJsonPathValueForIndefinitePathWithResults() throws Exception { + public void hasJsonPathValueForIndefinitePathWithResults() { assertThat(forJson(SIMPSONS)) .hasJsonPathValue("$.familyMembers[?(@.name == 'Bart')]"); } @Test - public void hasJsonPathValueForIndefinitePathWithEmptyResults() throws Exception { + public void hasJsonPathValueForIndefinitePathWithEmptyResults() { String expression = "$.familyMembers[?(@.name == 'Dilbert')]"; this.thrown.expect(AssertionError.class); this.thrown.expectMessage("No value at JSON path \"" + expression + "\""); @@ -919,12 +870,12 @@ public class JsonContentAssertTests { } @Test - public void doesNotHaveJsonPathValue() throws Exception { + public void doesNotHaveJsonPathValue() { assertThat(forJson(TYPES)).doesNotHaveJsonPathValue("$.bogus"); } @Test - public void doesNotHaveJsonPathValueForAnEmptyArray() throws Exception { + public void doesNotHaveJsonPathValueForAnEmptyArray() { String expression = "$.emptyArray"; this.thrown.expect(AssertionError.class); this.thrown.expectMessage( @@ -933,7 +884,7 @@ public class JsonContentAssertTests { } @Test - public void doesNotHaveJsonPathValueForAnEmptyMap() throws Exception { + public void doesNotHaveJsonPathValueForAnEmptyMap() { String expression = "$.emptyMap"; this.thrown.expect(AssertionError.class); this.thrown.expectMessage( @@ -942,7 +893,7 @@ public class JsonContentAssertTests { } @Test - public void doesNotHaveJsonPathValueForIndefinitePathWithResults() throws Exception { + public void doesNotHaveJsonPathValueForIndefinitePathWithResults() { String expression = "$.familyMembers[?(@.name == 'Bart')]"; this.thrown.expect(AssertionError.class); this.thrown.expectMessage("Expected no value at JSON path \"" + expression @@ -951,36 +902,34 @@ public class JsonContentAssertTests { } @Test - public void doesNotHaveJsonPathValueForIndefinitePathWithEmptyResults() - throws Exception { + public void doesNotHaveJsonPathValueForIndefinitePathWithEmptyResults() { assertThat(forJson(SIMPSONS)) .doesNotHaveJsonPathValue("$.familyMembers[?(@.name == 'Dilbert')]"); } @Test - public void hasEmptyJsonPathValueForAnEmptyString() throws Exception { + public void hasEmptyJsonPathValueForAnEmptyString() { assertThat(forJson(TYPES)).hasEmptyJsonPathValue("$.emptyString"); } @Test - public void hasEmptyJsonPathValueForAnEmptyArray() throws Exception { + public void hasEmptyJsonPathValueForAnEmptyArray() { assertThat(forJson(TYPES)).hasEmptyJsonPathValue("$.emptyArray"); } @Test - public void hasEmptyJsonPathValueForAnEmptyMap() throws Exception { + public void hasEmptyJsonPathValueForAnEmptyMap() { assertThat(forJson(TYPES)).hasEmptyJsonPathValue("$.emptyMap"); } @Test - public void hasEmptyJsonPathValueForIndefinitePathWithEmptyResults() - throws Exception { + public void hasEmptyJsonPathValueForIndefinitePathWithEmptyResults() { assertThat(forJson(SIMPSONS)) .hasEmptyJsonPathValue("$.familyMembers[?(@.name == 'Dilbert')]"); } @Test - public void hasEmptyJsonPathValueForIndefinitePathWithResults() throws Exception { + public void hasEmptyJsonPathValueForIndefinitePathWithResults() { String expression = "$.familyMembers[?(@.name == 'Bart')]"; this.thrown.expect(AssertionError.class); this.thrown.expectMessage("Expected an empty value at JSON path \"" + expression @@ -989,7 +938,7 @@ public class JsonContentAssertTests { } @Test - public void hasEmptyJsonPathValueForWhitespace() throws Exception { + public void hasEmptyJsonPathValueForWhitespace() { String expression = "$.whitespace"; this.thrown.expect(AssertionError.class); this.thrown.expectMessage("Expected an empty value at JSON path \"" + expression @@ -998,40 +947,38 @@ public class JsonContentAssertTests { } @Test - public void doesNotHaveEmptyJsonPathValueForString() throws Exception { + public void doesNotHaveEmptyJsonPathValueForString() { assertThat(forJson(TYPES)).doesNotHaveEmptyJsonPathValue("$.str"); } @Test - public void doesNotHaveEmptyJsonPathValueForNumber() throws Exception { + public void doesNotHaveEmptyJsonPathValueForNumber() { assertThat(forJson(TYPES)).doesNotHaveEmptyJsonPathValue("$.num"); } @Test - public void doesNotHaveEmptyJsonPathValueForBoolean() throws Exception { + public void doesNotHaveEmptyJsonPathValueForBoolean() { assertThat(forJson(TYPES)).doesNotHaveEmptyJsonPathValue("$.bool"); } @Test - public void doesNotHaveEmptyJsonPathValueForArray() throws Exception { + public void doesNotHaveEmptyJsonPathValueForArray() { assertThat(forJson(TYPES)).doesNotHaveEmptyJsonPathValue("$.arr"); } @Test - public void doesNotHaveEmptyJsonPathValueForMap() throws Exception { + public void doesNotHaveEmptyJsonPathValueForMap() { assertThat(forJson(TYPES)).doesNotHaveEmptyJsonPathValue("$.colorMap"); } @Test - public void doesNotHaveEmptyJsonPathValueForIndefinitePathWithResults() - throws Exception { + public void doesNotHaveEmptyJsonPathValueForIndefinitePathWithResults() { assertThat(forJson(SIMPSONS)) .doesNotHaveEmptyJsonPathValue("$.familyMembers[?(@.name == 'Bart')]"); } @Test - public void doesNotHaveEmptyJsonPathValueForIndefinitePathWithEmptyResults() - throws Exception { + public void doesNotHaveEmptyJsonPathValueForIndefinitePathWithEmptyResults() { String expression = "$.familyMembers[?(@.name == 'Dilbert')]"; this.thrown.expect(AssertionError.class); this.thrown.expectMessage("Expected a non-empty value at JSON path \"" @@ -1040,7 +987,7 @@ public class JsonContentAssertTests { } @Test - public void doesNotHaveEmptyJsonPathValueForAnEmptyString() throws Exception { + public void doesNotHaveEmptyJsonPathValueForAnEmptyString() { String expression = "$.emptyString"; this.thrown.expect(AssertionError.class); this.thrown.expectMessage("Expected a non-empty value at JSON path \"" @@ -1049,7 +996,7 @@ public class JsonContentAssertTests { } @Test - public void doesNotHaveEmptyJsonPathValueForForAnEmptyArray() throws Exception { + public void doesNotHaveEmptyJsonPathValueForForAnEmptyArray() { String expression = "$.emptyArray"; this.thrown.expect(AssertionError.class); this.thrown.expectMessage("Expected a non-empty value at JSON path \"" @@ -1058,7 +1005,7 @@ public class JsonContentAssertTests { } @Test - public void doesNotHaveEmptyJsonPathValueForAnEmptyMap() throws Exception { + public void doesNotHaveEmptyJsonPathValueForAnEmptyMap() { String expression = "$.emptyMap"; this.thrown.expect(AssertionError.class); this.thrown.expectMessage("Expected a non-empty value at JSON path \"" @@ -1067,17 +1014,17 @@ public class JsonContentAssertTests { } @Test - public void hasJsonPathStringValue() throws Exception { + public void hasJsonPathStringValue() { assertThat(forJson(TYPES)).hasJsonPathStringValue("$.str"); } @Test - public void hasJsonPathStringValueForAnEmptyString() throws Exception { + public void hasJsonPathStringValueForAnEmptyString() { assertThat(forJson(TYPES)).hasJsonPathStringValue("$.emptyString"); } @Test - public void hasJsonPathStringValueForNonString() throws Exception { + public void hasJsonPathStringValueForNonString() { String expression = "$.bool"; this.thrown.expect(AssertionError.class); this.thrown.expectMessage( @@ -1086,12 +1033,12 @@ public class JsonContentAssertTests { } @Test - public void hasJsonPathNumberValue() throws Exception { + public void hasJsonPathNumberValue() { assertThat(forJson(TYPES)).hasJsonPathNumberValue("$.num"); } @Test - public void hasJsonPathNumberValueForNonNumber() throws Exception { + public void hasJsonPathNumberValueForNonNumber() { String expression = "$.bool"; this.thrown.expect(AssertionError.class); this.thrown.expectMessage( @@ -1100,12 +1047,12 @@ public class JsonContentAssertTests { } @Test - public void hasJsonPathBooleanValue() throws Exception { + public void hasJsonPathBooleanValue() { assertThat(forJson(TYPES)).hasJsonPathBooleanValue("$.bool"); } @Test - public void hasJsonPathBooleanValueForNonBoolean() throws Exception { + public void hasJsonPathBooleanValueForNonBoolean() { String expression = "$.num"; this.thrown.expect(AssertionError.class); this.thrown.expectMessage( @@ -1114,17 +1061,17 @@ public class JsonContentAssertTests { } @Test - public void hasJsonPathArrayValue() throws Exception { + public void hasJsonPathArrayValue() { assertThat(forJson(TYPES)).hasJsonPathArrayValue("$.arr"); } @Test - public void hasJsonPathArrayValueForAnEmptyArray() throws Exception { + public void hasJsonPathArrayValueForAnEmptyArray() { assertThat(forJson(TYPES)).hasJsonPathArrayValue("$.emptyArray"); } @Test - public void hasJsonPathArrayValueForNonArray() throws Exception { + public void hasJsonPathArrayValueForNonArray() { String expression = "$.str"; this.thrown.expect(AssertionError.class); this.thrown.expectMessage( @@ -1133,17 +1080,17 @@ public class JsonContentAssertTests { } @Test - public void hasJsonPathMapValue() throws Exception { + public void hasJsonPathMapValue() { assertThat(forJson(TYPES)).hasJsonPathMapValue("$.colorMap"); } @Test - public void hasJsonPathMapValueForAnEmptyMap() throws Exception { + public void hasJsonPathMapValueForAnEmptyMap() { assertThat(forJson(TYPES)).hasJsonPathMapValue("$.emptyMap"); } @Test - public void hasJsonPathMapValueForNonMap() throws Exception { + public void hasJsonPathMapValueForNonMap() { String expression = "$.str"; this.thrown.expect(AssertionError.class); this.thrown.expectMessage( @@ -1152,34 +1099,34 @@ public class JsonContentAssertTests { } @Test - public void extractingJsonPathValue() throws Exception { + public void extractingJsonPathValue() { assertThat(forJson(TYPES)).extractingJsonPathValue("@.str").isEqualTo("foo"); } @Test - public void extractingJsonPathValueForMissing() throws Exception { + public void extractingJsonPathValueForMissing() { assertThat(forJson(TYPES)).extractingJsonPathValue("@.bogus").isNull(); } @Test - public void extractingJsonPathStringValue() throws Exception { + public void extractingJsonPathStringValue() { assertThat(forJson(TYPES)).extractingJsonPathStringValue("@.str") .isEqualTo("foo"); } @Test - public void extractingJsonPathStringValueForMissing() throws Exception { + public void extractingJsonPathStringValueForMissing() { assertThat(forJson(TYPES)).extractingJsonPathStringValue("@.bogus").isNull(); } @Test - public void extractingJsonPathStringValueForEmptyString() throws Exception { + public void extractingJsonPathStringValueForEmptyString() { assertThat(forJson(TYPES)).extractingJsonPathStringValue("@.emptyString") .isEmpty(); } @Test - public void extractingJsonPathStringValueForWrongType() throws Exception { + public void extractingJsonPathStringValueForWrongType() { String expression = "$.num"; this.thrown.expect(AssertionError.class); this.thrown.expectMessage( @@ -1188,17 +1135,17 @@ public class JsonContentAssertTests { } @Test - public void extractingJsonPathNumberValue() throws Exception { + public void extractingJsonPathNumberValue() { assertThat(forJson(TYPES)).extractingJsonPathNumberValue("@.num").isEqualTo(5); } @Test - public void extractingJsonPathNumberValueForMissing() throws Exception { + public void extractingJsonPathNumberValueForMissing() { assertThat(forJson(TYPES)).extractingJsonPathNumberValue("@.bogus").isNull(); } @Test - public void extractingJsonPathNumberValueForWrongType() throws Exception { + public void extractingJsonPathNumberValueForWrongType() { String expression = "$.str"; this.thrown.expect(AssertionError.class); this.thrown.expectMessage( @@ -1207,17 +1154,17 @@ public class JsonContentAssertTests { } @Test - public void extractingJsonPathBooleanValue() throws Exception { + public void extractingJsonPathBooleanValue() { assertThat(forJson(TYPES)).extractingJsonPathBooleanValue("@.bool").isTrue(); } @Test - public void extractingJsonPathBooleanValueForMissing() throws Exception { + public void extractingJsonPathBooleanValueForMissing() { assertThat(forJson(TYPES)).extractingJsonPathBooleanValue("@.bogus").isNull(); } @Test - public void extractingJsonPathBooleanValueForWrongType() throws Exception { + public void extractingJsonPathBooleanValueForWrongType() { String expression = "$.str"; this.thrown.expect(AssertionError.class); this.thrown.expectMessage("Expected a boolean at JSON path \"" + expression @@ -1226,23 +1173,23 @@ public class JsonContentAssertTests { } @Test - public void extractingJsonPathArrayValue() throws Exception { + public void extractingJsonPathArrayValue() { assertThat(forJson(TYPES)).extractingJsonPathArrayValue("@.arr") .containsExactly(42); } @Test - public void extractingJsonPathArrayValueForMissing() throws Exception { + public void extractingJsonPathArrayValueForMissing() { assertThat(forJson(TYPES)).extractingJsonPathArrayValue("@.bogus").isNull(); } @Test - public void extractingJsonPathArrayValueForEmpty() throws Exception { + public void extractingJsonPathArrayValueForEmpty() { assertThat(forJson(TYPES)).extractingJsonPathArrayValue("@.emptyArray").isEmpty(); } @Test - public void extractingJsonPathArrayValueForWrongType() throws Exception { + public void extractingJsonPathArrayValueForWrongType() { String expression = "$.str"; this.thrown.expect(AssertionError.class); this.thrown.expectMessage( @@ -1251,23 +1198,23 @@ public class JsonContentAssertTests { } @Test - public void extractingJsonPathMapValue() throws Exception { + public void extractingJsonPathMapValue() { assertThat(forJson(TYPES)).extractingJsonPathMapValue("@.colorMap") .contains(entry("red", "rojo")); } @Test - public void extractingJsonPathMapValueForMissing() throws Exception { + public void extractingJsonPathMapValueForMissing() { assertThat(forJson(TYPES)).extractingJsonPathMapValue("@.bogus").isNull(); } @Test - public void extractingJsonPathMapValueForEmpty() throws Exception { + public void extractingJsonPathMapValueForEmpty() { assertThat(forJson(TYPES)).extractingJsonPathMapValue("@.emptyMap").isEmpty(); } @Test - public void extractingJsonPathMapValueForWrongType() throws Exception { + public void extractingJsonPathMapValueForWrongType() { String expression = "$.str"; this.thrown.expect(AssertionError.class); this.thrown.expectMessage( @@ -1276,7 +1223,7 @@ public class JsonContentAssertTests { } @Test - public void isNullWhenActualIsNullShouldPass() throws Exception { + public void isNullWhenActualIsNullShouldPass() { assertThat(forJson(null)).isNull(); } @@ -1286,11 +1233,11 @@ public class JsonContentAssertTests { return file; } - private InputStream createInputStream(String content) throws IOException { + private InputStream createInputStream(String content) { return new ByteArrayInputStream(content.getBytes()); } - private Resource createResource(String content) throws IOException { + private Resource createResource(String content) { return new ByteArrayResource(content.getBytes()); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/json/JsonContentTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/json/JsonContentTests.java index a4fc6e606e..2f25c53a44 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/json/JsonContentTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/json/JsonContentTests.java @@ -40,48 +40,48 @@ public class JsonContentTests { public ExpectedException thrown = ExpectedException.none(); @Test - public void createWhenResourceLoadClassIsNullShouldThrowException() throws Exception { + public void createWhenResourceLoadClassIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("ResourceLoadClass must not be null"); new JsonContent(null, TYPE, JSON); } @Test - public void createWhenJsonIsNullShouldThrowException() throws Exception { + public void createWhenJsonIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("JSON must not be null"); new JsonContent(getClass(), TYPE, null); } @Test - public void createWhenTypeIsNullShouldCreateContent() throws Exception { + public void createWhenTypeIsNullShouldCreateContent() { JsonContent content = new JsonContent<>(getClass(), null, JSON); assertThat(content).isNotNull(); } @Test @SuppressWarnings("deprecation") - public void assertThatShouldReturnJsonContentAssert() throws Exception { + public void assertThatShouldReturnJsonContentAssert() { JsonContent content = new JsonContent<>(getClass(), TYPE, JSON); assertThat(content.assertThat()).isInstanceOf(JsonContentAssert.class); } @Test - public void getJsonShouldReturnJson() throws Exception { + public void getJsonShouldReturnJson() { JsonContent content = new JsonContent<>(getClass(), TYPE, JSON); assertThat(content.getJson()).isEqualTo(JSON); } @Test - public void toStringWhenHasTypeShouldReturnString() throws Exception { + public void toStringWhenHasTypeShouldReturnString() { JsonContent content = new JsonContent<>(getClass(), TYPE, JSON); assertThat(content.toString()) .isEqualTo("JsonContent " + JSON + " created from " + TYPE); } @Test - public void toStringWhenHasNoTypeShouldReturnString() throws Exception { + public void toStringWhenHasNoTypeShouldReturnString() { JsonContent content = new JsonContent<>(getClass(), null, JSON); assertThat(content.toString()).isEqualTo("JsonContent " + JSON); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/json/ObjectContentAssertTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/json/ObjectContentAssertTests.java index b4f7f935ab..9bda31590a 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/json/ObjectContentAssertTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/json/ObjectContentAssertTests.java @@ -41,34 +41,34 @@ public class ObjectContentAssertTests { } @Test - public void isEqualToWhenObjectsAreEqualShouldPass() throws Exception { + public void isEqualToWhenObjectsAreEqualShouldPass() { assertThat(forObject(SOURCE)).isEqualTo(SOURCE); } @Test(expected = AssertionError.class) - public void isEqualToWhenObjectsAreDifferentShouldFail() throws Exception { + public void isEqualToWhenObjectsAreDifferentShouldFail() { assertThat(forObject(SOURCE)).isEqualTo(DIFFERENT); } @Test - public void asArrayForArrayShouldReturnObjectArrayAssert() throws Exception { + public void asArrayForArrayShouldReturnObjectArrayAssert() { ExampleObject[] source = new ExampleObject[] { SOURCE }; assertThat(forObject(source)).asArray().containsExactly(SOURCE); } @Test(expected = AssertionError.class) - public void asArrayForNonArrayShouldFail() throws Exception { + public void asArrayForNonArrayShouldFail() { assertThat(forObject(SOURCE)).asArray(); } @Test - public void asMapForMapShouldReturnMapAssert() throws Exception { + public void asMapForMapShouldReturnMapAssert() { Map source = Collections.singletonMap("a", SOURCE); assertThat(forObject(source)).asMap().containsEntry("a", SOURCE); } @Test(expected = AssertionError.class) - public void asMapForNonMapShouldFail() throws Exception { + public void asMapForNonMapShouldFail() { assertThat(forObject(SOURCE)).asMap(); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/json/ObjectContentTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/json/ObjectContentTests.java index 376fc6c34e..551ee502d9 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/json/ObjectContentTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/json/ObjectContentTests.java @@ -40,39 +40,39 @@ public class ObjectContentTests { public ExpectedException thrown = ExpectedException.none(); @Test - public void createWhenObjectIsNullShouldThrowException() throws Exception { + public void createWhenObjectIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Object must not be null"); new ObjectContent(TYPE, null); } @Test - public void createWhenTypeIsNullShouldCreateContent() throws Exception { + public void createWhenTypeIsNullShouldCreateContent() { ObjectContent content = new ObjectContent<>(null, OBJECT); assertThat(content).isNotNull(); } @Test - public void assertThatShouldReturnObjectContentAssert() throws Exception { + public void assertThatShouldReturnObjectContentAssert() { ObjectContent content = new ObjectContent<>(TYPE, OBJECT); assertThat(content.assertThat()).isInstanceOf(ObjectContentAssert.class); } @Test - public void getObjectShouldReturnObject() throws Exception { + public void getObjectShouldReturnObject() { ObjectContent content = new ObjectContent<>(TYPE, OBJECT); assertThat(content.getObject()).isEqualTo(OBJECT); } @Test - public void toStringWhenHasTypeShouldReturnString() throws Exception { + public void toStringWhenHasTypeShouldReturnString() { ObjectContent content = new ObjectContent<>(TYPE, OBJECT); assertThat(content.toString()) .isEqualTo("ObjectContent " + OBJECT + " created from " + TYPE); } @Test - public void toStringWhenHasNoTypeShouldReturnString() throws Exception { + public void toStringWhenHasNoTypeShouldReturnString() { ObjectContent content = new ObjectContent<>(null, OBJECT); assertThat(content.toString()).isEqualTo("ObjectContent " + OBJECT); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/DefinitionsParserTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/DefinitionsParserTests.java index 94aa767560..5afa66e4cc 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/DefinitionsParserTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/DefinitionsParserTests.java @@ -64,7 +64,7 @@ public class DefinitionsParserTests { } @Test - public void parseMockBeanAttributes() throws Exception { + public void parseMockBeanAttributes() { this.parser.parse(MockBeanAttributes.class); assertThat(getDefinitions()).hasSize(1); MockDefinition definition = getMockDefinition(0); @@ -79,7 +79,7 @@ public class DefinitionsParserTests { } @Test - public void parseMockBeanOnClassAndField() throws Exception { + public void parseMockBeanOnClassAndField() { this.parser.parse(MockBeanOnClassAndField.class); assertThat(getDefinitions()).hasSize(2); MockDefinition classDefinition = getMockDefinition(0); @@ -95,7 +95,7 @@ public class DefinitionsParserTests { } @Test - public void parseMockBeanInferClassToMock() throws Exception { + public void parseMockBeanInferClassToMock() { this.parser.parse(MockBeanInferClassToMock.class); assertThat(getDefinitions()).hasSize(1); assertThat(getMockDefinition(0).getTypeToMock().resolve()) @@ -103,14 +103,14 @@ public class DefinitionsParserTests { } @Test - public void parseMockBeanMissingClassToMock() throws Exception { + public void parseMockBeanMissingClassToMock() { this.thrown.expect(IllegalStateException.class); this.thrown.expectMessage("Unable to deduce type to mock"); this.parser.parse(MockBeanMissingClassToMock.class); } @Test - public void parseMockBeanMultipleClasses() throws Exception { + public void parseMockBeanMultipleClasses() { this.parser.parse(MockBeanMultipleClasses.class); assertThat(getDefinitions()).hasSize(2); assertThat(getMockDefinition(0).getTypeToMock().resolve()) @@ -120,7 +120,7 @@ public class DefinitionsParserTests { } @Test - public void parseMockBeanMultipleClassesWithName() throws Exception { + public void parseMockBeanMultipleClassesWithName() { this.thrown.expect(IllegalStateException.class); this.thrown.expectMessage( "The name attribute can only be used when mocking a single class"); @@ -146,7 +146,7 @@ public class DefinitionsParserTests { } @Test - public void parseSpyBeanAttributes() throws Exception { + public void parseSpyBeanAttributes() { this.parser.parse(SpyBeanAttributes.class); assertThat(getDefinitions()).hasSize(1); SpyDefinition definition = getSpyDefinition(0); @@ -158,7 +158,7 @@ public class DefinitionsParserTests { } @Test - public void parseSpyBeanOnClassAndField() throws Exception { + public void parseSpyBeanOnClassAndField() { this.parser.parse(SpyBeanOnClassAndField.class); assertThat(getDefinitions()).hasSize(2); SpyDefinition classDefinition = getSpyDefinition(0); @@ -174,7 +174,7 @@ public class DefinitionsParserTests { } @Test - public void parseSpyBeanInferClassToMock() throws Exception { + public void parseSpyBeanInferClassToMock() { this.parser.parse(SpyBeanInferClassToMock.class); assertThat(getDefinitions()).hasSize(1); assertThat(getSpyDefinition(0).getTypeToSpy().resolve()) @@ -182,14 +182,14 @@ public class DefinitionsParserTests { } @Test - public void parseSpyBeanMissingClassToMock() throws Exception { + public void parseSpyBeanMissingClassToMock() { this.thrown.expect(IllegalStateException.class); this.thrown.expectMessage("Unable to deduce type to spy"); this.parser.parse(SpyBeanMissingClassToMock.class); } @Test - public void parseSpyBeanMultipleClasses() throws Exception { + public void parseSpyBeanMultipleClasses() { this.parser.parse(SpyBeanMultipleClasses.class); assertThat(getDefinitions()).hasSize(2); assertThat(getSpyDefinition(0).getTypeToSpy().resolve()) @@ -199,7 +199,7 @@ public class DefinitionsParserTests { } @Test - public void parseSpyBeanMultipleClassesWithName() throws Exception { + public void parseSpyBeanMultipleClassesWithName() { this.thrown.expect(IllegalStateException.class); this.thrown.expectMessage( "The name attribute can only be used when spying a single class"); diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanForBeanFactoryIntegrationTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanForBeanFactoryIntegrationTests.java index 35ad796d11..37597c4134 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanForBeanFactoryIntegrationTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanForBeanFactoryIntegrationTests.java @@ -70,7 +70,7 @@ public class MockBeanForBeanFactoryIntegrationTests { static class TestFactoryBean implements FactoryBean { @Override - public TestBean getObject() throws Exception { + public TestBean getObject() { return () -> "normal"; } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnConfigurationClassForExistingBeanIntegrationTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnConfigurationClassForExistingBeanIntegrationTests.java index b034682c3d..26d15a0065 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnConfigurationClassForExistingBeanIntegrationTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnConfigurationClassForExistingBeanIntegrationTests.java @@ -42,7 +42,7 @@ public class MockBeanOnConfigurationClassForExistingBeanIntegrationTests { private ExampleServiceCaller caller; @Test - public void testMocking() throws Exception { + public void testMocking() { given(this.caller.getService().greeting()).willReturn("Boot"); assertThat(this.caller.sayGreeting()).isEqualTo("I say Boot"); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnConfigurationClassForNewBeanIntegrationTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnConfigurationClassForNewBeanIntegrationTests.java index 60579c951d..18daaac078 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnConfigurationClassForNewBeanIntegrationTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnConfigurationClassForNewBeanIntegrationTests.java @@ -42,7 +42,7 @@ public class MockBeanOnConfigurationClassForNewBeanIntegrationTests { private ExampleServiceCaller caller; @Test - public void testMocking() throws Exception { + public void testMocking() { given(this.caller.getService().greeting()).willReturn("Boot"); assertThat(this.caller.sayGreeting()).isEqualTo("I say Boot"); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnConfigurationFieldForExistingBeanIntegrationTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnConfigurationFieldForExistingBeanIntegrationTests.java index 45c023aab5..6649cf49ef 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnConfigurationFieldForExistingBeanIntegrationTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnConfigurationFieldForExistingBeanIntegrationTests.java @@ -46,7 +46,7 @@ public class MockBeanOnConfigurationFieldForExistingBeanIntegrationTests { private ExampleServiceCaller caller; @Test - public void testMocking() throws Exception { + public void testMocking() { given(this.config.exampleService.greeting()).willReturn("Boot"); assertThat(this.caller.sayGreeting()).isEqualTo("I say Boot"); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnConfigurationFieldForNewBeanIntegrationTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnConfigurationFieldForNewBeanIntegrationTests.java index d0df2e31aa..37862fcec4 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnConfigurationFieldForNewBeanIntegrationTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnConfigurationFieldForNewBeanIntegrationTests.java @@ -45,7 +45,7 @@ public class MockBeanOnConfigurationFieldForNewBeanIntegrationTests { private ExampleServiceCaller caller; @Test - public void testMocking() throws Exception { + public void testMocking() { given(this.config.exampleService.greeting()).willReturn("Boot"); assertThat(this.caller.sayGreeting()).isEqualTo("I say Boot"); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnContextHierarchyIntegrationTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnContextHierarchyIntegrationTests.java index 826162df52..7a05fda493 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnContextHierarchyIntegrationTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnContextHierarchyIntegrationTests.java @@ -48,7 +48,7 @@ public class MockBeanOnContextHierarchyIntegrationTests { private ChildConfig childConfig; @Test - public void testMocking() throws Exception { + public void testMocking() { ApplicationContext context = this.childConfig.getContext(); ApplicationContext parentContext = context.getParent(); assertThat(parentContext.getBeanNamesForType(ExampleService.class)).hasSize(1); diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnScopedProxyTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnScopedProxyTests.java index a16d2d1172..3108150d1b 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnScopedProxyTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnScopedProxyTests.java @@ -49,7 +49,7 @@ public class MockBeanOnScopedProxyTests { private ExampleServiceCaller caller; @Test - public void testMocking() throws Exception { + public void testMocking() { given(this.caller.getService().greeting()).willReturn("Boot"); assertThat(this.caller.sayGreeting()).isEqualTo("I say Boot"); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnTestClassForExistingBeanIntegrationTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnTestClassForExistingBeanIntegrationTests.java index c25cfa58c6..fef401a4f9 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnTestClassForExistingBeanIntegrationTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnTestClassForExistingBeanIntegrationTests.java @@ -43,7 +43,7 @@ public class MockBeanOnTestClassForExistingBeanIntegrationTests { private ExampleServiceCaller caller; @Test - public void testMocking() throws Exception { + public void testMocking() { given(this.caller.getService().greeting()).willReturn("Boot"); assertThat(this.caller.sayGreeting()).isEqualTo("I say Boot"); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnTestClassForNewBeanIntegrationTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnTestClassForNewBeanIntegrationTests.java index 7c7a256f58..8c98e8b31e 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnTestClassForNewBeanIntegrationTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnTestClassForNewBeanIntegrationTests.java @@ -42,7 +42,7 @@ public class MockBeanOnTestClassForNewBeanIntegrationTests { private ExampleServiceCaller caller; @Test - public void testMocking() throws Exception { + public void testMocking() { given(this.caller.getService().greeting()).willReturn("Boot"); assertThat(this.caller.sayGreeting()).isEqualTo("I say Boot"); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnTestFieldForExistingBeanCacheIntegrationTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnTestFieldForExistingBeanCacheIntegrationTests.java index 006f283fe8..26d18b89db 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnTestFieldForExistingBeanCacheIntegrationTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnTestFieldForExistingBeanCacheIntegrationTests.java @@ -48,7 +48,7 @@ public class MockBeanOnTestFieldForExistingBeanCacheIntegrationTests { private ExampleServiceCaller caller; @Test - public void testMocking() throws Exception { + public void testMocking() { given(this.exampleService.greeting()).willReturn("Boot"); assertThat(this.caller.sayGreeting()).isEqualTo("I say Boot"); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnTestFieldForExistingBeanIntegrationTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnTestFieldForExistingBeanIntegrationTests.java index 1191072150..803e8df995 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnTestFieldForExistingBeanIntegrationTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnTestFieldForExistingBeanIntegrationTests.java @@ -45,7 +45,7 @@ public class MockBeanOnTestFieldForExistingBeanIntegrationTests { private ExampleServiceCaller caller; @Test - public void testMocking() throws Exception { + public void testMocking() { given(this.exampleService.greeting()).willReturn("Boot"); assertThat(this.caller.sayGreeting()).isEqualTo("I say Boot"); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnTestFieldForExistingBeanWithQualifierIntegrationTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnTestFieldForExistingBeanWithQualifierIntegrationTests.java index 5bf58de582..2337f38231 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnTestFieldForExistingBeanWithQualifierIntegrationTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnTestFieldForExistingBeanWithQualifierIntegrationTests.java @@ -54,7 +54,7 @@ public class MockBeanOnTestFieldForExistingBeanWithQualifierIntegrationTests { private ApplicationContext applicationContext; @Test - public void testMocking() throws Exception { + public void testMocking() { this.caller.sayGreeting(); verify(this.service).greeting(); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnTestFieldForNewBeanIntegrationTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnTestFieldForNewBeanIntegrationTests.java index 0df877ccc4..92af7f4a2b 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnTestFieldForNewBeanIntegrationTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnTestFieldForNewBeanIntegrationTests.java @@ -44,7 +44,7 @@ public class MockBeanOnTestFieldForNewBeanIntegrationTests { private ExampleServiceCaller caller; @Test - public void testMocking() throws Exception { + public void testMocking() { given(this.exampleService.greeting()).willReturn("Boot"); assertThat(this.caller.sayGreeting()).isEqualTo("I say Boot"); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanWithAopProxyTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanWithAopProxyTests.java index f7cf213350..d6a3a4dad9 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanWithAopProxyTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanWithAopProxyTests.java @@ -53,7 +53,7 @@ public class MockBeanWithAopProxyTests { private DateService dateService; @Test - public void verifyShouldUseProxyTarget() throws Exception { + public void verifyShouldUseProxyTarget() { given(this.dateService.getDate(false)).willReturn(1L); Long d1 = this.dateService.getDate(false); assertThat(d1).isEqualTo(1L); diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanWithGenericsOnTestFieldForNewBeanIntegrationTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanWithGenericsOnTestFieldForNewBeanIntegrationTests.java index 393e679c5b..0474e348bd 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanWithGenericsOnTestFieldForNewBeanIntegrationTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanWithGenericsOnTestFieldForNewBeanIntegrationTests.java @@ -47,7 +47,7 @@ public class MockBeanWithGenericsOnTestFieldForNewBeanIntegrationTests { private ExampleGenericServiceCaller caller; @Test - public void testMocking() throws Exception { + public void testMocking() { given(this.exampleIntegerService.greeting()).willReturn(200); given(this.exampleStringService.greeting()).willReturn("Boot"); assertThat(this.caller.sayGreeting()).isEqualTo("I say 200 Boot"); diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockDefinitionTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockDefinitionTests.java index e78f231f83..dd9a51d2df 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockDefinitionTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockDefinitionTests.java @@ -44,14 +44,14 @@ public class MockDefinitionTests { public ExpectedException thrown = ExpectedException.none(); @Test - public void classToMockMustNotBeNull() throws Exception { + public void classToMockMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("TypeToMock must not be null"); new MockDefinition(null, null, null, null, false, null, null); } @Test - public void createWithDefaults() throws Exception { + public void createWithDefaults() { MockDefinition definition = new MockDefinition(null, EXAMPLE_SERVICE_TYPE, null, null, false, null, null); assertThat(definition.getName()).isNull(); @@ -64,7 +64,7 @@ public class MockDefinitionTests { } @Test - public void createExplicit() throws Exception { + public void createExplicit() { QualifierDefinition qualifier = mock(QualifierDefinition.class); MockDefinition definition = new MockDefinition("name", EXAMPLE_SERVICE_TYPE, new Class[] { ExampleExtraInterface.class }, @@ -81,7 +81,7 @@ public class MockDefinitionTests { } @Test - public void createMock() throws Exception { + public void createMock() { MockDefinition definition = new MockDefinition("name", EXAMPLE_SERVICE_TYPE, new Class[] { ExampleExtraInterface.class }, Answers.RETURNS_SMART_NULLS, true, MockReset.BEFORE, null); diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockResetTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockResetTests.java index c3d5afc6d1..a3a9fe1cd1 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockResetTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockResetTests.java @@ -64,7 +64,7 @@ public class MockResetTests { } @Test - public void apply() throws Exception { + public void apply() { ExampleService mock = mock(ExampleService.class, MockReset.apply(MockReset.AFTER, withSettings())); assertThat(MockReset.get(mock)).isEqualTo(MockReset.AFTER); diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockitoContextCustomizerFactoryTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockitoContextCustomizerFactoryTests.java index 0fe88a7dcd..3a04976727 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockitoContextCustomizerFactoryTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockitoContextCustomizerFactoryTests.java @@ -39,22 +39,21 @@ public class MockitoContextCustomizerFactoryTests { } @Test - public void getContextCustomizerWithoutAnnotationReturnsCustomizer() - throws Exception { + public void getContextCustomizerWithoutAnnotationReturnsCustomizer() { ContextCustomizer customizer = this.factory .createContextCustomizer(NoMockBeanAnnotation.class, null); assertThat(customizer).isNotNull(); } @Test - public void getContextCustomizerWithAnnotationReturnsCustomizer() throws Exception { + public void getContextCustomizerWithAnnotationReturnsCustomizer() { ContextCustomizer customizer = this.factory .createContextCustomizer(WithMockBeanAnnotation.class, null); assertThat(customizer).isNotNull(); } @Test - public void getContextCustomizerUsesMocksAsCacheKey() throws Exception { + public void getContextCustomizerUsesMocksAsCacheKey() { ContextCustomizer customizer = this.factory .createContextCustomizer(WithMockBeanAnnotation.class, null); assertThat(customizer).isNotNull(); diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockitoPostProcessorTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockitoPostProcessorTests.java index 4b943d7e2b..1a3c426b5b 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockitoPostProcessorTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockitoPostProcessorTests.java @@ -140,7 +140,7 @@ public class MockitoPostProcessorTests { static class TestFactoryBean implements FactoryBean { @Override - public Object getObject() throws Exception { + public Object getObject() { return new TestBean(); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/QualifierDefinitionTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/QualifierDefinitionTests.java index 2de81729aa..5b9ea9b371 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/QualifierDefinitionTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/QualifierDefinitionTests.java @@ -57,33 +57,31 @@ public class QualifierDefinitionTests { } @Test - public void forElementFieldIsNullShouldReturnNull() throws Exception { + public void forElementFieldIsNullShouldReturnNull() { assertThat(QualifierDefinition.forElement((Field) null)).isNull(); } @Test - public void forElementWhenElementIsNotFieldShouldReturnNull() throws Exception { + public void forElementWhenElementIsNotFieldShouldReturnNull() { assertThat(QualifierDefinition.forElement(getClass())).isNull(); } @Test - public void forElementWhenElementIsFieldWithNoQualifiersShouldReturnNull() - throws Exception { + public void forElementWhenElementIsFieldWithNoQualifiersShouldReturnNull() { QualifierDefinition definition = QualifierDefinition .forElement(ReflectionUtils.findField(ConfigA.class, "noQualifier")); assertThat(definition).isNull(); } @Test - public void forElementWhenElementIsFieldWithQualifierShouldReturnDefinition() - throws Exception { + public void forElementWhenElementIsFieldWithQualifierShouldReturnDefinition() { QualifierDefinition definition = QualifierDefinition .forElement(ReflectionUtils.findField(ConfigA.class, "directQualifier")); assertThat(definition).isNotNull(); } @Test - public void matchesShouldCallBeanFactory() throws Exception { + public void matchesShouldCallBeanFactory() { Field field = ReflectionUtils.findField(ConfigA.class, "directQualifier"); QualifierDefinition qualifierDefinition = QualifierDefinition.forElement(field); qualifierDefinition.matches(this.beanFactory, "bean"); @@ -94,7 +92,7 @@ public class QualifierDefinitionTests { } @Test - public void applyToShouldSetQualifierElement() throws Exception { + public void applyToShouldSetQualifierElement() { Field field = ReflectionUtils.findField(ConfigA.class, "directQualifier"); QualifierDefinition qualifierDefinition = QualifierDefinition.forElement(field); RootBeanDefinition definition = new RootBeanDefinition(); @@ -103,7 +101,7 @@ public class QualifierDefinitionTests { } @Test - public void hashCodeAndEqualsShouldWorkOnDifferentClasses() throws Exception { + public void hashCodeAndEqualsShouldWorkOnDifferentClasses() { QualifierDefinition directQualifier1 = QualifierDefinition .forElement(ReflectionUtils.findField(ConfigA.class, "directQualifier")); QualifierDefinition directQualifier2 = QualifierDefinition diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/ResetMocksTestExecutionListenerTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/ResetMocksTestExecutionListenerTests.java index 04db754bcb..df7e678c92 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/ResetMocksTestExecutionListenerTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/ResetMocksTestExecutionListenerTests.java @@ -107,7 +107,7 @@ public class ResetMocksTestExecutionListenerTests { static class BrokenFactoryBean implements FactoryBean { @Override - public String getObject() throws Exception { + public String getObject() { throw new IllegalStateException(); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnConfigurationClassForExistingBeanIntegrationTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnConfigurationClassForExistingBeanIntegrationTests.java index 230647da34..2a4a86db67 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnConfigurationClassForExistingBeanIntegrationTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnConfigurationClassForExistingBeanIntegrationTests.java @@ -41,7 +41,7 @@ public class SpyBeanOnConfigurationClassForExistingBeanIntegrationTests { private ExampleServiceCaller caller; @Test - public void testSpying() throws Exception { + public void testSpying() { assertThat(this.caller.sayGreeting()).isEqualTo("I say simple"); verify(this.caller.getService()).greeting(); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnConfigurationClassForNewBeanIntegrationTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnConfigurationClassForNewBeanIntegrationTests.java index a9f1d36678..7fee17916e 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnConfigurationClassForNewBeanIntegrationTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnConfigurationClassForNewBeanIntegrationTests.java @@ -41,7 +41,7 @@ public class SpyBeanOnConfigurationClassForNewBeanIntegrationTests { private ExampleServiceCaller caller; @Test - public void testSpying() throws Exception { + public void testSpying() { assertThat(this.caller.sayGreeting()).isEqualTo("I say simple"); verify(this.caller.getService()).greeting(); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnConfigurationFieldForExistingBeanIntegrationTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnConfigurationFieldForExistingBeanIntegrationTests.java index 563e774831..c71a76f42f 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnConfigurationFieldForExistingBeanIntegrationTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnConfigurationFieldForExistingBeanIntegrationTests.java @@ -46,7 +46,7 @@ public class SpyBeanOnConfigurationFieldForExistingBeanIntegrationTests { private ExampleServiceCaller caller; @Test - public void testSpying() throws Exception { + public void testSpying() { assertThat(this.caller.sayGreeting()).isEqualTo("I say simple"); verify(this.config.exampleService).greeting(); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnConfigurationFieldForNewBeanIntegrationTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnConfigurationFieldForNewBeanIntegrationTests.java index 079da49edf..caed2192ba 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnConfigurationFieldForNewBeanIntegrationTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnConfigurationFieldForNewBeanIntegrationTests.java @@ -45,7 +45,7 @@ public class SpyBeanOnConfigurationFieldForNewBeanIntegrationTests { private ExampleServiceCaller caller; @Test - public void testSpying() throws Exception { + public void testSpying() { assertThat(this.caller.sayGreeting()).isEqualTo("I say simple"); verify(this.config.exampleService).greeting(); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnContextHierarchyIntegrationTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnContextHierarchyIntegrationTests.java index 0cbb35b6cf..b2aef9a09a 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnContextHierarchyIntegrationTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnContextHierarchyIntegrationTests.java @@ -49,7 +49,7 @@ public class SpyBeanOnContextHierarchyIntegrationTests { private ChildConfig childConfig; @Test - public void testSpying() throws Exception { + public void testSpying() { ApplicationContext context = this.childConfig.getContext(); ApplicationContext parentContext = context.getParent(); assertThat(parentContext.getBeanNamesForType(ExampleService.class)).hasSize(1); diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestClassForExistingBeanIntegrationTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestClassForExistingBeanIntegrationTests.java index 5850c4dc5b..ecaaa09b30 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestClassForExistingBeanIntegrationTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestClassForExistingBeanIntegrationTests.java @@ -42,7 +42,7 @@ public class SpyBeanOnTestClassForExistingBeanIntegrationTests { private ExampleServiceCaller caller; @Test - public void testSpying() throws Exception { + public void testSpying() { assertThat(this.caller.sayGreeting()).isEqualTo("I say simple"); verify(this.caller.getService()).greeting(); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestClassForNewBeanIntegrationTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestClassForNewBeanIntegrationTests.java index e897f08101..00fac62abf 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestClassForNewBeanIntegrationTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestClassForNewBeanIntegrationTests.java @@ -42,7 +42,7 @@ public class SpyBeanOnTestClassForNewBeanIntegrationTests { private ExampleServiceCaller caller; @Test - public void testSpying() throws Exception { + public void testSpying() { assertThat(this.caller.sayGreeting()).isEqualTo("I say simple"); verify(this.caller.getService()).greeting(); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestFieldForExistingBeanCacheIntegrationTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestFieldForExistingBeanCacheIntegrationTests.java index 5ba5529f87..839c6ed6bc 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestFieldForExistingBeanCacheIntegrationTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestFieldForExistingBeanCacheIntegrationTests.java @@ -48,7 +48,7 @@ public class SpyBeanOnTestFieldForExistingBeanCacheIntegrationTests { private ExampleServiceCaller caller; @Test - public void testSpying() throws Exception { + public void testSpying() { assertThat(this.caller.sayGreeting()).isEqualTo("I say simple"); verify(this.caller.getService()).greeting(); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestFieldForExistingBeanIntegrationTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestFieldForExistingBeanIntegrationTests.java index 7122bd4384..156d47588f 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestFieldForExistingBeanIntegrationTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestFieldForExistingBeanIntegrationTests.java @@ -45,7 +45,7 @@ public class SpyBeanOnTestFieldForExistingBeanIntegrationTests { private ExampleServiceCaller caller; @Test - public void testSpying() throws Exception { + public void testSpying() { assertThat(this.caller.sayGreeting()).isEqualTo("I say simple"); verify(this.caller.getService()).greeting(); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestFieldForExistingGenericBeanIntegrationTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestFieldForExistingGenericBeanIntegrationTests.java index 88febc47b4..e570d68104 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestFieldForExistingGenericBeanIntegrationTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestFieldForExistingGenericBeanIntegrationTests.java @@ -50,7 +50,7 @@ public class SpyBeanOnTestFieldForExistingGenericBeanIntegrationTests { private ExampleGenericServiceCaller caller; @Test - public void testSpying() throws Exception { + public void testSpying() { assertThat(this.caller.sayGreeting()).isEqualTo("I say 123 simple"); verify(this.exampleService).greeting(); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestFieldForMultipleExistingBeansWithOnePrimaryIntegrationTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestFieldForMultipleExistingBeansWithOnePrimaryIntegrationTests.java index f4756514bb..5baf751f25 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestFieldForMultipleExistingBeansWithOnePrimaryIntegrationTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestFieldForMultipleExistingBeansWithOnePrimaryIntegrationTests.java @@ -48,7 +48,7 @@ public class SpyBeanOnTestFieldForMultipleExistingBeansWithOnePrimaryIntegration private ExampleGenericStringServiceCaller caller; @Test - public void testSpying() throws Exception { + public void testSpying() { assertThat(this.caller.sayGreeting()).isEqualTo("I say two"); assertThat(Mockito.mockingDetails(this.spy).getMockCreationSettings() .getMockName().toString()).isEqualTo("two"); diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestFieldForNewBeanIntegrationTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestFieldForNewBeanIntegrationTests.java index 612a398c72..cbeb52a444 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestFieldForNewBeanIntegrationTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestFieldForNewBeanIntegrationTests.java @@ -44,7 +44,7 @@ public class SpyBeanOnTestFieldForNewBeanIntegrationTests { private ExampleServiceCaller caller; @Test - public void testSpying() throws Exception { + public void testSpying() { assertThat(this.caller.sayGreeting()).isEqualTo("I say simple"); verify(this.caller.getService()).greeting(); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanWithAopProxyAndNotProxyTargetAwareTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanWithAopProxyAndNotProxyTargetAwareTests.java index 9961437fe7..005529621f 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanWithAopProxyAndNotProxyTargetAwareTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanWithAopProxyAndNotProxyTargetAwareTests.java @@ -53,7 +53,7 @@ public class SpyBeanWithAopProxyAndNotProxyTargetAwareTests { private DateService dateService; @Test(expected = UnfinishedVerificationException.class) - public void verifyShouldUseProxyTarget() throws Exception { + public void verifyShouldUseProxyTarget() { this.dateService.getDate(false); verify(this.dateService, times(1)).getDate(false); verify(this.dateService, times(1)).getDate(eq(false)); diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanWithNameOnTestFieldForMultipleExistingBeansTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanWithNameOnTestFieldForMultipleExistingBeansTests.java index 8ebaa066fd..304a8f1c2b 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanWithNameOnTestFieldForMultipleExistingBeansTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanWithNameOnTestFieldForMultipleExistingBeansTests.java @@ -42,7 +42,7 @@ public class SpyBeanWithNameOnTestFieldForMultipleExistingBeansTests { private SimpleExampleStringGenericService spy; @Test - public void testSpying() throws Exception { + public void testSpying() { MockingDetails mockingDetails = Mockito.mockingDetails(this.spy); assertThat(mockingDetails.isSpy()).isTrue(); assertThat(mockingDetails.getMockCreationSettings().getMockName().toString()) diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyDefinitionTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyDefinitionTests.java index 673ccb3eee..d76a4d5219 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyDefinitionTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyDefinitionTests.java @@ -45,14 +45,14 @@ public class SpyDefinitionTests { public ExpectedException thrown = ExpectedException.none(); @Test - public void classToSpyMustNotBeNull() throws Exception { + public void classToSpyMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("TypeToSpy must not be null"); new SpyDefinition(null, null, null, true, null); } @Test - public void createWithDefaults() throws Exception { + public void createWithDefaults() { SpyDefinition definition = new SpyDefinition(null, REAL_SERVICE_TYPE, null, true, null); assertThat(definition.getName()).isNull(); @@ -63,7 +63,7 @@ public class SpyDefinitionTests { } @Test - public void createExplicit() throws Exception { + public void createExplicit() { QualifierDefinition qualifier = mock(QualifierDefinition.class); SpyDefinition definition = new SpyDefinition("name", REAL_SERVICE_TYPE, MockReset.BEFORE, false, qualifier); @@ -75,7 +75,7 @@ public class SpyDefinitionTests { } @Test - public void createSpy() throws Exception { + public void createSpy() { SpyDefinition definition = new SpyDefinition("name", REAL_SERVICE_TYPE, MockReset.BEFORE, true, null); RealExampleService spy = definition.createSpy(new RealExampleService("hello")); @@ -88,7 +88,7 @@ public class SpyDefinitionTests { } @Test - public void createSpyWhenNullInstanceShouldThrowException() throws Exception { + public void createSpyWhenNullInstanceShouldThrowException() { SpyDefinition definition = new SpyDefinition("name", REAL_SERVICE_TYPE, MockReset.BEFORE, true, null); this.thrown.expect(IllegalArgumentException.class); @@ -97,7 +97,7 @@ public class SpyDefinitionTests { } @Test - public void createSpyWhenWrongInstanceShouldThrowException() throws Exception { + public void createSpyWhenWrongInstanceShouldThrowException() { SpyDefinition definition = new SpyDefinition("name", REAL_SERVICE_TYPE, MockReset.BEFORE, true, null); this.thrown.expect(IllegalArgumentException.class); @@ -106,7 +106,7 @@ public class SpyDefinitionTests { } @Test - public void createSpyTwice() throws Exception { + public void createSpyTwice() { SpyDefinition definition = new SpyDefinition("name", REAL_SERVICE_TYPE, MockReset.BEFORE, true, null); Object instance = new RealExampleService("hello"); diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/rule/OutputCaptureTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/rule/OutputCaptureTests.java index bc25e722bf..cd429d5729 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/rule/OutputCaptureTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/rule/OutputCaptureTests.java @@ -32,13 +32,13 @@ public class OutputCaptureTests { public OutputCapture outputCapture = new OutputCapture(); @Test - public void toStringShouldReturnAllCapturedOutput() throws Exception { + public void toStringShouldReturnAllCapturedOutput() { System.out.println("Hello World"); assertThat(this.outputCapture.toString()).contains("Hello World"); } @Test - public void reset() throws Exception { + public void reset() { System.out.println("Hello"); this.outputCapture.reset(); System.out.println("World"); diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/util/TestPropertyValuesTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/util/TestPropertyValuesTests.java index 79f6708aa4..86ac49c8e1 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/util/TestPropertyValuesTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/util/TestPropertyValuesTests.java @@ -37,8 +37,7 @@ public class TestPropertyValuesTests { private final ConfigurableEnvironment environment = new StandardEnvironment(); @Test - public void applyToEnvironmentShouldAttachConfigurationPropertySource() - throws Exception { + public void applyToEnvironmentShouldAttachConfigurationPropertySource() { TestPropertyValues.of("foo.bar=baz").applyTo(this.environment); PropertySource source = this.environment.getPropertySources() .get("configurationProperties"); @@ -46,14 +45,14 @@ public class TestPropertyValuesTests { } @Test - public void applyToDefaultPropertySource() throws Exception { + public void applyToDefaultPropertySource() { TestPropertyValues.of("foo.bar=baz", "hello.world=hi").applyTo(this.environment); assertThat(this.environment.getProperty("foo.bar")).isEqualTo("baz"); assertThat(this.environment.getProperty("hello.world")).isEqualTo("hi"); } @Test - public void applyToSystemPropertySource() throws Exception { + public void applyToSystemPropertySource() { TestPropertyValues.of("FOO_BAR=BAZ").applyTo(this.environment, Type.SYSTEM_ENVIRONMENT); assertThat(this.environment.getProperty("foo.bar")).isEqualTo("BAZ"); @@ -63,15 +62,14 @@ public class TestPropertyValuesTests { } @Test - public void applyToWithSpecificName() throws Exception { + public void applyToWithSpecificName() { TestPropertyValues.of("foo.bar=baz").applyTo(this.environment, Type.MAP, "other"); assertThat(this.environment.getPropertySources().get("other")).isNotNull(); assertThat(this.environment.getProperty("foo.bar")).isEqualTo("baz"); } @Test - public void applyToExistingNameAndDifferentTypeShouldOverrideExistingOne() - throws Exception { + public void applyToExistingNameAndDifferentTypeShouldOverrideExistingOne() { TestPropertyValues.of("foo.bar=baz", "hello.world=hi").applyTo(this.environment, Type.MAP, "other"); TestPropertyValues.of("FOO_BAR=BAZ").applyTo(this.environment, @@ -83,7 +81,7 @@ public class TestPropertyValuesTests { } @Test - public void applyToExistingNameAndSameTypeShouldMerge() throws Exception { + public void applyToExistingNameAndSameTypeShouldMerge() { TestPropertyValues.of("foo.bar=baz", "hello.world=hi").applyTo(this.environment, Type.MAP); TestPropertyValues.of("foo.bar=new").applyTo(this.environment, Type.MAP); @@ -92,7 +90,7 @@ public class TestPropertyValuesTests { } @Test - public void andShouldChainAndAddSingleKeyValue() throws Exception { + public void andShouldChainAndAddSingleKeyValue() { TestPropertyValues.of("foo.bar=baz").and("hello.world=hi").and("bling.blah=bing") .applyTo(this.environment, Type.MAP); assertThat(this.environment.getProperty("foo.bar")).isEqualTo("baz"); @@ -101,7 +99,7 @@ public class TestPropertyValuesTests { } @Test - public void applyToSystemPropertiesShouldSetSystemProperties() throws Exception { + public void applyToSystemPropertiesShouldSetSystemProperties() { TestPropertyValues.of("foo=bar").applyToSystemProperties(() -> { assertThat(System.getProperty("foo")).isEqualTo("bar"); return null; @@ -109,7 +107,7 @@ public class TestPropertyValuesTests { } @Test - public void applyToSystemPropertiesShouldRestoreSystemProperties() throws Exception { + public void applyToSystemPropertiesShouldRestoreSystemProperties() { System.setProperty("foo", "bar1"); System.clearProperty("baz"); try { @@ -127,8 +125,7 @@ public class TestPropertyValuesTests { } @Test - public void applyToSystemPropertiesWhenValueIsNullShouldRemoveProperty() - throws Exception { + public void applyToSystemPropertiesWhenValueIsNullShouldRemoveProperty() { System.setProperty("foo", "bar1"); try { TestPropertyValues.of("foo").applyToSystemProperties(() -> { diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/client/LocalHostUriTemplateHandlerTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/client/LocalHostUriTemplateHandlerTests.java index c131de969e..04f9aab156 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/client/LocalHostUriTemplateHandlerTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/client/LocalHostUriTemplateHandlerTests.java @@ -51,7 +51,7 @@ public class LocalHostUriTemplateHandlerTests { } @Test - public void getRootUriShouldUseLocalServerPort() throws Exception { + public void getRootUriShouldUseLocalServerPort() { MockEnvironment environment = new MockEnvironment(); environment.setProperty("local.server.port", "1234"); LocalHostUriTemplateHandler handler = new LocalHostUriTemplateHandler( @@ -60,7 +60,7 @@ public class LocalHostUriTemplateHandlerTests { } @Test - public void getRootUriWhenLocalServerPortMissingShouldUsePort8080() throws Exception { + public void getRootUriWhenLocalServerPortMissingShouldUsePort8080() { MockEnvironment environment = new MockEnvironment(); LocalHostUriTemplateHandler handler = new LocalHostUriTemplateHandler( environment); @@ -76,7 +76,7 @@ public class LocalHostUriTemplateHandlerTests { } @Test - public void getRootUriShouldUseContextPath() throws Exception { + public void getRootUriShouldUseContextPath() { MockEnvironment environment = new MockEnvironment(); environment.setProperty("server.servlet.context-path", "/foo"); LocalHostUriTemplateHandler handler = new LocalHostUriTemplateHandler( diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/client/MockServerRestTemplateCustomizerTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/client/MockServerRestTemplateCustomizerTests.java index 58ab935f37..2e2166ff91 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/client/MockServerRestTemplateCustomizerTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/client/MockServerRestTemplateCustomizerTests.java @@ -49,7 +49,7 @@ public class MockServerRestTemplateCustomizerTests { } @Test - public void createShouldUseSimpleRequestExpectationManager() throws Exception { + public void createShouldUseSimpleRequestExpectationManager() { MockServerRestTemplateCustomizer customizer = new MockServerRestTemplateCustomizer(); customizer.customize(new RestTemplate()); assertThat(customizer.getServer()).extracting("expectationManager") @@ -57,15 +57,14 @@ public class MockServerRestTemplateCustomizerTests { } @Test - public void createWhenExpectationManagerClassIsNullShouldThrowException() - throws Exception { + public void createWhenExpectationManagerClassIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("ExpectationManager must not be null"); new MockServerRestTemplateCustomizer(null); } @Test - public void createShouldUseExpectationManagerClass() throws Exception { + public void createShouldUseExpectationManagerClass() { MockServerRestTemplateCustomizer customizer = new MockServerRestTemplateCustomizer( UnorderedRequestExpectationManager.class); customizer.customize(new RestTemplate()); @@ -74,7 +73,7 @@ public class MockServerRestTemplateCustomizerTests { } @Test - public void detectRootUriShouldDefaultToTrue() throws Exception { + public void detectRootUriShouldDefaultToTrue() { MockServerRestTemplateCustomizer customizer = new MockServerRestTemplateCustomizer( UnorderedRequestExpectationManager.class); customizer.customize( @@ -84,7 +83,7 @@ public class MockServerRestTemplateCustomizerTests { } @Test - public void setDetectRootUriShouldDisableRootUriDetection() throws Exception { + public void setDetectRootUriShouldDisableRootUriDetection() { this.customizer.setDetectRootUri(false); this.customizer.customize( new RestTemplateBuilder().rootUri("http://example.com").build()); @@ -94,7 +93,7 @@ public class MockServerRestTemplateCustomizerTests { } @Test - public void customizeShouldBindServer() throws Exception { + public void customizeShouldBindServer() { RestTemplate template = new RestTemplateBuilder(this.customizer).build(); this.customizer.getServer().expect(requestTo("/test")).andRespond(withSuccess()); template.getForEntity("/test", String.class); @@ -102,7 +101,7 @@ public class MockServerRestTemplateCustomizerTests { } @Test - public void getServerWhenNoServersAreBoundShouldThrowException() throws Exception { + public void getServerWhenNoServersAreBoundShouldThrowException() { this.thrown.expect(IllegalStateException.class); this.thrown.expectMessage("Unable to return a single MockRestServiceServer since " + "MockServerRestTemplateCustomizer has not been bound to a RestTemplate"); @@ -110,8 +109,7 @@ public class MockServerRestTemplateCustomizerTests { } @Test - public void getServerWhenMultipleServersAreBoundShouldThrowException() - throws Exception { + public void getServerWhenMultipleServersAreBoundShouldThrowException() { this.customizer.customize(new RestTemplate()); this.customizer.customize(new RestTemplate()); this.thrown.expect(IllegalStateException.class); @@ -121,7 +119,7 @@ public class MockServerRestTemplateCustomizerTests { } @Test - public void getServerWhenSingleServerIsBoundShouldReturnServer() throws Exception { + public void getServerWhenSingleServerIsBoundShouldReturnServer() { RestTemplate template = new RestTemplate(); this.customizer.customize(template); assertThat(this.customizer.getServer()) @@ -129,7 +127,7 @@ public class MockServerRestTemplateCustomizerTests { } @Test - public void getServerWhenRestTemplateIsFoundShouldReturnServer() throws Exception { + public void getServerWhenRestTemplateIsFoundShouldReturnServer() { RestTemplate template1 = new RestTemplate(); RestTemplate template2 = new RestTemplate(); this.customizer.customize(template1); @@ -140,7 +138,7 @@ public class MockServerRestTemplateCustomizerTests { } @Test - public void getServerWhenRestTemplateIsNotFoundShouldReturnNull() throws Exception { + public void getServerWhenRestTemplateIsNotFoundShouldReturnNull() { RestTemplate template1 = new RestTemplate(); RestTemplate template2 = new RestTemplate(); this.customizer.customize(template1); @@ -149,7 +147,7 @@ public class MockServerRestTemplateCustomizerTests { } @Test - public void getServersShouldReturnServers() throws Exception { + public void getServersShouldReturnServers() { RestTemplate template1 = new RestTemplate(); RestTemplate template2 = new RestTemplate(); this.customizer.customize(template1); @@ -158,7 +156,7 @@ public class MockServerRestTemplateCustomizerTests { } @Test - public void getExpectationManagersShouldReturnExpectationManagers() throws Exception { + public void getExpectationManagersShouldReturnExpectationManagers() { RestTemplate template1 = new RestTemplate(); RestTemplate template2 = new RestTemplate(); this.customizer.customize(template1); diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/client/RootUriRequestExpectationManagerTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/client/RootUriRequestExpectationManagerTests.java index 881a6aa9b8..0760ff2ebc 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/client/RootUriRequestExpectationManagerTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/client/RootUriRequestExpectationManagerTests.java @@ -71,22 +71,21 @@ public class RootUriRequestExpectationManagerTests { } @Test - public void createWhenRootUriIsNullShouldThrowException() throws Exception { + public void createWhenRootUriIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("RootUri must not be null"); new RootUriRequestExpectationManager(null, this.delegate); } @Test - public void createWhenExpectationManagerIsNullShouldThrowException() - throws Exception { + public void createWhenExpectationManagerIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("ExpectationManager must not be null"); new RootUriRequestExpectationManager(this.uri, null); } @Test - public void expectRequestShouldDelegateToExpectationManager() throws Exception { + public void expectRequestShouldDelegateToExpectationManager() { ExpectedCount count = mock(ExpectedCount.class); RequestMatcher requestMatcher = mock(RequestMatcher.class); this.manager.expectRequest(count, requestMatcher); @@ -128,13 +127,13 @@ public class RootUriRequestExpectationManagerTests { } @Test - public void resetRequestShouldDelegateToExpectationManager() throws Exception { + public void resetRequestShouldDelegateToExpectationManager() { this.manager.reset(); verify(this.delegate).reset(); } @Test - public void bindToShouldReturnMockRestServiceServer() throws Exception { + public void bindToShouldReturnMockRestServiceServer() { RestTemplate restTemplate = new RestTemplateBuilder().build(); MockRestServiceServer bound = RootUriRequestExpectationManager .bindTo(restTemplate); @@ -142,8 +141,7 @@ public class RootUriRequestExpectationManagerTests { } @Test - public void bindToWithExpectationManagerShouldReturnMockRestServiceServer() - throws Exception { + public void bindToWithExpectationManagerShouldReturnMockRestServiceServer() { RestTemplate restTemplate = new RestTemplateBuilder().build(); MockRestServiceServer bound = RootUriRequestExpectationManager .bindTo(restTemplate, this.delegate); @@ -151,8 +149,7 @@ public class RootUriRequestExpectationManagerTests { } @Test - public void forRestTemplateWhenUsingRootUriTemplateHandlerShouldReturnRootUriRequestExpectationManager() - throws Exception { + public void forRestTemplateWhenUsingRootUriTemplateHandlerShouldReturnRootUriRequestExpectationManager() { RestTemplate restTemplate = new RestTemplateBuilder().rootUri(this.uri).build(); RequestExpectationManager actual = RootUriRequestExpectationManager .forRestTemplate(restTemplate, this.delegate); @@ -161,8 +158,7 @@ public class RootUriRequestExpectationManagerTests { } @Test - public void forRestTemplateWhenNotUsingRootUriTemplateHandlerShouldReturnOriginalRequestExpectationManager() - throws Exception { + public void forRestTemplateWhenNotUsingRootUriTemplateHandlerShouldReturnOriginalRequestExpectationManager() { RestTemplate restTemplate = new RestTemplateBuilder().build(); RequestExpectationManager actual = RootUriRequestExpectationManager .forRestTemplate(restTemplate, this.delegate); diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/client/TestRestTemplateTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/client/TestRestTemplateTests.java index 3740c0e4e2..03eba0a794 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/client/TestRestTemplateTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/client/TestRestTemplateTests.java @@ -113,7 +113,7 @@ public class TestRestTemplateTests { } @Test - public void options() throws Exception { + public void options() { TestRestTemplate template = new TestRestTemplate( HttpClientOption.ENABLE_REDIRECTS); CustomHttpComponentsClientHttpRequestFactory factory = (CustomHttpComponentsClientHttpRequestFactory) template @@ -123,7 +123,7 @@ public class TestRestTemplateTests { } @Test - public void restOperationsAreAvailable() throws Exception { + public void restOperationsAreAvailable() { RestTemplate delegate = mock(RestTemplate.class); given(delegate.getUriTemplateHandler()) .willReturn(new DefaultUriBuilderFactory()); @@ -132,7 +132,7 @@ public class TestRestTemplateTests { @Override public void doWith(Method method) - throws IllegalArgumentException, IllegalAccessException { + throws IllegalArgumentException { Method equivalent = ReflectionUtils.findMethod(TestRestTemplate.class, method.getName(), method.getParameterTypes()); assertThat(equivalent).as("Method %s not found", method).isNotNull(); @@ -223,7 +223,7 @@ public class TestRestTemplateTests { } @Test - public void withBasicAuthDoesNotResetErrorHandler() throws Exception { + public void withBasicAuthDoesNotResetErrorHandler() { TestRestTemplate originalTemplate = new TestRestTemplate("foo", "bar"); ResponseErrorHandler errorHandler = mock(ResponseErrorHandler.class); originalTemplate.getRestTemplate().setErrorHandler(errorHandler); diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/htmlunit/LocalHostWebClientTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/htmlunit/LocalHostWebClientTests.java index 3f6ba54d2d..e93403d627 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/htmlunit/LocalHostWebClientTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/htmlunit/LocalHostWebClientTests.java @@ -59,7 +59,7 @@ public class LocalHostWebClientTests { } @Test - public void createWhenEnvironmentIsNullWillThrowException() throws Exception { + public void createWhenEnvironmentIsNullWillThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Environment must not be null"); new LocalHostWebClient(null); diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/htmlunit/webdriver/LocalHostWebConnectionHtmlUnitDriverTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/htmlunit/webdriver/LocalHostWebConnectionHtmlUnitDriverTests.java index 3406d02c4c..22a8285e97 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/htmlunit/webdriver/LocalHostWebConnectionHtmlUnitDriverTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/htmlunit/webdriver/LocalHostWebConnectionHtmlUnitDriverTests.java @@ -59,31 +59,28 @@ public class LocalHostWebConnectionHtmlUnitDriverTests { } @Test - public void createWhenEnvironmentIsNullWillThrowException() throws Exception { + public void createWhenEnvironmentIsNullWillThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Environment must not be null"); new LocalHostWebConnectionHtmlUnitDriver(null); } @Test - public void createWithJavascriptFlagWhenEnvironmentIsNullWillThrowException() - throws Exception { + public void createWithJavascriptFlagWhenEnvironmentIsNullWillThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Environment must not be null"); new LocalHostWebConnectionHtmlUnitDriver(null, true); } @Test - public void createWithBrowserVersionWhenEnvironmentIsNullWillThrowException() - throws Exception { + public void createWithBrowserVersionWhenEnvironmentIsNullWillThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Environment must not be null"); new LocalHostWebConnectionHtmlUnitDriver(null, BrowserVersion.CHROME); } @Test - public void createWithCapabilitiesWhenEnvironmentIsNullWillThrowException() - throws Exception { + public void createWithCapabilitiesWhenEnvironmentIsNullWillThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Environment must not be null"); Capabilities capabilities = mock(Capabilities.class); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessorTests.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessorTests.java index e9ac5adb7c..896a8c106e 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessorTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessorTests.java @@ -891,7 +891,7 @@ public class ConfigurationMetadataAnnotationProcessorTests { assertThat(metadata).doesNotHave(Metadata.withProperty(prefix + ".ignored")); } - private ConfigurationMetadata compile(Class... types) throws IOException { + private ConfigurationMetadata compile(Class... types) { TestConfigurationMetadataAnnotationProcessor processor = new TestConfigurationMetadataAnnotationProcessor( this.compiler.getOutputLocation()); this.compiler.getTask(types).call(processor); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/LayoutsTests.java b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/LayoutsTests.java index 93c7452e48..59380972ec 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/LayoutsTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/LayoutsTests.java @@ -36,7 +36,7 @@ public class LayoutsTests { public ExpectedException thrown = ExpectedException.none(); @Test - public void jarFile() throws Exception { + public void jarFile() { assertThat(Layouts.forFile(new File("test.jar"))).isInstanceOf(Layouts.Jar.class); assertThat(Layouts.forFile(new File("test.JAR"))).isInstanceOf(Layouts.Jar.class); assertThat(Layouts.forFile(new File("test.jAr"))).isInstanceOf(Layouts.Jar.class); @@ -45,7 +45,7 @@ public class LayoutsTests { } @Test - public void warFile() throws Exception { + public void warFile() { assertThat(Layouts.forFile(new File("test.war"))).isInstanceOf(Layouts.War.class); assertThat(Layouts.forFile(new File("test.WAR"))).isInstanceOf(Layouts.War.class); assertThat(Layouts.forFile(new File("test.wAr"))).isInstanceOf(Layouts.War.class); @@ -54,14 +54,14 @@ public class LayoutsTests { } @Test - public void unknownFile() throws Exception { + public void unknownFile() { this.thrown.expect(IllegalStateException.class); this.thrown.expectMessage("Unable to deduce layout for 'test.txt'"); Layouts.forFile(new File("test.txt")); } @Test - public void jarLayout() throws Exception { + public void jarLayout() { Layout layout = new Layouts.Jar(); assertThat(layout.getLibraryDestination("lib.jar", LibraryScope.COMPILE)) .isEqualTo("BOOT-INF/lib/"); @@ -74,7 +74,7 @@ public class LayoutsTests { } @Test - public void warLayout() throws Exception { + public void warLayout() { Layout layout = new Layouts.War(); assertThat(layout.getLibraryDestination("lib.jar", LibraryScope.COMPILE)) .isEqualTo("WEB-INF/lib/"); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/RepackagerTests.java b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/RepackagerTests.java index 2c97b447be..81001a5b61 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/RepackagerTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/RepackagerTests.java @@ -86,19 +86,19 @@ public class RepackagerTests { } @Test - public void nullSource() throws Exception { + public void nullSource() { this.thrown.expect(IllegalArgumentException.class); new Repackager(null); } @Test - public void missingSource() throws Exception { + public void missingSource() { this.thrown.expect(IllegalArgumentException.class); new Repackager(new File("missing")); } @Test - public void directorySource() throws Exception { + public void directorySource() { this.thrown.expect(IllegalArgumentException.class); new Repackager(this.temporaryFolder.getRoot()); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/PropertiesLauncherTests.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/PropertiesLauncherTests.java index eb980be62d..ce816b9258 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/PropertiesLauncherTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/PropertiesLauncherTests.java @@ -65,7 +65,7 @@ public class PropertiesLauncherTests { private ClassLoader contextClassLoader; @Before - public void setup() throws IOException { + public void setup() { this.contextClassLoader = Thread.currentThread().getContextClassLoader(); MockitoAnnotations.initMocks(this); System.setProperty("loader.home", @@ -102,7 +102,7 @@ public class PropertiesLauncherTests { } @Test - public void testNonExistentHome() throws Exception { + public void testNonExistentHome() { System.setProperty("loader.home", "src/test/resources/nonexistent"); this.expected.expectMessage("Invalid source folder"); PropertiesLauncher launcher = new PropertiesLauncher(); @@ -134,7 +134,7 @@ public class PropertiesLauncherTests { } @Test - public void testUserSpecifiedDotPath() throws Exception { + public void testUserSpecifiedDotPath() { System.setProperty("loader.path", "."); PropertiesLauncher launcher = new PropertiesLauncher(); assertThat(ReflectionTestUtils.getField(launcher, "paths").toString()) @@ -299,7 +299,7 @@ public class PropertiesLauncherTests { } @Test - public void testSystemPropertiesSet() throws Exception { + public void testSystemPropertiesSet() { System.setProperty("loader.system", "true"); new PropertiesLauncher(); assertThat(System.getProperty("loader.main")).isEqualTo("demo.Application"); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/archive/ExplodedArchiveTests.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/archive/ExplodedArchiveTests.java index 08f07304a4..5caa97fb75 100755 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/archive/ExplodedArchiveTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/archive/ExplodedArchiveTests.java @@ -106,7 +106,7 @@ public class ExplodedArchiveTests { } @Test - public void getEntries() throws Exception { + public void getEntries() { Map entries = getEntriesMap(this.archive); assertThat(entries.size()).isEqualTo(10); } @@ -141,7 +141,7 @@ public class ExplodedArchiveTests { } @Test - public void getNonRecursiveEntriesForRoot() throws Exception { + public void getNonRecursiveEntriesForRoot() { ExplodedArchive archive = new ExplodedArchive(new File("/"), false); Map entries = getEntriesMap(archive); assertThat(entries.size()).isGreaterThan(1); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/archive/JarFileArchiveTests.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/archive/JarFileArchiveTests.java index 14ebfffe6b..e54ec46b82 100755 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/archive/JarFileArchiveTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/archive/JarFileArchiveTests.java @@ -80,7 +80,7 @@ public class JarFileArchiveTests { } @Test - public void getEntries() throws Exception { + public void getEntries() { Map entries = getEntriesMap(this.archive); assertThat(entries.size()).isEqualTo(10); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/data/RandomAccessDataFileTests.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/data/RandomAccessDataFileTests.java index 17108a0377..9721391258 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/data/RandomAccessDataFileTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/data/RandomAccessDataFileTests.java @@ -94,28 +94,28 @@ public class RandomAccessDataFileTests { } @Test - public void fileNotNull() throws Exception { + public void fileNotNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("File must not be null"); new RandomAccessDataFile(null); } @Test - public void fileExists() throws Exception { + public void fileExists() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("File must exist"); new RandomAccessDataFile(new File("/does/not/exist")); } @Test - public void fileNotNullWithConcurrentReads() throws Exception { + public void fileNotNullWithConcurrentReads() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("File must not be null"); new RandomAccessDataFile(null, 1); } @Test - public void fileExistsWithConcurrentReads() throws Exception { + public void fileExistsWithConcurrentReads() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("File must exist"); new RandomAccessDataFile(new File("/does/not/exist"), 1); @@ -206,13 +206,13 @@ public class RandomAccessDataFileTests { } @Test - public void subsectionNegativeOffset() throws Exception { + public void subsectionNegativeOffset() { this.thrown.expect(IndexOutOfBoundsException.class); this.file.getSubsection(-1, 1); } @Test - public void subsectionNegativeLength() throws Exception { + public void subsectionNegativeLength() { this.thrown.expect(IndexOutOfBoundsException.class); this.file.getSubsection(0, -1); } @@ -225,14 +225,14 @@ public class RandomAccessDataFileTests { } @Test - public void subsectionTooBig() throws Exception { + public void subsectionTooBig() { this.file.getSubsection(0, 256); this.thrown.expect(IndexOutOfBoundsException.class); this.file.getSubsection(0, 257); } @Test - public void subsectionTooBigWithOffset() throws Exception { + public void subsectionTooBigWithOffset() { this.file.getSubsection(1, 255); this.thrown.expect(IndexOutOfBoundsException.class); this.file.getSubsection(1, 256); @@ -278,7 +278,7 @@ public class RandomAccessDataFileTests { } @Test - public void getFile() throws Exception { + public void getFile() { assertThat(this.file.getFile()).isEqualTo(this.tempFile); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/AsciiBytesTests.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/AsciiBytesTests.java index 231b36e6cd..947f988b8e 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/AsciiBytesTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/AsciiBytesTests.java @@ -34,25 +34,25 @@ public class AsciiBytesTests { public ExpectedException thrown = ExpectedException.none(); @Test - public void createFromBytes() throws Exception { + public void createFromBytes() { AsciiBytes bytes = new AsciiBytes(new byte[] { 65, 66 }); assertThat(bytes.toString()).isEqualTo("AB"); } @Test - public void createFromBytesWithOffset() throws Exception { + public void createFromBytesWithOffset() { AsciiBytes bytes = new AsciiBytes(new byte[] { 65, 66, 67, 68 }, 1, 2); assertThat(bytes.toString()).isEqualTo("BC"); } @Test - public void createFromString() throws Exception { + public void createFromString() { AsciiBytes bytes = new AsciiBytes("AB"); assertThat(bytes.toString()).isEqualTo("AB"); } @Test - public void length() throws Exception { + public void length() { AsciiBytes b1 = new AsciiBytes(new byte[] { 65, 66 }); AsciiBytes b2 = new AsciiBytes(new byte[] { 65, 66, 67, 68 }, 1, 2); assertThat(b1.length()).isEqualTo(2); @@ -60,7 +60,7 @@ public class AsciiBytesTests { } @Test - public void startWith() throws Exception { + public void startWith() { AsciiBytes abc = new AsciiBytes(new byte[] { 65, 66, 67 }); AsciiBytes ab = new AsciiBytes(new byte[] { 65, 66 }); AsciiBytes bc = new AsciiBytes(new byte[] { 65, 66, 67 }, 1, 2); @@ -72,7 +72,7 @@ public class AsciiBytesTests { } @Test - public void endsWith() throws Exception { + public void endsWith() { AsciiBytes abc = new AsciiBytes(new byte[] { 65, 66, 67 }); AsciiBytes bc = new AsciiBytes(new byte[] { 65, 66, 67 }, 1, 2); AsciiBytes ab = new AsciiBytes(new byte[] { 65, 66 }); @@ -84,7 +84,7 @@ public class AsciiBytesTests { } @Test - public void substringFromBeingIndex() throws Exception { + public void substringFromBeingIndex() { AsciiBytes abcd = new AsciiBytes(new byte[] { 65, 66, 67, 68 }); assertThat(abcd.substring(0).toString()).isEqualTo("ABCD"); assertThat(abcd.substring(1).toString()).isEqualTo("BCD"); @@ -96,7 +96,7 @@ public class AsciiBytesTests { } @Test - public void substring() throws Exception { + public void substring() { AsciiBytes abcd = new AsciiBytes(new byte[] { 65, 66, 67, 68 }); assertThat(abcd.substring(0, 4).toString()).isEqualTo("ABCD"); assertThat(abcd.substring(1, 3).toString()).isEqualTo("BC"); @@ -107,7 +107,7 @@ public class AsciiBytesTests { } @Test - public void appendString() throws Exception { + public void appendString() { AsciiBytes bc = new AsciiBytes(new byte[] { 65, 66, 67, 68 }, 1, 2); AsciiBytes appended = bc.append("D"); assertThat(bc.toString()).isEqualTo("BC"); @@ -115,7 +115,7 @@ public class AsciiBytesTests { } @Test - public void appendBytes() throws Exception { + public void appendBytes() { AsciiBytes bc = new AsciiBytes(new byte[] { 65, 66, 67, 68 }, 1, 2); AsciiBytes appended = bc.append(new byte[] { 68 }); assertThat(bc.toString()).isEqualTo("BC"); @@ -123,7 +123,7 @@ public class AsciiBytesTests { } @Test - public void hashCodeAndEquals() throws Exception { + public void hashCodeAndEquals() { AsciiBytes abcd = new AsciiBytes(new byte[] { 65, 66, 67, 68 }); AsciiBytes bc = new AsciiBytes(new byte[] { 66, 67 }); AsciiBytes bc_substring = new AsciiBytes(new byte[] { 65, 66, 67, 68 }) @@ -140,22 +140,22 @@ public class AsciiBytesTests { } @Test - public void hashCodeSameAsString() throws Exception { + public void hashCodeSameAsString() { hashCodeSameAsString("abcABC123xyz!"); } @Test - public void hashCodeSameAsStringWithSpecial() throws Exception { + public void hashCodeSameAsStringWithSpecial() { hashCodeSameAsString("special/\u00EB.dat"); } @Test - public void hashCodeSameAsStringWithCyrillicCharacters() throws Exception { + public void hashCodeSameAsStringWithCyrillicCharacters() { hashCodeSameAsString("\u0432\u0435\u0441\u043D\u0430"); } @Test - public void hashCodeSameAsStringWithEmoji() throws Exception { + public void hashCodeSameAsStringWithEmoji() { hashCodeSameAsString("\ud83d\udca9"); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/JarEntryNameTests.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/JarEntryNameTests.java index c62e8a2ba3..97ec03e2e0 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/JarEntryNameTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/JarEntryNameTests.java @@ -16,8 +16,6 @@ package org.springframework.boot.loader.jar; -import java.io.UnsupportedEncodingException; - import org.junit.Test; import org.springframework.boot.loader.jar.JarURLConnection.JarEntryName; @@ -49,8 +47,7 @@ public class JarEntryNameTests { } @Test - public void nameWithMixtureOfEncodedAndUnencodedDoubleByteCharacters() - throws UnsupportedEncodingException { + public void nameWithMixtureOfEncodedAndUnencodedDoubleByteCharacters() { assertThat(new JarEntryName("%c3%a1/b/\u00c7.class").toString()) .isEqualTo("\u00e1/b/\u00c7.class"); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/JarFileTests.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/JarFileTests.java index c4e5e79104..c8b6663c5d 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/JarFileTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/JarFileTests.java @@ -122,7 +122,7 @@ public class JarFileTests { } @Test - public void getEntries() throws Exception { + public void getEntries() { Enumeration entries = this.jarFile.entries(); assertThat(entries.nextElement().getName()).isEqualTo("META-INF/"); assertThat(entries.nextElement().getName()).isEqualTo("META-INF/MANIFEST.MF"); @@ -146,7 +146,7 @@ public class JarFileTests { } @Test - public void getJarEntry() throws Exception { + public void getJarEntry() { java.util.jar.JarEntry entry = this.jarFile.getJarEntry("1.dat"); assertThat(entry).isNotNull(); assertThat(entry.getName()).isEqualTo("1.dat"); @@ -163,12 +163,12 @@ public class JarFileTests { } @Test - public void getName() throws Exception { + public void getName() { assertThat(this.jarFile.getName()).isEqualTo(this.rootJarFile.getPath()); } @Test - public void getSize() throws Exception { + public void getSize() { assertThat(this.jarFile.size()).isEqualTo((int) this.rootJarFile.length()); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/DependencyFilterMojoTests.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/DependencyFilterMojoTests.java index d4c22962cf..c198ef87ee 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/DependencyFilterMojoTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/DependencyFilterMojoTests.java @@ -24,7 +24,6 @@ import java.util.Set; import org.apache.maven.artifact.Artifact; import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.shared.artifact.filter.collection.ArtifactsFilter; import org.apache.maven.shared.artifact.filter.collection.ScopeFilter; import org.junit.Test; @@ -153,7 +152,7 @@ public class DependencyFilterMojoTests { } @Override - public void execute() throws MojoExecutionException, MojoFailureException { + public void execute() { } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/context/AbstractConfigurationClassTests.java b/spring-boot-project/spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/context/AbstractConfigurationClassTests.java index 33da6644b6..c635ccb944 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/context/AbstractConfigurationClassTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/context/AbstractConfigurationClassTests.java @@ -47,7 +47,7 @@ public abstract class AbstractConfigurationClassTests { private ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); @Test - public void allBeanMethodsArePublic() throws IOException, ClassNotFoundException { + public void allBeanMethodsArePublic() throws IOException { Set nonPublicBeanMethods = new HashSet<>(); for (AnnotationMetadata configurationClass : findConfigurationClasses()) { Set beanMethods = configurationClass diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ApplicationPidTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ApplicationPidTests.java index 00cdc37ee5..a428d363df 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ApplicationPidTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ApplicationPidTests.java @@ -42,12 +42,12 @@ public class ApplicationPidTests { public TemporaryFolder temporaryFolder = new TemporaryFolder(); @Test - public void toStringWithPid() throws Exception { + public void toStringWithPid() { assertThat(new ApplicationPid("123").toString()).isEqualTo("123"); } @Test - public void toStringWithoutPid() throws Exception { + public void toStringWithoutPid() { assertThat(new ApplicationPid(null).toString()).isEqualTo("???"); } @@ -80,7 +80,7 @@ public class ApplicationPidTests { } @Test - public void getPidFromJvm() throws Exception { + public void getPidFromJvm() { assertThat(new ApplicationPid().toString()).isNotEmpty(); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ApplicationTempTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ApplicationTempTests.java index 423ea3dc8e..6dec17ff41 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ApplicationTempTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ApplicationTempTests.java @@ -30,7 +30,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class ApplicationTempTests { @Test - public void generatesConsistentTemp() throws Exception { + public void generatesConsistentTemp() { ApplicationTemp t1 = new ApplicationTemp(); ApplicationTemp t2 = new ApplicationTemp(); assertThat(t1.getDir()).isNotNull(); @@ -38,7 +38,7 @@ public class ApplicationTempTests { } @Test - public void differentBasedOnUserDir() throws Exception { + public void differentBasedOnUserDir() { String userDir = System.getProperty("user.dir"); try { File t1 = new ApplicationTemp().getDir(); @@ -52,7 +52,7 @@ public class ApplicationTempTests { } @Test - public void getSubDir() throws Exception { + public void getSubDir() { ApplicationTemp temp = new ApplicationTemp(); assertThat(temp.getDir("abc")).isEqualTo(new File(temp.getDir(), "abc")); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/BannerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/BannerTests.java index ba6545c210..bd57841894 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/BannerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/BannerTests.java @@ -70,7 +70,7 @@ public class BannerTests { } @Test - public void testDefaultBanner() throws Exception { + public void testDefaultBanner() { SpringApplication application = new SpringApplication(Config.class); application.setWebApplicationType(WebApplicationType.NONE); this.context = application.run(); @@ -78,7 +78,7 @@ public class BannerTests { } @Test - public void testDefaultBannerInLog() throws Exception { + public void testDefaultBannerInLog() { SpringApplication application = new SpringApplication(Config.class); application.setWebApplicationType(WebApplicationType.NONE); this.context = application.run(); @@ -86,7 +86,7 @@ public class BannerTests { } @Test - public void testCustomBanner() throws Exception { + public void testCustomBanner() { SpringApplication application = new SpringApplication(Config.class); application.setWebApplicationType(WebApplicationType.NONE); application.setBanner(new DummyBanner()); @@ -95,7 +95,7 @@ public class BannerTests { } @Test - public void testBannerInContext() throws Exception { + public void testBannerInContext() { SpringApplication application = new SpringApplication(Config.class); application.setWebApplicationType(WebApplicationType.NONE); this.context = application.run(); @@ -103,7 +103,7 @@ public class BannerTests { } @Test - public void testCustomBannerInContext() throws Exception { + public void testCustomBannerInContext() { SpringApplication application = new SpringApplication(Config.class); application.setWebApplicationType(WebApplicationType.NONE); Banner banner = mock(Banner.class); @@ -121,7 +121,7 @@ public class BannerTests { } @Test - public void testDisableBannerInContext() throws Exception { + public void testDisableBannerInContext() { SpringApplication application = new SpringApplication(Config.class); application.setBannerMode(Mode.OFF); application.setWebApplicationType(WebApplicationType.NONE); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/BeanDefinitionLoaderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/BeanDefinitionLoaderTests.java index 9b5314d487..189a706d0a 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/BeanDefinitionLoaderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/BeanDefinitionLoaderTests.java @@ -47,7 +47,7 @@ public class BeanDefinitionLoaderTests { } @Test - public void loadClass() throws Exception { + public void loadClass() { BeanDefinitionLoader loader = new BeanDefinitionLoader(this.registry, MyComponent.class); assertThat(loader.load()).isEqualTo(1); @@ -55,7 +55,7 @@ public class BeanDefinitionLoaderTests { } @Test - public void loadXmlResource() throws Exception { + public void loadXmlResource() { ClassPathResource resource = new ClassPathResource("sample-beans.xml", getClass()); BeanDefinitionLoader loader = new BeanDefinitionLoader(this.registry, resource); @@ -65,7 +65,7 @@ public class BeanDefinitionLoaderTests { } @Test - public void loadGroovyResource() throws Exception { + public void loadGroovyResource() { ClassPathResource resource = new ClassPathResource("sample-beans.groovy", getClass()); BeanDefinitionLoader loader = new BeanDefinitionLoader(this.registry, resource); @@ -75,7 +75,7 @@ public class BeanDefinitionLoaderTests { } @Test - public void loadGroovyResourceWithNamespace() throws Exception { + public void loadGroovyResourceWithNamespace() { ClassPathResource resource = new ClassPathResource("sample-namespace.groovy", getClass()); BeanDefinitionLoader loader = new BeanDefinitionLoader(this.registry, resource); @@ -85,7 +85,7 @@ public class BeanDefinitionLoaderTests { } @Test - public void loadPackage() throws Exception { + public void loadPackage() { BeanDefinitionLoader loader = new BeanDefinitionLoader(this.registry, MyComponent.class.getPackage()); assertThat(loader.load()).isEqualTo(1); @@ -93,7 +93,7 @@ public class BeanDefinitionLoaderTests { } @Test - public void loadClassName() throws Exception { + public void loadClassName() { BeanDefinitionLoader loader = new BeanDefinitionLoader(this.registry, MyComponent.class.getName()); assertThat(loader.load()).isEqualTo(1); @@ -101,7 +101,7 @@ public class BeanDefinitionLoaderTests { } @Test - public void loadResourceName() throws Exception { + public void loadResourceName() { BeanDefinitionLoader loader = new BeanDefinitionLoader(this.registry, "classpath:org/springframework/boot/sample-beans.xml"); assertThat(loader.load()).isEqualTo(1); @@ -109,7 +109,7 @@ public class BeanDefinitionLoaderTests { } @Test - public void loadGroovyName() throws Exception { + public void loadGroovyName() { BeanDefinitionLoader loader = new BeanDefinitionLoader(this.registry, "classpath:org/springframework/boot/sample-beans.groovy"); assertThat(loader.load()).isEqualTo(1); @@ -117,7 +117,7 @@ public class BeanDefinitionLoaderTests { } @Test - public void loadPackageName() throws Exception { + public void loadPackageName() { BeanDefinitionLoader loader = new BeanDefinitionLoader(this.registry, MyComponent.class.getPackage().getName()); assertThat(loader.load()).isEqualTo(1); @@ -125,7 +125,7 @@ public class BeanDefinitionLoaderTests { } @Test - public void loadPackageNameWithoutDot() throws Exception { + public void loadPackageNameWithoutDot() { // See gh-6126 BeanDefinitionLoader loader = new BeanDefinitionLoader(this.registry, MyComponentInPackageWithoutDot.class.getPackage().getName()); @@ -135,7 +135,7 @@ public class BeanDefinitionLoaderTests { } @Test - public void loadPackageAndClassDoesNotDoubleAdd() throws Exception { + public void loadPackageAndClassDoesNotDoubleAdd() { BeanDefinitionLoader loader = new BeanDefinitionLoader(this.registry, MyComponent.class.getPackage(), MyComponent.class); assertThat(loader.load()).isEqualTo(1); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/DefaultApplicationArgumentsTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/DefaultApplicationArgumentsTests.java index 79dfe1a82e..0920e59c0d 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/DefaultApplicationArgumentsTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/DefaultApplicationArgumentsTests.java @@ -40,27 +40,27 @@ public class DefaultApplicationArgumentsTests { public ExpectedException thrown = ExpectedException.none(); @Test - public void argumentsMustNotBeNull() throws Exception { + public void argumentsMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Args must not be null"); new DefaultApplicationArguments(null); } @Test - public void getArgs() throws Exception { + public void getArgs() { ApplicationArguments arguments = new DefaultApplicationArguments(ARGS); assertThat(arguments.getSourceArgs()).isEqualTo(ARGS); } @Test - public void optionNames() throws Exception { + public void optionNames() { ApplicationArguments arguments = new DefaultApplicationArguments(ARGS); Set expected = new HashSet<>(Arrays.asList("foo", "debug")); assertThat(arguments.getOptionNames()).isEqualTo(expected); } @Test - public void containsOption() throws Exception { + public void containsOption() { ApplicationArguments arguments = new DefaultApplicationArguments(ARGS); assertThat(arguments.containsOption("foo")).isTrue(); assertThat(arguments.containsOption("debug")).isTrue(); @@ -68,7 +68,7 @@ public class DefaultApplicationArgumentsTests { } @Test - public void getOptionValues() throws Exception { + public void getOptionValues() { ApplicationArguments arguments = new DefaultApplicationArguments(ARGS); assertThat(arguments.getOptionValues("foo")) .isEqualTo(Arrays.asList("bar", "baz")); @@ -77,13 +77,13 @@ public class DefaultApplicationArgumentsTests { } @Test - public void getNonOptionArgs() throws Exception { + public void getNonOptionArgs() { ApplicationArguments arguments = new DefaultApplicationArguments(ARGS); assertThat(arguments.getNonOptionArgs()).containsExactly("spring", "boot"); } @Test - public void getNoNonOptionArgs() throws Exception { + public void getNoNonOptionArgs() { ApplicationArguments arguments = new DefaultApplicationArguments( new String[] { "--debug" }); assertThat(arguments.getNonOptionArgs()).isEmpty(); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ExitCodeGeneratorsTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ExitCodeGeneratorsTests.java index 3d3ee68109..fb06d0b7ef 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ExitCodeGeneratorsTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ExitCodeGeneratorsTests.java @@ -38,7 +38,7 @@ public class ExitCodeGeneratorsTests { public ExpectedException thrown = ExpectedException.none(); @Test - public void addAllWhenGeneratorsIsNullShouldThrowException() throws Exception { + public void addAllWhenGeneratorsIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Generators must not be null"); List generators = null; @@ -46,19 +46,19 @@ public class ExitCodeGeneratorsTests { } @Test - public void addWhenGeneratorIsNullShouldThrowException() throws Exception { + public void addWhenGeneratorIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Generator must not be null"); new ExitCodeGenerators().add(null); } @Test - public void getExitCodeWhenNoGeneratorsShouldReturnZero() throws Exception { + public void getExitCodeWhenNoGeneratorsShouldReturnZero() { assertThat(new ExitCodeGenerators().getExitCode()).isEqualTo(0); } @Test - public void getExitCodeWhenGeneratorThrowsShouldReturnOne() throws Exception { + public void getExitCodeWhenGeneratorThrowsShouldReturnOne() { ExitCodeGenerator generator = mock(ExitCodeGenerator.class); given(generator.getExitCode()).willThrow(new IllegalStateException()); ExitCodeGenerators generators = new ExitCodeGenerators(); @@ -67,7 +67,7 @@ public class ExitCodeGeneratorsTests { } @Test - public void getExitCodeWhenAllNegativeShouldReturnLowestValue() throws Exception { + public void getExitCodeWhenAllNegativeShouldReturnLowestValue() { ExitCodeGenerators generators = new ExitCodeGenerators(); generators.add(mockGenerator(-1)); generators.add(mockGenerator(-3)); @@ -76,7 +76,7 @@ public class ExitCodeGeneratorsTests { } @Test - public void getExitCodeWhenAllPositiveShouldReturnHighestValue() throws Exception { + public void getExitCodeWhenAllPositiveShouldReturnHighestValue() { ExitCodeGenerators generators = new ExitCodeGenerators(); generators.add(mockGenerator(1)); generators.add(mockGenerator(3)); @@ -85,8 +85,7 @@ public class ExitCodeGeneratorsTests { } @Test - public void getExitCodeWhenUsingExitCodeExceptionMapperShouldCallMapper() - throws Exception { + public void getExitCodeWhenUsingExitCodeExceptionMapperShouldCallMapper() { ExitCodeGenerators generators = new ExitCodeGenerators(); Exception e = new IOException(); generators.add(e, mockMapper(IllegalStateException.class, 1)); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ImageBannerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ImageBannerTests.java index 3012c0ee29..820539904d 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ImageBannerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ImageBannerTests.java @@ -117,7 +117,7 @@ public class ImageBannerTests { } @Test - public void printBannerShouldRenderGradient() throws Exception { + public void printBannerShouldRenderGradient() { AnsiOutput.setEnabled(AnsiOutput.Enabled.NEVER); String banner = printBanner("gradient.gif", "banner.image.width=10", "banner.image.margin=0"); @@ -125,20 +125,20 @@ public class ImageBannerTests { } @Test - public void printBannerShouldCalculateHeight() throws Exception { + public void printBannerShouldCalculateHeight() { String banner = printBanner("large.gif", "banner.image.width=20"); assertThat(getBannerHeight(banner)).isEqualTo(10); } @Test - public void printBannerWhenHasHeightPropertyShouldSetHeight() throws Exception { + public void printBannerWhenHasHeightPropertyShouldSetHeight() { String banner = printBanner("large.gif", "banner.image.width=20", "banner.image.height=30"); assertThat(getBannerHeight(banner)).isEqualTo(30); } @Test - public void printBannerShouldCapWidthAndCalculateHeight() throws Exception { + public void printBannerShouldCapWidthAndCalculateHeight() { AnsiOutput.setEnabled(AnsiOutput.Enabled.NEVER); String banner = printBanner("large.gif", "banner.image.margin=0"); assertThat(getBannerWidth(banner)).isEqualTo(76); @@ -146,7 +146,7 @@ public class ImageBannerTests { } @Test - public void printBannerShouldPrintMargin() throws Exception { + public void printBannerShouldPrintMargin() { AnsiOutput.setEnabled(AnsiOutput.Enabled.NEVER); String banner = printBanner("large.gif"); String[] lines = banner.split(NEW_LINE); @@ -156,8 +156,7 @@ public class ImageBannerTests { } @Test - public void printBannerWhenHasMarginPropertyShouldPrintSizedMargin() - throws Exception { + public void printBannerWhenHasMarginPropertyShouldPrintSizedMargin() { AnsiOutput.setEnabled(AnsiOutput.Enabled.NEVER); String banner = printBanner("large.gif", "banner.image.margin=4"); String[] lines = banner.split(NEW_LINE); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ReproTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ReproTests.java index 10367ba37a..9daa1675ba 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ReproTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ReproTests.java @@ -42,7 +42,7 @@ public class ReproTests { } @Test - public void enableProfileViaApplicationProperties() throws Exception { + public void enableProfileViaApplicationProperties() { // gh-308 SpringApplication application = new SpringApplication(Config.class); @@ -55,7 +55,7 @@ public class ReproTests { } @Test - public void activeProfilesWithYamlAndCommandLine() throws Exception { + public void activeProfilesWithYamlAndCommandLine() { // gh-322, gh-342 SpringApplication application = new SpringApplication(Config.class); application.setWebApplicationType(WebApplicationType.NONE); @@ -65,7 +65,7 @@ public class ReproTests { } @Test - public void activeProfilesWithYamlOnly() throws Exception { + public void activeProfilesWithYamlOnly() { // gh-322, gh-342 SpringApplication application = new SpringApplication(Config.class); application.setWebApplicationType(WebApplicationType.NONE); @@ -75,7 +75,7 @@ public class ReproTests { } @Test - public void orderActiveProfilesWithYamlOnly() throws Exception { + public void orderActiveProfilesWithYamlOnly() { // gh-322, gh-342 SpringApplication application = new SpringApplication(Config.class); application.setWebApplicationType(WebApplicationType.NONE); @@ -85,7 +85,7 @@ public class ReproTests { } @Test - public void commandLineBeatsProfilesWithYaml() throws Exception { + public void commandLineBeatsProfilesWithYaml() { // gh-322, gh-342 SpringApplication application = new SpringApplication(Config.class); application.setWebApplicationType(WebApplicationType.NONE); @@ -95,7 +95,7 @@ public class ReproTests { } @Test - public void orderProfilesWithYaml() throws Exception { + public void orderProfilesWithYaml() { // gh-322, gh-342 SpringApplication application = new SpringApplication(Config.class); application.setWebApplicationType(WebApplicationType.NONE); @@ -105,7 +105,7 @@ public class ReproTests { } @Test - public void reverseOrderOfProfilesWithYaml() throws Exception { + public void reverseOrderOfProfilesWithYaml() { // gh-322, gh-342 SpringApplication application = new SpringApplication(Config.class); application.setWebApplicationType(WebApplicationType.NONE); @@ -115,7 +115,7 @@ public class ReproTests { } @Test - public void activeProfilesWithYamlAndCommandLineAndNoOverride() throws Exception { + public void activeProfilesWithYamlAndCommandLineAndNoOverride() { // gh-322, gh-342 SpringApplication application = new SpringApplication(Config.class); application.setWebApplicationType(WebApplicationType.NONE); @@ -125,7 +125,7 @@ public class ReproTests { } @Test - public void activeProfilesWithYamlOnlyAndNoOverride() throws Exception { + public void activeProfilesWithYamlOnlyAndNoOverride() { // gh-322, gh-342 SpringApplication application = new SpringApplication(Config.class); application.setWebApplicationType(WebApplicationType.NONE); @@ -135,7 +135,7 @@ public class ReproTests { } @Test - public void commandLineBeatsProfilesWithYamlAndNoOverride() throws Exception { + public void commandLineBeatsProfilesWithYamlAndNoOverride() { // gh-322, gh-342 SpringApplication application = new SpringApplication(Config.class); application.setWebApplicationType(WebApplicationType.NONE); @@ -145,7 +145,7 @@ public class ReproTests { } @Test - public void orderProfilesWithYamlAndNoOverride() throws Exception { + public void orderProfilesWithYamlAndNoOverride() { // gh-322, gh-342 SpringApplication application = new SpringApplication(Config.class); application.setWebApplicationType(WebApplicationType.NONE); @@ -155,7 +155,7 @@ public class ReproTests { } @Test - public void reverseOrderOfProfilesWithYamlAndNoOverride() throws Exception { + public void reverseOrderOfProfilesWithYamlAndNoOverride() { // gh-322, gh-342 SpringApplication application = new SpringApplication(Config.class); application.setWebApplicationType(WebApplicationType.NONE); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ResourceBannerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ResourceBannerTests.java index 68501ddf08..15ba56d487 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ResourceBannerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ResourceBannerTests.java @@ -48,7 +48,7 @@ public class ResourceBannerTests { } @Test - public void renderVersions() throws Exception { + public void renderVersions() { Resource resource = new ByteArrayResource( "banner ${a} ${spring-boot.version} ${application.version}".getBytes()); String banner = printBanner(resource, "10.2", "2.0", null); @@ -56,7 +56,7 @@ public class ResourceBannerTests { } @Test - public void renderWithoutVersions() throws Exception { + public void renderWithoutVersions() { Resource resource = new ByteArrayResource( "banner ${a} ${spring-boot.version} ${application.version}".getBytes()); String banner = printBanner(resource, null, null, null); @@ -64,7 +64,7 @@ public class ResourceBannerTests { } @Test - public void renderFormattedVersions() throws Exception { + public void renderFormattedVersions() { Resource resource = new ByteArrayResource( "banner ${a}${spring-boot.formatted-version}${application.formatted-version}" .getBytes()); @@ -73,7 +73,7 @@ public class ResourceBannerTests { } @Test - public void renderWithoutFormattedVersions() throws Exception { + public void renderWithoutFormattedVersions() { Resource resource = new ByteArrayResource( "banner ${a}${spring-boot.formatted-version}${application.formatted-version}" .getBytes()); @@ -82,7 +82,7 @@ public class ResourceBannerTests { } @Test - public void renderWithColors() throws Exception { + public void renderWithColors() { Resource resource = new ByteArrayResource( "${Ansi.RED}This is red.${Ansi.NORMAL}".getBytes()); AnsiOutput.setEnabled(AnsiOutput.Enabled.ALWAYS); @@ -91,7 +91,7 @@ public class ResourceBannerTests { } @Test - public void renderWithColorsButDisabled() throws Exception { + public void renderWithColorsButDisabled() { Resource resource = new ByteArrayResource( "${Ansi.RED}This is red.${Ansi.NORMAL}".getBytes()); AnsiOutput.setEnabled(AnsiOutput.Enabled.NEVER); @@ -100,7 +100,7 @@ public class ResourceBannerTests { } @Test - public void renderWithTitle() throws Exception { + public void renderWithTitle() { Resource resource = new ByteArrayResource( "banner ${application.title} ${a}".getBytes()); String banner = printBanner(resource, null, null, "title"); @@ -108,7 +108,7 @@ public class ResourceBannerTests { } @Test - public void renderWithoutTitle() throws Exception { + public void renderWithoutTitle() { Resource resource = new ByteArrayResource( "banner ${application.title} ${a}".getBytes()); String banner = printBanner(resource, null, null, null); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java index 37a0c96d71..1ede3d5a84 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java @@ -164,28 +164,28 @@ public class SpringApplicationTests { } @Test - public void sourcesMustNotBeNull() throws Exception { + public void sourcesMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("PrimarySources must not be null"); new SpringApplication((Class[]) null).run(); } @Test - public void sourcesMustNotBeEmpty() throws Exception { + public void sourcesMustNotBeEmpty() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Sources must not be empty"); new SpringApplication().run(); } @Test - public void sourcesMustBeAccessible() throws Exception { + public void sourcesMustBeAccessible() { this.thrown.expect(IllegalStateException.class); this.thrown.expectMessage("Cannot load configuration"); new SpringApplication(InaccessibleConfiguration.class).run(); } @Test - public void customBanner() throws Exception { + public void customBanner() { SpringApplication application = spy(new SpringApplication(ExampleConfig.class)); application.setWebApplicationType(WebApplicationType.NONE); this.context = application.run("--banner.location=classpath:test-banner.txt"); @@ -193,7 +193,7 @@ public class SpringApplicationTests { } @Test - public void customBannerWithProperties() throws Exception { + public void customBannerWithProperties() { SpringApplication application = spy(new SpringApplication(ExampleConfig.class)); application.setWebApplicationType(WebApplicationType.NONE); this.context = application.run( @@ -203,7 +203,7 @@ public class SpringApplicationTests { } @Test - public void imageBannerAndTextBanner() throws Exception { + public void imageBannerAndTextBanner() { SpringApplication application = new SpringApplication(ExampleConfig.class); MockResourceLoader resourceLoader = new MockResourceLoader(); resourceLoader.addResource("banner.gif", "black-and-white.gif"); @@ -215,7 +215,7 @@ public class SpringApplicationTests { } @Test - public void imageBannerLoads() throws Exception { + public void imageBannerLoads() { SpringApplication application = new SpringApplication(ExampleConfig.class); MockResourceLoader resourceLoader = new MockResourceLoader(); resourceLoader.addResource("banner.gif", "black-and-white.gif"); @@ -226,7 +226,7 @@ public class SpringApplicationTests { } @Test - public void logsNoActiveProfiles() throws Exception { + public void logsNoActiveProfiles() { SpringApplication application = new SpringApplication(ExampleConfig.class); application.setWebApplicationType(WebApplicationType.NONE); this.context = application.run(); @@ -235,7 +235,7 @@ public class SpringApplicationTests { } @Test - public void logsActiveProfiles() throws Exception { + public void logsActiveProfiles() { SpringApplication application = new SpringApplication(ExampleConfig.class); application.setWebApplicationType(WebApplicationType.NONE); this.context = application.run("--spring.profiles.active=myprofiles"); @@ -244,7 +244,7 @@ public class SpringApplicationTests { } @Test - public void enableBannerInLogViaProperty() throws Exception { + public void enableBannerInLogViaProperty() { SpringApplication application = spy(new SpringApplication(ExampleConfig.class)); application.setWebApplicationType(WebApplicationType.NONE); this.context = application.run("--spring.main.banner-mode=log"); @@ -253,7 +253,7 @@ public class SpringApplicationTests { } @Test - public void setIgnoreBeanInfoPropertyByDefault() throws Exception { + public void setIgnoreBeanInfoPropertyByDefault() { SpringApplication application = new SpringApplication(ExampleConfig.class); application.setWebApplicationType(WebApplicationType.NONE); this.context = application.run(); @@ -263,7 +263,7 @@ public class SpringApplicationTests { } @Test - public void disableIgnoreBeanInfoProperty() throws Exception { + public void disableIgnoreBeanInfoProperty() { System.setProperty(CachedIntrospectionResults.IGNORE_BEANINFO_PROPERTY_NAME, "false"); SpringApplication application = new SpringApplication(ExampleConfig.class); @@ -296,7 +296,7 @@ public class SpringApplicationTests { } @Test - public void customId() throws Exception { + public void customId() { SpringApplication application = new SpringApplication(ExampleConfig.class); application.setWebApplicationType(WebApplicationType.NONE); this.context = application.run("--spring.application.name=foo"); @@ -304,7 +304,7 @@ public class SpringApplicationTests { } @Test - public void specificApplicationContextClass() throws Exception { + public void specificApplicationContextClass() { SpringApplication application = new SpringApplication(ExampleConfig.class); application.setApplicationContextClass(StaticApplicationContext.class); this.context = application.run(); @@ -312,7 +312,7 @@ public class SpringApplicationTests { } @Test - public void specificApplicationContextInitializer() throws Exception { + public void specificApplicationContextInitializer() { SpringApplication application = new SpringApplication(ExampleConfig.class); application.setWebApplicationType(WebApplicationType.NONE); final AtomicReference reference = new AtomicReference<>(); @@ -344,7 +344,7 @@ public class SpringApplicationTests { } @Test - public void contextRefreshedEventListener() throws Exception { + public void contextRefreshedEventListener() { SpringApplication application = new SpringApplication(ExampleConfig.class); application.setWebApplicationType(WebApplicationType.NONE); final AtomicReference reference = new AtomicReference<>(); @@ -388,7 +388,7 @@ public class SpringApplicationTests { } @Test - public void defaultApplicationContext() throws Exception { + public void defaultApplicationContext() { SpringApplication application = new SpringApplication(ExampleConfig.class); application.setWebApplicationType(WebApplicationType.NONE); this.context = application.run(); @@ -396,7 +396,7 @@ public class SpringApplicationTests { } @Test - public void defaultApplicationContextForWeb() throws Exception { + public void defaultApplicationContextForWeb() { SpringApplication application = new SpringApplication(ExampleWebConfig.class); application.setWebApplicationType(WebApplicationType.SERVLET); this.context = application.run(); @@ -415,7 +415,7 @@ public class SpringApplicationTests { } @Test - public void customEnvironment() throws Exception { + public void customEnvironment() { TestSpringApplication application = new TestSpringApplication( ExampleConfig.class); application.setWebApplicationType(WebApplicationType.NONE); @@ -426,7 +426,7 @@ public class SpringApplicationTests { } @Test - public void customResourceLoader() throws Exception { + public void customResourceLoader() { TestSpringApplication application = new TestSpringApplication( ExampleConfig.class); application.setWebApplicationType(WebApplicationType.NONE); @@ -437,7 +437,7 @@ public class SpringApplicationTests { } @Test - public void customResourceLoaderFromConstructor() throws Exception { + public void customResourceLoaderFromConstructor() { ResourceLoader resourceLoader = new DefaultResourceLoader(); TestSpringApplication application = new TestSpringApplication(resourceLoader, ExampleWebConfig.class); @@ -446,7 +446,7 @@ public class SpringApplicationTests { } @Test - public void customBeanNameGenerator() throws Exception { + public void customBeanNameGenerator() { TestSpringApplication application = new TestSpringApplication( ExampleWebConfig.class); BeanNameGenerator beanNameGenerator = new DefaultBeanNameGenerator(); @@ -459,7 +459,7 @@ public class SpringApplicationTests { } @Test - public void customBeanNameGeneratorWithNonWebApplication() throws Exception { + public void customBeanNameGeneratorWithNonWebApplication() { TestSpringApplication application = new TestSpringApplication( ExampleWebConfig.class); application.setWebApplicationType(WebApplicationType.NONE); @@ -473,7 +473,7 @@ public class SpringApplicationTests { } @Test - public void commandLinePropertySource() throws Exception { + public void commandLinePropertySource() { SpringApplication application = new SpringApplication(ExampleConfig.class); application.setWebApplicationType(WebApplicationType.NONE); ConfigurableEnvironment environment = new StandardEnvironment(); @@ -484,7 +484,7 @@ public class SpringApplicationTests { } @Test - public void commandLinePropertySourceEnhancesEnvironment() throws Exception { + public void commandLinePropertySourceEnhancesEnvironment() { SpringApplication application = new SpringApplication(ExampleConfig.class); application.setWebApplicationType(WebApplicationType.NONE); ConfigurableEnvironment environment = new StandardEnvironment(); @@ -509,7 +509,7 @@ public class SpringApplicationTests { } @Test - public void propertiesFileEnhancesEnvironment() throws Exception { + public void propertiesFileEnhancesEnvironment() { SpringApplication application = new SpringApplication(ExampleConfig.class); application.setWebApplicationType(WebApplicationType.NONE); ConfigurableEnvironment environment = new StandardEnvironment(); @@ -519,7 +519,7 @@ public class SpringApplicationTests { } @Test - public void addProfiles() throws Exception { + public void addProfiles() { SpringApplication application = new SpringApplication(ExampleConfig.class); application.setWebApplicationType(WebApplicationType.NONE); application.setAdditionalProfiles("foo"); @@ -530,7 +530,7 @@ public class SpringApplicationTests { } @Test - public void addProfilesOrder() throws Exception { + public void addProfilesOrder() { SpringApplication application = new SpringApplication(ExampleConfig.class); application.setWebApplicationType(WebApplicationType.NONE); application.setAdditionalProfiles("foo"); @@ -542,7 +542,7 @@ public class SpringApplicationTests { } @Test - public void addProfilesOrderWithProperties() throws Exception { + public void addProfilesOrderWithProperties() { SpringApplication application = new SpringApplication(ExampleConfig.class); application.setWebApplicationType(WebApplicationType.NONE); application.setAdditionalProfiles("other"); @@ -555,7 +555,7 @@ public class SpringApplicationTests { } @Test - public void emptyCommandLinePropertySourceNotAdded() throws Exception { + public void emptyCommandLinePropertySourceNotAdded() { SpringApplication application = new SpringApplication(ExampleConfig.class); application.setWebApplicationType(WebApplicationType.NONE); ConfigurableEnvironment environment = new StandardEnvironment(); @@ -565,7 +565,7 @@ public class SpringApplicationTests { } @Test - public void disableCommandLinePropertySource() throws Exception { + public void disableCommandLinePropertySource() { SpringApplication application = new SpringApplication(ExampleConfig.class); application.setWebApplicationType(WebApplicationType.NONE); application.setAddCommandLineProperties(false); @@ -577,7 +577,7 @@ public class SpringApplicationTests { } @Test - public void runCommandLineRunnersAndApplicationRunners() throws Exception { + public void runCommandLineRunnersAndApplicationRunners() { SpringApplication application = new SpringApplication(CommandLineRunConfig.class); application.setWebApplicationType(WebApplicationType.NONE); this.context = application.run("arg"); @@ -614,7 +614,7 @@ public class SpringApplicationTests { } @Test - public void loadSources() throws Exception { + public void loadSources() { Class[] sources = { ExampleConfig.class, TestCommandLineRunner.class }; TestSpringApplication application = new TestSpringApplication(sources); application.getSources().add("a"); @@ -636,20 +636,20 @@ public class SpringApplicationTests { } @Test - public void run() throws Exception { + public void run() { this.context = SpringApplication.run(ExampleWebConfig.class); assertThat(this.context).isNotNull(); } @Test - public void runComponents() throws Exception { + public void runComponents() { this.context = SpringApplication.run( new Class[] { ExampleWebConfig.class, Object.class }, new String[0]); assertThat(this.context).isNotNull(); } @Test - public void exit() throws Exception { + public void exit() { SpringApplication application = new SpringApplication(ExampleConfig.class); application.setWebApplicationType(WebApplicationType.NONE); this.context = application.run(); @@ -658,7 +658,7 @@ public class SpringApplicationTests { } @Test - public void exitWithExplicitCode() throws Exception { + public void exitWithExplicitCode() { SpringApplication application = new SpringApplication(ExampleConfig.class); ExitCodeListener listener = new ExitCodeListener(); application.addListeners(listener); @@ -671,7 +671,7 @@ public class SpringApplicationTests { } @Test - public void exitWithExplicitCodeFromException() throws Exception { + public void exitWithExplicitCodeFromException() { final SpringBootExceptionHandler handler = mock(SpringBootExceptionHandler.class); SpringApplication application = new SpringApplication( ExitCodeCommandLineRunConfig.class) { @@ -696,7 +696,7 @@ public class SpringApplicationTests { } @Test - public void exitWithExplicitCodeFromMappedException() throws Exception { + public void exitWithExplicitCodeFromMappedException() { final SpringBootExceptionHandler handler = mock(SpringBootExceptionHandler.class); SpringApplication application = new SpringApplication( MappedExitCodeCommandLineRunConfig.class) { @@ -721,7 +721,7 @@ public class SpringApplicationTests { } @Test - public void exceptionFromRefreshIsHandledGracefully() throws Exception { + public void exceptionFromRefreshIsHandledGracefully() { final SpringBootExceptionHandler handler = mock(SpringBootExceptionHandler.class); SpringApplication application = new SpringApplication( RefreshFailureConfig.class) { @@ -750,7 +750,7 @@ public class SpringApplicationTests { } @Test - public void defaultCommandLineArgs() throws Exception { + public void defaultCommandLineArgs() { SpringApplication application = new SpringApplication(ExampleConfig.class); application.setDefaultProperties(StringUtils.splitArrayElementsIntoProperties( new String[] { "baz=", "bar=spam" }, "=")); @@ -762,7 +762,7 @@ public class SpringApplicationTests { } @Test - public void commandLineArgsApplyToSpringApplication() throws Exception { + public void commandLineArgsApplyToSpringApplication() { TestSpringApplication application = new TestSpringApplication( ExampleConfig.class); application.setWebApplicationType(WebApplicationType.NONE); @@ -771,7 +771,7 @@ public class SpringApplicationTests { } @Test - public void registerShutdownHook() throws Exception { + public void registerShutdownHook() { SpringApplication application = new SpringApplication(ExampleConfig.class); application.setApplicationContextClass(SpyApplicationContext.class); this.context = application.run(); @@ -780,7 +780,7 @@ public class SpringApplicationTests { } @Test - public void registerListener() throws Exception { + public void registerListener() { SpringApplication application = new SpringApplication(ExampleConfig.class, ListenerConfig.class); application.setApplicationContextClass(SpyApplicationContext.class); @@ -793,7 +793,7 @@ public class SpringApplicationTests { } @Test - public void registerListenerWithCustomMulticaster() throws Exception { + public void registerListenerWithCustomMulticaster() { SpringApplication application = new SpringApplication(ExampleConfig.class, ListenerConfig.class, Multicaster.class); application.setApplicationContextClass(SpyApplicationContext.class); @@ -894,7 +894,7 @@ public class SpringApplicationTests { } @Test - public void registerShutdownHookOff() throws Exception { + public void registerShutdownHookOff() { SpringApplication application = new SpringApplication(ExampleConfig.class); application.setApplicationContextClass(SpyApplicationContext.class); application.setRegisterShutdownHook(false); @@ -905,7 +905,7 @@ public class SpringApplicationTests { } @Test - public void headless() throws Exception { + public void headless() { TestSpringApplication application = new TestSpringApplication( ExampleConfig.class); application.setWebApplicationType(WebApplicationType.NONE); @@ -914,7 +914,7 @@ public class SpringApplicationTests { } @Test - public void headlessFalse() throws Exception { + public void headlessFalse() { TestSpringApplication application = new TestSpringApplication( ExampleConfig.class); application.setWebApplicationType(WebApplicationType.NONE); @@ -924,7 +924,7 @@ public class SpringApplicationTests { } @Test - public void headlessSystemPropertyTakesPrecedence() throws Exception { + public void headlessSystemPropertyTakesPrecedence() { System.setProperty("java.awt.headless", "false"); TestSpringApplication application = new TestSpringApplication( ExampleConfig.class); @@ -934,7 +934,7 @@ public class SpringApplicationTests { } @Test - public void getApplicationArgumentsBean() throws Exception { + public void getApplicationArgumentsBean() { TestSpringApplication application = new TestSpringApplication( ExampleConfig.class); application.setWebApplicationType(WebApplicationType.NONE); @@ -945,7 +945,7 @@ public class SpringApplicationTests { } @Test - public void webApplicationSwitchedOffInListener() throws Exception { + public void webApplicationSwitchedOffInListener() { TestSpringApplication application = new TestSpringApplication( ExampleConfig.class); application.addListeners( diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/admin/SpringApplicationAdminMXBeanRegistrarTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/admin/SpringApplicationAdminMXBeanRegistrarTests.java index 34f85679bf..26e18ce1b0 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/admin/SpringApplicationAdminMXBeanRegistrarTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/admin/SpringApplicationAdminMXBeanRegistrarTests.java @@ -59,7 +59,7 @@ public class SpringApplicationAdminMXBeanRegistrarTests { private ConfigurableApplicationContext context; @Before - public void setup() throws MalformedObjectNameException { + public void setup() { this.mBeanServer = ManagementFactory.getPlatformMBeanServer(); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ansi/AnsiColorsTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ansi/AnsiColorsTests.java index 89522635d6..3f3330fdaa 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ansi/AnsiColorsTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ansi/AnsiColorsTests.java @@ -30,7 +30,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class AnsiColorsTests { @Test - public void getClosestWhenExactMatchShouldReturnAnsiColor() throws Exception { + public void getClosestWhenExactMatchShouldReturnAnsiColor() { assertThat(getClosest(0x000000)).isEqualTo(AnsiColor.BLACK); assertThat(getClosest(0xAA0000)).isEqualTo(AnsiColor.RED); assertThat(getClosest(0x00AA00)).isEqualTo(AnsiColor.GREEN); @@ -50,7 +50,7 @@ public class AnsiColorsTests { } @Test - public void getClosestWhenCloseShouldReturnAnsiColor() throws Exception { + public void getClosestWhenCloseShouldReturnAnsiColor() { assertThat(getClosest(0x292424)).isEqualTo(AnsiColor.BLACK); assertThat(getClosest(0x8C1919)).isEqualTo(AnsiColor.RED); assertThat(getClosest(0x0BA10B)).isEqualTo(AnsiColor.GREEN); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ansi/AnsiOutputTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ansi/AnsiOutputTests.java index fe877130e7..3fd85f9c96 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ansi/AnsiOutputTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ansi/AnsiOutputTests.java @@ -42,7 +42,7 @@ public class AnsiOutputTests { } @Test - public void encoding() throws Exception { + public void encoding() { String encoded = AnsiOutput.toString("A", AnsiColor.RED, AnsiStyle.BOLD, "B", AnsiStyle.NORMAL, "D", AnsiColor.GREEN, "E", AnsiStyle.FAINT, "F"); assertThat(encoded).isEqualTo("ABDEF"); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ansi/AnsiPropertySourceTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ansi/AnsiPropertySourceTests.java index 377d469f36..405e19a38a 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ansi/AnsiPropertySourceTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ansi/AnsiPropertySourceTests.java @@ -38,42 +38,42 @@ public class AnsiPropertySourceTests { } @Test - public void getAnsiStyle() throws Exception { + public void getAnsiStyle() { assertThat(this.source.getProperty("AnsiStyle.BOLD")).isEqualTo(AnsiStyle.BOLD); } @Test - public void getAnsiColor() throws Exception { + public void getAnsiColor() { assertThat(this.source.getProperty("AnsiColor.RED")).isEqualTo(AnsiColor.RED); } @Test - public void getAnsiBackground() throws Exception { + public void getAnsiBackground() { assertThat(this.source.getProperty("AnsiBackground.GREEN")) .isEqualTo(AnsiBackground.GREEN); } @Test - public void getAnsi() throws Exception { + public void getAnsi() { assertThat(this.source.getProperty("Ansi.BOLD")).isEqualTo(AnsiStyle.BOLD); assertThat(this.source.getProperty("Ansi.RED")).isEqualTo(AnsiColor.RED); assertThat(this.source.getProperty("Ansi.BG_RED")).isEqualTo(AnsiBackground.RED); } @Test - public void getMissing() throws Exception { + public void getMissing() { assertThat(this.source.getProperty("AnsiStyle.NOPE")).isNull(); } @Test - public void encodeEnabled() throws Exception { + public void encodeEnabled() { AnsiOutput.setEnabled(Enabled.ALWAYS); AnsiPropertySource source = new AnsiPropertySource("ansi", true); assertThat(source.getProperty("Ansi.RED")).isEqualTo("\033[31m"); } @Test - public void encodeDisabled() throws Exception { + public void encodeDisabled() { AnsiOutput.setEnabled(Enabled.NEVER); AnsiPropertySource source = new AnsiPropertySource("ansi", true); assertThat(source.getProperty("Ansi.RED")).isEqualTo(""); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/builder/SpringApplicationBuilderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/builder/SpringApplicationBuilderTests.java index bd952e6025..69857218fc 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/builder/SpringApplicationBuilderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/builder/SpringApplicationBuilderTests.java @@ -65,7 +65,7 @@ public class SpringApplicationBuilderTests { } @Test - public void profileAndProperties() throws Exception { + public void profileAndProperties() { SpringApplicationBuilder application = new SpringApplicationBuilder() .sources(ExampleConfig.class).contextClass(StaticApplicationContext.class) .profiles("foo").properties("foo=bar"); @@ -76,7 +76,7 @@ public class SpringApplicationBuilderTests { } @Test - public void propertiesAsMap() throws Exception { + public void propertiesAsMap() { SpringApplicationBuilder application = new SpringApplicationBuilder() .sources(ExampleConfig.class).contextClass(StaticApplicationContext.class) .properties(Collections.singletonMap("bar", "foo")); @@ -85,7 +85,7 @@ public class SpringApplicationBuilderTests { } @Test - public void propertiesAsProperties() throws Exception { + public void propertiesAsProperties() { SpringApplicationBuilder application = new SpringApplicationBuilder() .sources(ExampleConfig.class).contextClass(StaticApplicationContext.class) .properties(StringUtils.splitArrayElementsIntoProperties( @@ -95,7 +95,7 @@ public class SpringApplicationBuilderTests { } @Test - public void propertiesWithRepeatSeparator() throws Exception { + public void propertiesWithRepeatSeparator() { SpringApplicationBuilder application = new SpringApplicationBuilder() .sources(ExampleConfig.class).contextClass(StaticApplicationContext.class) .properties("one=c:\\logging.file", "two=a:b", "three:c:\\logging.file", @@ -109,7 +109,7 @@ public class SpringApplicationBuilderTests { } @Test - public void specificApplicationContextClass() throws Exception { + public void specificApplicationContextClass() { SpringApplicationBuilder application = new SpringApplicationBuilder() .sources(ExampleConfig.class) .contextClass(StaticApplicationContext.class); @@ -118,7 +118,7 @@ public class SpringApplicationBuilderTests { } @Test - public void parentContextCreationThatIsRunDirectly() throws Exception { + public void parentContextCreationThatIsRunDirectly() { SpringApplicationBuilder application = new SpringApplicationBuilder( ChildConfig.class).contextClass(SpyApplicationContext.class); application.parent(ExampleConfig.class); @@ -134,7 +134,7 @@ public class SpringApplicationBuilderTests { } @Test - public void parentContextCreationThatIsBuiltThenRun() throws Exception { + public void parentContextCreationThatIsBuiltThenRun() { SpringApplicationBuilder application = new SpringApplicationBuilder( ChildConfig.class).contextClass(SpyApplicationContext.class); application.parent(ExampleConfig.class); @@ -150,7 +150,7 @@ public class SpringApplicationBuilderTests { } @Test - public void parentContextCreationWithChildShutdown() throws Exception { + public void parentContextCreationWithChildShutdown() { SpringApplicationBuilder application = new SpringApplicationBuilder( ChildConfig.class).contextClass(SpyApplicationContext.class) .registerShutdownHook(true); @@ -163,7 +163,7 @@ public class SpringApplicationBuilderTests { } @Test - public void contextWithClassLoader() throws Exception { + public void contextWithClassLoader() { SpringApplicationBuilder application = new SpringApplicationBuilder( ExampleConfig.class).contextClass(SpyApplicationContext.class); ClassLoader classLoader = new URLClassLoader(new URL[0], @@ -175,7 +175,7 @@ public class SpringApplicationBuilderTests { } @Test - public void parentContextWithClassLoader() throws Exception { + public void parentContextWithClassLoader() { SpringApplicationBuilder application = new SpringApplicationBuilder( ChildConfig.class).contextClass(SpyApplicationContext.class); ClassLoader classLoader = new URLClassLoader(new URL[0], @@ -188,7 +188,7 @@ public class SpringApplicationBuilderTests { } @Test - public void parentFirstCreation() throws Exception { + public void parentFirstCreation() { SpringApplicationBuilder application = new SpringApplicationBuilder( ExampleConfig.class).child(ChildConfig.class); application.contextClass(SpyApplicationContext.class); @@ -200,7 +200,7 @@ public class SpringApplicationBuilderTests { } @Test - public void parentFirstCreationWithProfileAndDefaultArgs() throws Exception { + public void parentFirstCreationWithProfileAndDefaultArgs() { SpringApplicationBuilder application = new SpringApplicationBuilder( ExampleConfig.class).profiles("node").properties("transport=redis") .child(ChildConfig.class).web(WebApplicationType.NONE); @@ -217,7 +217,7 @@ public class SpringApplicationBuilderTests { } @Test - public void parentFirstWithDifferentProfile() throws Exception { + public void parentFirstWithDifferentProfile() { SpringApplicationBuilder application = new SpringApplicationBuilder( ExampleConfig.class).profiles("node").properties("transport=redis") .child(ChildConfig.class).profiles("admin") @@ -230,7 +230,7 @@ public class SpringApplicationBuilderTests { } @Test - public void parentWithDifferentProfile() throws Exception { + public void parentWithDifferentProfile() { SpringApplicationBuilder shared = new SpringApplicationBuilder( ExampleConfig.class).profiles("node").properties("transport=redis"); SpringApplicationBuilder application = shared.child(ChildConfig.class) @@ -246,7 +246,7 @@ public class SpringApplicationBuilderTests { } @Test - public void parentFirstWithDifferentProfileAndExplicitEnvironment() throws Exception { + public void parentFirstWithDifferentProfileAndExplicitEnvironment() { SpringApplicationBuilder application = new SpringApplicationBuilder( ExampleConfig.class).environment(new StandardEnvironment()) .profiles("node").properties("transport=redis") @@ -262,7 +262,7 @@ public class SpringApplicationBuilderTests { } @Test - public void parentContextIdentical() throws Exception { + public void parentContextIdentical() { SpringApplicationBuilder application = new SpringApplicationBuilder( ExampleConfig.class); application.parent(ExampleConfig.class); @@ -273,7 +273,7 @@ public class SpringApplicationBuilderTests { } @Test - public void initializersCreatedOnce() throws Exception { + public void initializersCreatedOnce() { SpringApplicationBuilder application = new SpringApplicationBuilder( ExampleConfig.class).web(WebApplicationType.NONE); this.context = application.run(); @@ -281,7 +281,7 @@ public class SpringApplicationBuilderTests { } @Test - public void initializersCreatedOnceForChild() throws Exception { + public void initializersCreatedOnceForChild() { SpringApplicationBuilder application = new SpringApplicationBuilder( ExampleConfig.class).child(ChildConfig.class) .web(WebApplicationType.NONE); @@ -290,7 +290,7 @@ public class SpringApplicationBuilderTests { } @Test - public void initializersIncludeDefaults() throws Exception { + public void initializersIncludeDefaults() { SpringApplicationBuilder application = new SpringApplicationBuilder( ExampleConfig.class).web(WebApplicationType.NONE).initializers( (ConfigurableApplicationContext applicationContext) -> { @@ -300,7 +300,7 @@ public class SpringApplicationBuilderTests { } @Test - public void sourcesWithBoundSources() throws Exception { + public void sourcesWithBoundSources() { SpringApplicationBuilder application = new SpringApplicationBuilder() .web(WebApplicationType.NONE).sources(ExampleConfig.class) .properties("spring.main.sources=" + ChildConfig.class.getName()); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/cloud/CloudPlatformTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/cloud/CloudPlatformTests.java index 581f209879..495fa39367 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/cloud/CloudPlatformTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/cloud/CloudPlatformTests.java @@ -31,13 +31,13 @@ import static org.assertj.core.api.Assertions.assertThat; public class CloudPlatformTests { @Test - public void getActiveWhenEnvironmentIsNullShouldReturnNull() throws Exception { + public void getActiveWhenEnvironmentIsNullShouldReturnNull() { CloudPlatform platform = CloudPlatform.getActive(null); assertThat(platform).isNull(); } @Test - public void getActiveWhenNotInCloudShouldReturnNull() throws Exception { + public void getActiveWhenNotInCloudShouldReturnNull() { Environment environment = new MockEnvironment(); CloudPlatform platform = CloudPlatform.getActive(environment); assertThat(platform).isNull(); @@ -45,8 +45,7 @@ public class CloudPlatformTests { } @Test - public void getActiveWhenHasVcapApplicationShouldReturnCloudFoundry() - throws Exception { + public void getActiveWhenHasVcapApplicationShouldReturnCloudFoundry() { Environment environment = new MockEnvironment().withProperty("VCAP_APPLICATION", "---"); CloudPlatform platform = CloudPlatform.getActive(environment); @@ -55,7 +54,7 @@ public class CloudPlatformTests { } @Test - public void getActiveWhenHasVcapServicesShouldReturnCloudFoundry() throws Exception { + public void getActiveWhenHasVcapServicesShouldReturnCloudFoundry() { Environment environment = new MockEnvironment().withProperty("VCAP_SERVICES", "---"); CloudPlatform platform = CloudPlatform.getActive(environment); @@ -64,7 +63,7 @@ public class CloudPlatformTests { } @Test - public void getActiveWhenHasDynoShouldReturnHeroku() throws Exception { + public void getActiveWhenHasDynoShouldReturnHeroku() { Environment environment = new MockEnvironment().withProperty("DYNO", "---"); CloudPlatform platform = CloudPlatform.getActive(environment); assertThat(platform).isEqualTo(CloudPlatform.HEROKU); @@ -72,7 +71,7 @@ public class CloudPlatformTests { } @Test - public void getActiveWhenHasHcLandscapeShouldReturnSap() throws Exception { + public void getActiveWhenHasHcLandscapeShouldReturnSap() { Environment environment = new MockEnvironment().withProperty("HC_LANDSCAPE", "---"); CloudPlatform platform = CloudPlatform.getActive(environment); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/ConfigurationWarningsApplicationContextInitializerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/ConfigurationWarningsApplicationContextInitializerTests.java index fbdb3c80d2..ead1f4aa68 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/ConfigurationWarningsApplicationContextInitializerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/ConfigurationWarningsApplicationContextInitializerTests.java @@ -67,31 +67,31 @@ public class ConfigurationWarningsApplicationContextInitializerTests { } @Test - public void noLogIfInRealPackage() throws Exception { + public void noLogIfInRealPackage() { load(InRealPackageConfiguration.class); assertThat(this.output.toString()).doesNotContain(DEFAULT_SCAN_WARNING); } @Test - public void noLogWithoutComponentScanAnnotation() throws Exception { + public void noLogWithoutComponentScanAnnotation() { load(InDefaultPackageWithoutScanConfiguration.class); assertThat(this.output.toString()).doesNotContain(DEFAULT_SCAN_WARNING); } @Test - public void noLogIfHasValue() throws Exception { + public void noLogIfHasValue() { load(InDefaultPackageWithValueConfiguration.class); assertThat(this.output.toString()).doesNotContain(DEFAULT_SCAN_WARNING); } @Test - public void noLogIfHasBasePackages() throws Exception { + public void noLogIfHasBasePackages() { load(InDefaultPackageWithBasePackagesConfiguration.class); assertThat(this.output.toString()).doesNotContain(DEFAULT_SCAN_WARNING); } @Test - public void noLogIfHasBasePackageClasses() throws Exception { + public void noLogIfHasBasePackageClasses() { load(InDefaultPackageWithBasePackageClassesConfiguration.class); assertThat(this.output.toString()).doesNotContain(DEFAULT_SCAN_WARNING); } @@ -103,7 +103,7 @@ public class ConfigurationWarningsApplicationContextInitializerTests { } @Test - public void logWarningIfScanningProblemPackages() throws Exception { + public void logWarningIfScanningProblemPackages() { load(InRealButScanningProblemPackages.class); assertThat(this.output.toString()) .contains("Your ApplicationContext is unlikely to start due to a " diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/TypeExcludeFilterTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/TypeExcludeFilterTests.java index 6cefeaf57e..a586e4b582 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/TypeExcludeFilterTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/TypeExcludeFilterTests.java @@ -53,7 +53,7 @@ public class TypeExcludeFilterTests { } @Test - public void loadsTypeExcludeFilters() throws Exception { + public void loadsTypeExcludeFilters() { this.context = new AnnotationConfigApplicationContext(); this.context.getBeanFactory().registerSingleton("filter1", new WithoutMatchOverrideFilter()); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/annotation/ConfigurationsTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/annotation/ConfigurationsTests.java index bc4d21d132..dbbcbdd222 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/annotation/ConfigurationsTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/annotation/ConfigurationsTests.java @@ -45,14 +45,14 @@ public class ConfigurationsTests { public ExpectedException thrown = ExpectedException.none(); @Test - public void createWhenClassesIsNullShouldThrowException() throws Exception { + public void createWhenClassesIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Classes must not be null"); new TestConfigurations(null); } @Test - public void createShouldSortClasses() throws Exception { + public void createShouldSortClasses() { TestSortedConfigurations configurations = new TestSortedConfigurations( Arrays.asList(OutputStream.class, InputStream.class)); assertThat(configurations.getClasses()).containsExactly(InputStream.class, @@ -60,7 +60,7 @@ public class ConfigurationsTests { } @Test - public void getClassesShouldMergeByClassAndSort() throws Exception { + public void getClassesShouldMergeByClassAndSort() { Configurations c1 = new TestSortedConfigurations( Arrays.asList(OutputStream.class, InputStream.class)); Configurations c2 = new TestConfigurations(Arrays.asList(Short.class)); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/AnsiOutputApplicationListenerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/AnsiOutputApplicationListenerTests.java index a544a8035c..f9c88dce82 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/AnsiOutputApplicationListenerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/AnsiOutputApplicationListenerTests.java @@ -70,7 +70,7 @@ public class AnsiOutputApplicationListenerTests { } @Test - public void disabled() throws Exception { + public void disabled() { SpringApplication application = new SpringApplication(Config.class); application.setWebApplicationType(WebApplicationType.NONE); Map props = new HashMap<>(); @@ -81,7 +81,7 @@ public class AnsiOutputApplicationListenerTests { } @Test - public void disabledViaApplicationProperties() throws Exception { + public void disabledViaApplicationProperties() { ConfigurableEnvironment environment = new StandardEnvironment(); TestPropertySourceUtils.addInlinedPropertiesToEnvironment(environment, "spring.config.name=ansi"); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java index 780fd93b8a..909315fa4c 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java @@ -97,7 +97,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void loadCustomResource() throws Exception { + public void loadCustomResource() { this.application.setResourceLoader(new ResourceLoader() { @Override public Resource getResource(String location) { @@ -125,7 +125,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void loadPropertiesFile() throws Exception { + public void loadPropertiesFile() { this.initializer.setSearchNames("testproperties"); this.initializer.postProcessEnvironment(this.environment, this.application); String property = this.environment.getProperty("the.property"); @@ -133,7 +133,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void loadDefaultPropertiesFile() throws Exception { + public void loadDefaultPropertiesFile() { this.environment.setDefaultProfiles("thedefault"); this.initializer.setSearchNames("testprofiles"); this.initializer.postProcessEnvironment(this.environment, this.application); @@ -142,7 +142,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void loadTwoPropertiesFile() throws Exception { + public void loadTwoPropertiesFile() { TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.environment, "spring.config.location=" + "classpath:application.properties,classpath:testproperties.properties"); @@ -152,7 +152,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void loadTwoPropertiesFilesWithProfiles() throws Exception { + public void loadTwoPropertiesFilesWithProfiles() { TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.environment, "spring.config.location=classpath:enableprofile.properties," + "classpath:enableother.properties"); @@ -163,8 +163,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void loadTwoPropertiesFilesWithProfilesUsingAdditionalLocation() - throws Exception { + public void loadTwoPropertiesFilesWithProfilesUsingAdditionalLocation() { TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.environment, "spring.config.additional-location=classpath:enableprofile.properties," + "classpath:enableother.properties"); @@ -175,7 +174,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void loadTwoPropertiesFilesWithProfilesAndSwitchOneOff() throws Exception { + public void loadTwoPropertiesFilesWithProfilesAndSwitchOneOff() { TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.environment, "spring.config.location=classpath:enabletwoprofiles.properties," + "classpath:enableprofile.properties"); @@ -188,8 +187,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void loadTwoPropertiesFilesWithProfilesAndSwitchOneOffFromSpecificLocation() - throws Exception { + public void loadTwoPropertiesFilesWithProfilesAndSwitchOneOffFromSpecificLocation() { TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.environment, "spring.config.name=enabletwoprofiles", "spring.config.location=classpath:enableprofile.properties"); @@ -221,7 +219,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void moreSpecificLocationTakesPrecedenceOverRoot() throws Exception { + public void moreSpecificLocationTakesPrecedenceOverRoot() { TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.environment, "spring.config.name=specific"); this.initializer.postProcessEnvironment(this.environment, this.application); @@ -230,7 +228,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void loadTwoOfThreePropertiesFile() throws Exception { + public void loadTwoOfThreePropertiesFile() { TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.environment, "spring.config.location=classpath:application.properties," + "classpath:testproperties.properties," @@ -241,14 +239,14 @@ public class ConfigFileApplicationListenerTests { } @Test - public void randomValue() throws Exception { + public void randomValue() { this.initializer.postProcessEnvironment(this.environment, this.application); String property = this.environment.getProperty("random.value"); assertThat(property).isNotNull(); } @Test - public void loadTwoPropertiesFiles() throws Exception { + public void loadTwoPropertiesFiles() { this.initializer.setSearchNames("moreproperties,testproperties"); this.initializer.postProcessEnvironment(this.environment, this.application); String property = this.environment.getProperty("the.property"); @@ -257,7 +255,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void loadYamlFile() throws Exception { + public void loadYamlFile() { this.initializer.setSearchNames("testyaml"); this.initializer.postProcessEnvironment(this.environment, this.application); String property = this.environment.getProperty("my.property"); @@ -267,7 +265,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void loadProfileEmptySameAsNotSpecified() throws Exception { + public void loadProfileEmptySameAsNotSpecified() { this.initializer.setSearchNames("testprofilesempty"); this.initializer.postProcessEnvironment(this.environment, this.application); String property = this.environment.getProperty("my.property"); @@ -275,7 +273,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void loadDefaultYamlDocument() throws Exception { + public void loadDefaultYamlDocument() { this.environment.setDefaultProfiles("thedefault"); this.initializer.setSearchNames("testprofilesdocument"); this.initializer.postProcessEnvironment(this.environment, this.application); @@ -284,7 +282,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void loadDefaultYamlDocumentNotActivated() throws Exception { + public void loadDefaultYamlDocumentNotActivated() { this.environment.setDefaultProfiles("thedefault"); this.environment.setActiveProfiles("other"); this.initializer.setSearchNames("testprofilesdocument"); @@ -294,7 +292,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void commandLineWins() throws Exception { + public void commandLineWins() { this.environment.getPropertySources().addFirst( new SimpleCommandLinePropertySource("--the.property=fromcommandline")); this.initializer.setSearchNames("testproperties"); @@ -304,7 +302,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void systemPropertyWins() throws Exception { + public void systemPropertyWins() { System.setProperty("the.property", "fromsystem"); this.initializer.setSearchNames("testproperties"); this.initializer.postProcessEnvironment(this.environment, this.application); @@ -313,7 +311,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void defaultPropertyAsFallback() throws Exception { + public void defaultPropertyAsFallback() { this.environment.getPropertySources() .addLast(new MapPropertySource("defaultProperties", Collections.singletonMap("my.fallback", (Object) "foo"))); @@ -323,7 +321,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void defaultPropertyAsFallbackDuringFileParsing() throws Exception { + public void defaultPropertyAsFallbackDuringFileParsing() { this.environment.getPropertySources() .addLast(new MapPropertySource("defaultProperties", Collections .singletonMap("spring.config.name", (Object) "testproperties"))); @@ -333,8 +331,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void loadPropertiesThenProfilePropertiesActivatedInSpringApplication() - throws Exception { + public void loadPropertiesThenProfilePropertiesActivatedInSpringApplication() { // This should be the effect of calling // SpringApplication.setAdditionalProfiles("other") this.environment.setActiveProfiles("other"); @@ -346,7 +343,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void twoProfilesFromProperties() throws Exception { + public void twoProfilesFromProperties() { // This should be the effect of calling // SpringApplication.setAdditionalProfiles("other", "dev") this.environment.setActiveProfiles("other", "dev"); @@ -358,7 +355,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void loadPropertiesThenProfilePropertiesActivatedInFirst() throws Exception { + public void loadPropertiesThenProfilePropertiesActivatedInFirst() { this.initializer.setSearchNames("enableprofile"); this.initializer.postProcessEnvironment(this.environment, this.application); String property = this.environment.getProperty("the.property"); @@ -368,7 +365,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void loadPropertiesThenProfilePropertiesWithOverride() throws Exception { + public void loadPropertiesThenProfilePropertiesWithOverride() { this.environment.setActiveProfiles("other"); this.initializer.setSearchNames("enableprofile"); this.initializer.postProcessEnvironment(this.environment, this.application); @@ -383,7 +380,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void profilePropertiesUsedInPlaceholders() throws Exception { + public void profilePropertiesUsedInPlaceholders() { this.initializer.setSearchNames("enableprofile"); this.initializer.postProcessEnvironment(this.environment, this.application); String property = this.environment.getProperty("one.more"); @@ -391,7 +388,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void profilesAddedToEnvironmentAndViaProperty() throws Exception { + public void profilesAddedToEnvironmentAndViaProperty() { // External profile takes precedence over profile added via the environment TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.environment, "spring.profiles.active=other"); @@ -404,7 +401,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void profilesAddedToEnvironmentAndViaPropertyDuplicate() throws Exception { + public void profilesAddedToEnvironmentAndViaPropertyDuplicate() { TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.environment, "spring.profiles.active=dev,other"); this.environment.addActiveProfile("dev"); @@ -416,8 +413,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void profilesAddedToEnvironmentAndViaPropertyDuplicateEnvironmentWins() - throws Exception { + public void profilesAddedToEnvironmentAndViaPropertyDuplicateEnvironmentWins() { TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.environment, "spring.profiles.active=other,dev"); this.environment.addActiveProfile("other"); @@ -487,7 +483,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void yamlProfiles() throws Exception { + public void yamlProfiles() { this.initializer.setSearchNames("testprofiles"); this.environment.setActiveProfiles("dev"); this.initializer.postProcessEnvironment(this.environment, this.application); @@ -498,7 +494,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void yamlTwoProfiles() throws Exception { + public void yamlTwoProfiles() { this.initializer.setSearchNames("testprofiles"); this.environment.setActiveProfiles("other", "dev"); this.initializer.postProcessEnvironment(this.environment, this.application); @@ -509,7 +505,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void yamlSetsProfiles() throws Exception { + public void yamlSetsProfiles() { this.initializer.setSearchNames("testsetprofiles"); this.initializer.postProcessEnvironment(this.environment, this.application); assertThat(this.environment.getActiveProfiles()).containsExactly("dev"); @@ -526,7 +522,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void yamlSetsMultiProfiles() throws Exception { + public void yamlSetsMultiProfiles() { this.initializer.setSearchNames("testsetmultiprofiles"); this.initializer.postProcessEnvironment(this.environment, this.application); assertThat(this.environment.getActiveProfiles()).containsExactly("dev", @@ -534,7 +530,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void yamlSetsMultiProfilesWhenListProvided() throws Exception { + public void yamlSetsMultiProfilesWhenListProvided() { this.initializer.setSearchNames("testsetmultiprofileslist"); this.initializer.postProcessEnvironment(this.environment, this.application); assertThat(this.environment.getActiveProfiles()).containsExactly("dev", @@ -542,7 +538,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void yamlSetsMultiProfilesWithWhitespace() throws Exception { + public void yamlSetsMultiProfilesWithWhitespace() { this.initializer.setSearchNames("testsetmultiprofileswhitespace"); this.initializer.postProcessEnvironment(this.environment, this.application); assertThat(this.environment.getActiveProfiles()).containsExactly("dev", @@ -550,7 +546,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void yamlProfileCanBeChanged() throws Exception { + public void yamlProfileCanBeChanged() { TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.environment, "spring.profiles.active=prod"); this.initializer.setSearchNames("testsetprofiles"); @@ -559,7 +555,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void specificNameAndProfileFromExistingSource() throws Exception { + public void specificNameAndProfileFromExistingSource() { TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.environment, "spring.profiles.active=specificprofile", "spring.config.name=specificfile"); @@ -569,7 +565,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void specificResource() throws Exception { + public void specificResource() { String location = "classpath:specificlocation.properties"; TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.environment, "spring.config.location=" + location); @@ -585,7 +581,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void specificResourceFromAdditionalLocation() throws Exception { + public void specificResourceFromAdditionalLocation() { String additionalLocation = "classpath:specificlocation.properties"; TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.environment, "spring.config.additional-location=" + additionalLocation); @@ -601,7 +597,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void specificResourceAsFile() throws Exception { + public void specificResourceAsFile() { String location = "file:src/test/resources/specificlocation.properties"; TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.environment, "spring.config.location=" + location); @@ -611,7 +607,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void specificResourceDefaultsToFile() throws Exception { + public void specificResourceDefaultsToFile() { String location = "src/test/resources/specificlocation.properties"; TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.environment, "spring.config.location=" + location); @@ -621,7 +617,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void absoluteResourceDefaultsToFile() throws Exception { + public void absoluteResourceDefaultsToFile() { String location = new File("src/test/resources/specificlocation.properties") .getAbsolutePath().replace("\\", "/"); TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.environment, @@ -633,7 +629,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void propertySourceAnnotation() throws Exception { + public void propertySourceAnnotation() { SpringApplication application = new SpringApplication(WithPropertySource.class); application.setWebApplicationType(WebApplicationType.NONE); ConfigurableApplicationContext context = application.run(); @@ -647,7 +643,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void propertySourceAnnotationWithPlaceholder() throws Exception { + public void propertySourceAnnotationWithPlaceholder() { TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.environment, "source.location=specificlocation"); SpringApplication application = new SpringApplication( @@ -663,7 +659,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void propertySourceAnnotationWithName() throws Exception { + public void propertySourceAnnotationWithName() { SpringApplication application = new SpringApplication( WithPropertySourceAndName.class); application.setWebApplicationType(WebApplicationType.NONE); @@ -675,7 +671,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void propertySourceAnnotationInProfile() throws Exception { + public void propertySourceAnnotationInProfile() { SpringApplication application = new SpringApplication( WithPropertySourceInProfile.class); application.setWebApplicationType(WebApplicationType.NONE); @@ -691,7 +687,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void propertySourceAnnotationAndNonActiveProfile() throws Exception { + public void propertySourceAnnotationAndNonActiveProfile() { SpringApplication application = new SpringApplication( WithPropertySourceAndProfile.class); application.setWebApplicationType(WebApplicationType.NONE); @@ -704,7 +700,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void propertySourceAnnotationMultipleLocations() throws Exception { + public void propertySourceAnnotationMultipleLocations() { SpringApplication application = new SpringApplication( WithPropertySourceMultipleLocations.class); application.setWebApplicationType(WebApplicationType.NONE); @@ -717,7 +713,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void propertySourceAnnotationMultipleLocationsAndName() throws Exception { + public void propertySourceAnnotationMultipleLocationsAndName() { SpringApplication application = new SpringApplication( WithPropertySourceMultipleLocationsAndName.class); application.setWebApplicationType(WebApplicationType.NONE); @@ -729,7 +725,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void activateProfileFromProfileSpecificProperties() throws Exception { + public void activateProfileFromProfileSpecificProperties() { SpringApplication application = new SpringApplication(Config.class); application.setWebApplicationType(WebApplicationType.NONE); this.context = application.run("--spring.profiles.active=includeprofile"); @@ -742,7 +738,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void profileSubDocumentInSameProfileSpecificFile() throws Exception { + public void profileSubDocumentInSameProfileSpecificFile() { // gh-340 SpringApplication application = new SpringApplication(Config.class); application.setWebApplicationType(WebApplicationType.NONE); @@ -753,7 +749,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void profileSubDocumentInDifferentProfileSpecificFile() throws Exception { + public void profileSubDocumentInDifferentProfileSpecificFile() { // gh-4132 SpringApplication application = new SpringApplication(Config.class); application.setWebApplicationType(WebApplicationType.NONE); @@ -764,7 +760,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void addBeforeDefaultProperties() throws Exception { + public void addBeforeDefaultProperties() { MapPropertySource defaultSource = new MapPropertySource("defaultProperties", Collections.singletonMap("the.property", "fromdefaultproperties")); this.environment.getPropertySources().addFirst(defaultSource); @@ -775,7 +771,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void customDefaultProfile() throws Exception { + public void customDefaultProfile() { SpringApplication application = new SpringApplication(Config.class); application.setWebApplicationType(WebApplicationType.NONE); this.context = application.run("--spring.profiles.default=customdefault"); @@ -784,7 +780,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void customDefaultProfileAndActive() throws Exception { + public void customDefaultProfileAndActive() { SpringApplication application = new SpringApplication(Config.class); application.setWebApplicationType(WebApplicationType.NONE); this.context = application.run("--spring.profiles.default=customdefault", @@ -796,7 +792,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void customDefaultProfileAndActiveFromFile() throws Exception { + public void customDefaultProfileAndActiveFromFile() { // gh-5998 SpringApplication application = new SpringApplication(Config.class); application.setWebApplicationType(WebApplicationType.NONE); @@ -810,7 +806,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void additionalProfilesCanBeIncludedFromAnyPropertySource() throws Exception { + public void additionalProfilesCanBeIncludedFromAnyPropertySource() { SpringApplication application = new SpringApplication(Config.class); application.setWebApplicationType(WebApplicationType.NONE); this.context = application.run("--spring.profiles.active=myprofile", @@ -822,7 +818,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void profileCanBeIncludedWithoutAnyBeingActive() throws Exception { + public void profileCanBeIncludedWithoutAnyBeingActive() { SpringApplication application = new SpringApplication(Config.class); application.setWebApplicationType(WebApplicationType.NONE); this.context = application.run("--spring.profiles.include=dev"); @@ -831,8 +827,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void activeProfilesCanBeConfiguredUsingPlaceholdersResolvedAgainstTheEnvironment() - throws Exception { + public void activeProfilesCanBeConfiguredUsingPlaceholdersResolvedAgainstTheEnvironment() { Map source = new HashMap<>(); source.put("activeProfile", "testPropertySource"); org.springframework.core.env.PropertySource propertySource = new MapPropertySource( @@ -845,7 +840,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void additionalLocationTakesPrecedenceOverDefaultLocation() throws Exception { + public void additionalLocationTakesPrecedenceOverDefaultLocation() { TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.environment, "spring.config.additional-location=classpath:override.properties"); this.initializer.postProcessEnvironment(this.environment, this.application); @@ -854,7 +849,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void lastAdditionalLocationWins() throws Exception { + public void lastAdditionalLocationWins() { TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.environment, "spring.config.additional-location=classpath:override.properties," + "classpath:some.properties"); @@ -864,7 +859,7 @@ public class ConfigFileApplicationListenerTests { } @Test - public void locationReplaceDefaultLocation() throws Exception { + public void locationReplaceDefaultLocation() { TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.environment, "spring.config.location=classpath:override.properties"); this.initializer.postProcessEnvironment(this.environment, this.application); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/DelegatingApplicationContextInitializerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/DelegatingApplicationContextInitializerTests.java index 181c24b84d..77cde1d0f2 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/DelegatingApplicationContextInitializerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/DelegatingApplicationContextInitializerTests.java @@ -44,7 +44,7 @@ public class DelegatingApplicationContextInitializerTests { private final DelegatingApplicationContextInitializer initializer = new DelegatingApplicationContextInitializer(); @Test - public void orderedInitialize() throws Exception { + public void orderedInitialize() { StaticApplicationContext context = new StaticApplicationContext(); TestPropertySourceUtils.addInlinedPropertiesToEnvironment(context, "context.initializer.classes=" + MockInitB.class.getName() + "," @@ -55,13 +55,13 @@ public class DelegatingApplicationContextInitializerTests { } @Test - public void noInitializers() throws Exception { + public void noInitializers() { StaticApplicationContext context = new StaticApplicationContext(); this.initializer.initialize(context); } @Test - public void emptyInitializers() throws Exception { + public void emptyInitializers() { StaticApplicationContext context = new StaticApplicationContext(); TestPropertySourceUtils.addInlinedPropertiesToEnvironment(context, "context.initializer.classes:"); @@ -69,7 +69,7 @@ public class DelegatingApplicationContextInitializerTests { } @Test - public void noSuchInitializerClass() throws Exception { + public void noSuchInitializerClass() { StaticApplicationContext context = new StaticApplicationContext(); TestPropertySourceUtils.addInlinedPropertiesToEnvironment(context, "context.initializer.classes=missing.madeup.class"); @@ -78,7 +78,7 @@ public class DelegatingApplicationContextInitializerTests { } @Test - public void notAnInitializerClass() throws Exception { + public void notAnInitializerClass() { StaticApplicationContext context = new StaticApplicationContext(); TestPropertySourceUtils.addInlinedPropertiesToEnvironment(context, "context.initializer.classes=" + Object.class.getName()); @@ -87,7 +87,7 @@ public class DelegatingApplicationContextInitializerTests { } @Test - public void genericNotSuitable() throws Exception { + public void genericNotSuitable() { StaticApplicationContext context = new StaticApplicationContext(); TestPropertySourceUtils.addInlinedPropertiesToEnvironment(context, "context.initializer.classes=" + NotSuitableInit.class.getName()); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/DelegatingApplicationListenerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/DelegatingApplicationListenerTests.java index 49501b35f8..131500159d 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/DelegatingApplicationListenerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/DelegatingApplicationListenerTests.java @@ -50,7 +50,7 @@ public class DelegatingApplicationListenerTests { } @Test - public void orderedInitialize() throws Exception { + public void orderedInitialize() { TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context, "context.listener.classes=" + MockInitB.class.getName() + "," + MockInitA.class.getName()); @@ -63,13 +63,13 @@ public class DelegatingApplicationListenerTests { } @Test - public void noInitializers() throws Exception { + public void noInitializers() { this.listener.onApplicationEvent(new ApplicationEnvironmentPreparedEvent( new SpringApplication(), new String[0], this.context.getEnvironment())); } @Test - public void emptyInitializers() throws Exception { + public void emptyInitializers() { TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context, "context.listener.classes:"); this.listener.onApplicationEvent(new ApplicationEnvironmentPreparedEvent( diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/logging/LoggingApplicationListenerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/logging/LoggingApplicationListenerTests.java index 1bd32efbae..714254c41f 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/logging/LoggingApplicationListenerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/logging/LoggingApplicationListenerTests.java @@ -165,7 +165,7 @@ public class LoggingApplicationListenerTests { } @Test - public void overrideConfigDoesNotExist() throws Exception { + public void overrideConfigDoesNotExist() { TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context, "logging.config=doesnotexist.xml"); this.thrown.expect(IllegalStateException.class); @@ -176,7 +176,7 @@ public class LoggingApplicationListenerTests { } @Test - public void azureDefaultLoggingConfigDoesNotCauseAFailure() throws Exception { + public void azureDefaultLoggingConfigDoesNotCauseAFailure() { TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context, "logging.config: -Djava.util.logging.config.file=\"d:\\home\\site\\wwwroot\\bin\\apache-tomcat-7.0.52\\conf\\logging.properties\""); this.initializer.initialize(this.context.getEnvironment(), @@ -188,7 +188,7 @@ public class LoggingApplicationListenerTests { } @Test - public void tomcatNopLoggingConfigDoesNotCauseAFailure() throws Exception { + public void tomcatNopLoggingConfigDoesNotCauseAFailure() { TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context, "LOGGING_CONFIG: -Dnop"); this.initializer.initialize(this.context.getEnvironment(), @@ -200,7 +200,7 @@ public class LoggingApplicationListenerTests { } @Test - public void overrideConfigBroken() throws Exception { + public void overrideConfigBroken() { TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context, "logging.config=classpath:logback-broken.xml"); this.thrown.expect(IllegalStateException.class); @@ -250,7 +250,7 @@ public class LoggingApplicationListenerTests { } @Test - public void parseDebugArg() throws Exception { + public void parseDebugArg() { TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context, "debug"); this.initializer.initialize(this.context.getEnvironment(), this.context.getClassLoader()); @@ -261,7 +261,7 @@ public class LoggingApplicationListenerTests { } @Test - public void parseTraceArg() throws Exception { + public void parseTraceArg() { TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context, "trace"); this.initializer.initialize(this.context.getEnvironment(), this.context.getClassLoader()); @@ -293,7 +293,7 @@ public class LoggingApplicationListenerTests { } @Test - public void parseLevels() throws Exception { + public void parseLevels() { TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context, "logging.level.org.springframework.boot=TRACE"); this.initializer.initialize(this.context.getEnvironment(), @@ -305,7 +305,7 @@ public class LoggingApplicationListenerTests { } @Test - public void parseLevelsCaseInsensitive() throws Exception { + public void parseLevelsCaseInsensitive() { TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context, "logging.level.org.springframework.boot=TrAcE"); this.initializer.initialize(this.context.getEnvironment(), @@ -317,7 +317,7 @@ public class LoggingApplicationListenerTests { } @Test - public void parseLevelsWithPlaceholder() throws Exception { + public void parseLevelsWithPlaceholder() { TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context, "foo=TRACE", "logging.level.org.springframework.boot=${foo}"); this.initializer.initialize(this.context.getEnvironment(), @@ -329,7 +329,7 @@ public class LoggingApplicationListenerTests { } @Test - public void parseLevelsFails() throws Exception { + public void parseLevelsFails() { TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context, "logging.level.org.springframework.boot=GARBAGE"); this.initializer.initialize(this.context.getEnvironment(), @@ -340,7 +340,7 @@ public class LoggingApplicationListenerTests { } @Test - public void parseLevelsNone() throws Exception { + public void parseLevelsNone() { TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context, "logging.level.org.springframework.boot=OFF"); this.initializer.initialize(this.context.getEnvironment(), @@ -352,7 +352,7 @@ public class LoggingApplicationListenerTests { } @Test - public void parseLevelsMapsFalseToOff() throws Exception { + public void parseLevelsMapsFalseToOff() { TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context, "logging.level.org.springframework.boot=false"); this.initializer.initialize(this.context.getEnvironment(), @@ -364,7 +364,7 @@ public class LoggingApplicationListenerTests { } @Test - public void parseArgsDisabled() throws Exception { + public void parseArgsDisabled() { this.initializer.setParseArgs(false); TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context, "debug"); this.initializer.initialize(this.context.getEnvironment(), @@ -374,7 +374,7 @@ public class LoggingApplicationListenerTests { } @Test - public void parseArgsDoesntReplace() throws Exception { + public void parseArgsDoesntReplace() { this.initializer.setSpringBootLogging(LogLevel.ERROR); this.initializer.setParseArgs(false); multicastEvent(new ApplicationStartingEvent(this.springApplication, @@ -386,14 +386,14 @@ public class LoggingApplicationListenerTests { } @Test - public void bridgeHandlerLifecycle() throws Exception { + public void bridgeHandlerLifecycle() { assertThat(bridgeHandlerInstalled()).isTrue(); multicastEvent(new ContextClosedEvent(this.context)); assertThat(bridgeHandlerInstalled()).isFalse(); } @Test - public void defaultExceptionConversionWord() throws Exception { + public void defaultExceptionConversionWord() { this.initializer.initialize(this.context.getEnvironment(), this.context.getClassLoader()); this.outputCapture.expect(containsString("Hello world")); @@ -404,7 +404,7 @@ public class LoggingApplicationListenerTests { } @Test - public void overrideExceptionConversionWord() throws Exception { + public void overrideExceptionConversionWord() { TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context, "logging.exceptionConversionWord=%rEx"); this.initializer.initialize(this.context.getEnvironment(), @@ -417,7 +417,7 @@ public class LoggingApplicationListenerTests { } @Test - public void shutdownHookIsNotRegisteredByDefault() throws Exception { + public void shutdownHookIsNotRegisteredByDefault() { TestLoggingApplicationListener listener = new TestLoggingApplicationListener(); System.setProperty(LoggingSystem.class.getName(), TestShutdownHandlerLoggingSystem.class.getName()); @@ -533,8 +533,7 @@ public class LoggingApplicationListenerTests { } @Test - public void lowPriorityPropertySourceShouldNotOverrideRootLoggerConfig() - throws Exception { + public void lowPriorityPropertySourceShouldNotOverrideRootLoggerConfig() { MutablePropertySources propertySources = this.context.getEnvironment() .getPropertySources(); propertySources.addFirst(new MapPropertySource("test1", diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesBinderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesBinderTests.java index 453ad98a82..a2f770facc 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesBinderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesBinderTests.java @@ -146,7 +146,7 @@ public class ConfigurationPropertiesBinderTests { } @Test - public void bindToRelaxedPropertyNamesSame() throws Exception { + public void bindToRelaxedPropertyNamesSame() { testRelaxedPropertyNames("test.FOO_BAR=test1", "test.FOO_BAR=test2", "test.BAR-B-A-Z=testa", "test.BAR-B-A-Z=testb"); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessorTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessorTests.java index ce5594ca8f..a2293d5749 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessorTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessorTests.java @@ -109,7 +109,7 @@ public class ConfigurationPropertiesBindingPostProcessorTests { } @Test - public void bindWithValueDefault() throws Exception { + public void bindWithValueDefault() { this.context = new AnnotationConfigApplicationContext(); TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context, "default.value=foo"); @@ -120,7 +120,7 @@ public class ConfigurationPropertiesBindingPostProcessorTests { } @Test - public void binderShouldNotInitializeFactoryBeans() throws Exception { + public void binderShouldNotInitializeFactoryBeans() { ConfigurationPropertiesWithFactoryBean.factoryBeanInit = false; this.context = new AnnotationConfigApplicationContext() { @Override @@ -153,7 +153,7 @@ public class ConfigurationPropertiesBindingPostProcessorTests { } @Test - public void multiplePropertySourcesPlaceholderConfigurer() throws Exception { + public void multiplePropertySourcesPlaceholderConfigurer() { this.context = new AnnotationConfigApplicationContext(); this.context.register(MultiplePropertySourcesPlaceholderConfigurer.class); this.context.refresh(); @@ -162,8 +162,7 @@ public class ConfigurationPropertiesBindingPostProcessorTests { } @Test - public void overridingPropertiesWithPlaceholderResolutionInEnvShouldOverride() - throws Exception { + public void overridingPropertiesWithPlaceholderResolutionInEnvShouldOverride() { this.context = new AnnotationConfigApplicationContext(); ConfigurableEnvironment env = this.context.getEnvironment(); MutablePropertySources propertySources = env.getPropertySources(); @@ -180,8 +179,7 @@ public class ConfigurationPropertiesBindingPostProcessorTests { } @Test - public void unboundElementsFromSystemEnvironmentShouldNotThrowException() - throws Exception { + public void unboundElementsFromSystemEnvironmentShouldNotThrowException() { this.context = new AnnotationConfigApplicationContext(); ConfigurableEnvironment env = this.context.getEnvironment(); MutablePropertySources propertySources = env.getPropertySources(); @@ -197,7 +195,7 @@ public class ConfigurationPropertiesBindingPostProcessorTests { } @Test - public void rebindableConfigurationProperties() throws Exception { + public void rebindableConfigurationProperties() { // gh-9160 this.context = new AnnotationConfigApplicationContext(); MutablePropertySources sources = this.context.getEnvironment() @@ -218,8 +216,7 @@ public class ConfigurationPropertiesBindingPostProcessorTests { } @Test - public void rebindableConfigurationPropertiesWithPropertySourcesPlaceholderConfigurer() - throws Exception { + public void rebindableConfigurationPropertiesWithPropertySourcesPlaceholderConfigurer() { this.context = new AnnotationConfigApplicationContext(); MutablePropertySources sources = this.context.getEnvironment() .getPropertySources(); @@ -451,7 +448,7 @@ public class ConfigurationPropertiesBindingPostProcessorTests { static class FactoryBeanTester implements FactoryBean, InitializingBean { @Override - public Object getObject() throws Exception { + public Object getObject() { return Object.class; } @@ -466,7 +463,7 @@ public class ConfigurationPropertiesBindingPostProcessorTests { } @Override - public void afterPropertiesSet() throws Exception { + public void afterPropertiesSet() { ConfigurationPropertiesWithFactoryBean.factoryBeanInit = true; } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesTests.java index 9e1219809d..00ab941562 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesTests.java @@ -277,7 +277,7 @@ public class EnableConfigurationPropertiesTests { } @Test - public void testSimpleAutoConfig() throws Exception { + public void testSimpleAutoConfig() { TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context, "external.name=foo"); this.context.register(ExampleConfig.class); @@ -286,7 +286,7 @@ public class EnableConfigurationPropertiesTests { } @Test - public void testExplicitType() throws Exception { + public void testExplicitType() { TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context, "external.name=foo"); this.context.register(AnotherExampleConfig.class); @@ -297,7 +297,7 @@ public class EnableConfigurationPropertiesTests { } @Test - public void testMultipleExplicitTypes() throws Exception { + public void testMultipleExplicitTypes() { TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context, "external.name=foo", "another.name=bar"); this.context.register(FurtherExampleConfig.class); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/ArrayBinderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/ArrayBinderTests.java index d0af1601ed..d6bd4e57e5 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/ArrayBinderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/ArrayBinderTests.java @@ -63,7 +63,7 @@ public class ArrayBinderTests { } @Test - public void bindToArrayShouldReturnArray() throws Exception { + public void bindToArrayShouldReturnArray() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo[0]", "1"); source.put("foo[1]", "2"); @@ -74,7 +74,7 @@ public class ArrayBinderTests { } @Test - public void bindToCollectionShouldTriggerOnSuccess() throws Exception { + public void bindToCollectionShouldTriggerOnSuccess() { this.sources.add(new MockConfigurationPropertySource("foo[0]", "1", "line1")); BindHandler handler = mock(BindHandler.class, withSettings().defaultAnswer(Answers.CALLS_REAL_METHODS)); @@ -87,7 +87,7 @@ public class ArrayBinderTests { } @Test - public void bindToArrayShouldReturnPrimitiveArray() throws Exception { + public void bindToArrayShouldReturnPrimitiveArray() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo[0]", "1"); source.put("foo[1]", "2"); @@ -98,7 +98,7 @@ public class ArrayBinderTests { } @Test - public void bindToArrayWhenNestedShouldReturnPopulatedArray() throws Exception { + public void bindToArrayWhenNestedShouldReturnPopulatedArray() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo[0][0]", "1"); source.put("foo[0][1]", "2"); @@ -114,7 +114,7 @@ public class ArrayBinderTests { } @Test - public void bindToArrayWhenNestedListShouldReturnPopulatedArray() throws Exception { + public void bindToArrayWhenNestedListShouldReturnPopulatedArray() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo[0][0]", "1"); source.put("foo[0][1]", "2"); @@ -130,7 +130,7 @@ public class ArrayBinderTests { } @Test - public void bindToArrayWhenNotInOrderShouldReturnPopulatedArray() throws Exception { + public void bindToArrayWhenNotInOrderShouldReturnPopulatedArray() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo[1]", "2"); source.put("foo[0]", "1"); @@ -141,7 +141,7 @@ public class ArrayBinderTests { } @Test - public void bindToArrayWhenNonSequentialShouldThrowException() throws Exception { + public void bindToArrayWhenNonSequentialShouldThrowException() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo[0]", "2"); source.put("foo[1]", "1"); @@ -162,7 +162,7 @@ public class ArrayBinderTests { } @Test - public void bindToArrayWhenNonIterableShouldReturnPopulatedArray() throws Exception { + public void bindToArrayWhenNonIterableShouldReturnPopulatedArray() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo[1]", "2"); source.put("foo[0]", "1"); @@ -173,7 +173,7 @@ public class ArrayBinderTests { } @Test - public void bindToArrayWhenMultipleSourceShouldOnlyUseFirst() throws Exception { + public void bindToArrayWhenMultipleSourceShouldOnlyUseFirst() { MockConfigurationPropertySource source1 = new MockConfigurationPropertySource(); source1.put("bar", "baz"); this.sources.add(source1); @@ -191,8 +191,7 @@ public class ArrayBinderTests { } @Test - public void bindToArrayWhenHasExistingCollectionShouldReplaceAllContents() - throws Exception { + public void bindToArrayWhenHasExistingCollectionShouldReplaceAllContents() { this.sources.add(new MockConfigurationPropertySource("foo[0]", "1")); Integer[] existing = new Integer[2]; existing[0] = 1000; @@ -203,14 +202,14 @@ public class ArrayBinderTests { } @Test - public void bindToArrayWhenNoValueShouldReturnUnbound() throws Exception { + public void bindToArrayWhenNoValueShouldReturnUnbound() { this.sources.add(new MockConfigurationPropertySource("faf.bar", "1")); BindResult result = this.binder.bind("foo", INTEGER_ARRAY); assertThat(result.isBound()).isFalse(); } @Test - public void bindToArrayShouldTriggerOnSuccess() throws Exception { + public void bindToArrayShouldTriggerOnSuccess() { this.sources.add(new MockConfigurationPropertySource("foo[0]", "1", "line1")); BindHandler handler = mock(BindHandler.class, withSettings().defaultAnswer(Answers.CALLS_REAL_METHODS)); @@ -224,14 +223,14 @@ public class ArrayBinderTests { } @Test - public void bindToArrayWhenCommaListShouldReturnPopulatedArray() throws Exception { + public void bindToArrayWhenCommaListShouldReturnPopulatedArray() { this.sources.add(new MockConfigurationPropertySource("foo", "1,2,3")); int[] result = this.binder.bind("foo", Bindable.of(int[].class)).get(); assertThat(result).containsExactly(1, 2, 3); } @Test - public void bindToArrayWhenCommaListAndIndexedShouldOnlyUseFirst() throws Exception { + public void bindToArrayWhenCommaListAndIndexedShouldOnlyUseFirst() { MockConfigurationPropertySource source1 = new MockConfigurationPropertySource(); source1.put("foo", "1,2"); this.sources.add(source1); @@ -243,7 +242,7 @@ public class ArrayBinderTests { } @Test - public void bindToArrayWhenIndexedAndCommaListShouldOnlyUseFirst() throws Exception { + public void bindToArrayWhenIndexedAndCommaListShouldOnlyUseFirst() { MockConfigurationPropertySource source1 = new MockConfigurationPropertySource(); source1.put("foo[0]", "1"); source1.put("foo[1]", "2"); @@ -255,14 +254,14 @@ public class ArrayBinderTests { } @Test - public void bindToArrayShouldBindCharArray() throws Exception { + public void bindToArrayShouldBindCharArray() { this.sources.add(new MockConfigurationPropertySource("foo", "word")); char[] result = this.binder.bind("foo", Bindable.of(char[].class)).get(); assertThat(result).containsExactly("word".toCharArray()); } @Test - public void bindToArrayWhenEmptyStringShouldReturnEmptyArray() throws Exception { + public void bindToArrayWhenEmptyStringShouldReturnEmptyArray() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo", ""); this.sources.add(source); @@ -271,7 +270,7 @@ public class ArrayBinderTests { } @Test - public void bindToArrayWhenHasSpacesShouldTrim() throws Exception { + public void bindToArrayWhenHasSpacesShouldTrim() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo", "1, 2,3"); this.sources.add(source); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BackCompatibilityBinderIntegrationTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BackCompatibilityBinderIntegrationTests.java index 59b0709cd4..e5b3eaaadd 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BackCompatibilityBinderIntegrationTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BackCompatibilityBinderIntegrationTests.java @@ -35,8 +35,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class BackCompatibilityBinderIntegrationTests { @Test - public void bindWhenBindingCamelCaseToEnvironmentWithExtractUnderscore() - throws Exception { + public void bindWhenBindingCamelCaseToEnvironmentWithExtractUnderscore() { // gh-10873 MockEnvironment environment = new MockEnvironment(); SystemEnvironmentPropertySource propertySource = new SystemEnvironmentPropertySource( diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BindResultTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BindResultTests.java index 1c4a67a68f..c81a38372c 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BindResultTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BindResultTests.java @@ -60,13 +60,13 @@ public class BindResultTests { } @Test - public void getWhenHasValueShouldReturnValue() throws Exception { + public void getWhenHasValueShouldReturnValue() { BindResult result = BindResult.of("foo"); assertThat(result.get()).isEqualTo("foo"); } @Test - public void getWhenHasNoValueShouldThrowException() throws Exception { + public void getWhenHasNoValueShouldThrowException() { BindResult result = BindResult.of(null); this.thrown.expect(NoSuchElementException.class); this.thrown.expectMessage("No value bound"); @@ -74,19 +74,19 @@ public class BindResultTests { } @Test - public void isBoundWhenHasValueShouldReturnTrue() throws Exception { + public void isBoundWhenHasValueShouldReturnTrue() { BindResult result = BindResult.of("foo"); assertThat(result.isBound()).isTrue(); } @Test - public void isBoundWhenHasNoValueShouldFalse() throws Exception { + public void isBoundWhenHasNoValueShouldFalse() { BindResult result = BindResult.of(null); assertThat(result.isBound()).isFalse(); } @Test - public void ifBoundWhenConsumerIsNullShouldThrowException() throws Exception { + public void ifBoundWhenConsumerIsNullShouldThrowException() { BindResult result = BindResult.of("foo"); this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Consumer must not be null"); @@ -94,21 +94,21 @@ public class BindResultTests { } @Test - public void ifBoundWhenHasValueShouldCallConsumer() throws Exception { + public void ifBoundWhenHasValueShouldCallConsumer() { BindResult result = BindResult.of("foo"); result.ifBound(this.consumer); verify(this.consumer).accept("foo"); } @Test - public void ifBoundWhenHasNoValueShouldNotCallConsumer() throws Exception { + public void ifBoundWhenHasNoValueShouldNotCallConsumer() { BindResult result = BindResult.of(null); result.ifBound(this.consumer); verifyZeroInteractions(this.consumer); } @Test - public void mapWhenMapperIsNullShouldThrowException() throws Exception { + public void mapWhenMapperIsNullShouldThrowException() { BindResult result = BindResult.of("foo"); this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Mapper must not be null"); @@ -116,47 +116,47 @@ public class BindResultTests { } @Test - public void mapWhenHasValueShouldCallMapper() throws Exception { + public void mapWhenHasValueShouldCallMapper() { BindResult result = BindResult.of("foo"); given(this.mapper.apply("foo")).willReturn("bar"); assertThat(result.map(this.mapper).get()).isEqualTo("bar"); } @Test - public void mapWhenHasNoValueShouldNotCallMapper() throws Exception { + public void mapWhenHasNoValueShouldNotCallMapper() { BindResult result = BindResult.of(null); result.map(this.mapper); verifyZeroInteractions(this.mapper); } @Test - public void orElseWhenHasValueShouldReturnValue() throws Exception { + public void orElseWhenHasValueShouldReturnValue() { BindResult result = BindResult.of("foo"); assertThat(result.orElse("bar")).isEqualTo("foo"); } @Test - public void orElseWhenHasValueNoShouldReturnOther() throws Exception { + public void orElseWhenHasValueNoShouldReturnOther() { BindResult result = BindResult.of(null); assertThat(result.orElse("bar")).isEqualTo("bar"); } @Test - public void orElseGetWhenHasValueShouldReturnValue() throws Exception { + public void orElseGetWhenHasValueShouldReturnValue() { BindResult result = BindResult.of("foo"); assertThat(result.orElseGet(this.supplier)).isEqualTo("foo"); verifyZeroInteractions(this.supplier); } @Test - public void orElseGetWhenHasValueNoShouldReturnOther() throws Exception { + public void orElseGetWhenHasValueNoShouldReturnOther() { BindResult result = BindResult.of(null); given(this.supplier.get()).willReturn("bar"); assertThat(result.orElseGet(this.supplier)).isEqualTo("bar"); } @Test - public void orElseCreateWhenTypeIsNullShouldThrowException() throws Exception { + public void orElseCreateWhenTypeIsNullShouldThrowException() { BindResult result = BindResult.of("foo"); this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Type must not be null"); @@ -164,13 +164,13 @@ public class BindResultTests { } @Test - public void orElseCreateWhenHasValueShouldReturnValue() throws Exception { + public void orElseCreateWhenHasValueShouldReturnValue() { BindResult result = BindResult.of(new ExampleBean("foo")); assertThat(result.orElseCreate(ExampleBean.class).getValue()).isEqualTo("foo"); } @Test - public void orElseCreateWhenHasValueNoShouldReturnCreatedValue() throws Exception { + public void orElseCreateWhenHasValueNoShouldReturnCreatedValue() { BindResult result = BindResult.of(null); assertThat(result.orElseCreate(ExampleBean.class).getValue()).isEqualTo("new"); } @@ -189,7 +189,7 @@ public class BindResultTests { } @Test - public void hashCodeAndEquals() throws Exception { + public void hashCodeAndEquals() { BindResult result1 = BindResult.of("foo"); BindResult result2 = BindResult.of("foo"); BindResult result3 = BindResult.of("bar"); @@ -200,14 +200,14 @@ public class BindResultTests { } @Test - public void ofWhenHasValueShouldReturnBoundResultOfValue() throws Exception { + public void ofWhenHasValueShouldReturnBoundResultOfValue() { BindResult result = BindResult.of("foo"); assertThat(result.isBound()).isTrue(); assertThat(result.get()).isEqualTo("foo"); } @Test - public void ofWhenValueIsNullShouldReturnUnbound() throws Exception { + public void ofWhenValueIsNullShouldReturnUnbound() { BindResult result = BindResult.of(null); assertThat(result.isBound()).isFalse(); assertThat(result).isSameAs(BindResult.of(null)); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BindableTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BindableTests.java index 5d726ee9be..1964aabbd1 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BindableTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BindableTests.java @@ -42,33 +42,33 @@ public class BindableTests { public ExpectedException thrown = ExpectedException.none(); @Test - public void ofClassWhenTypeIsNullShouldThrowException() throws Exception { + public void ofClassWhenTypeIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Type must not be null"); Bindable.of((Class) null); } @Test - public void ofTypeWhenTypeIsNullShouldThrowException() throws Exception { + public void ofTypeWhenTypeIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Type must not be null"); Bindable.of((ResolvableType) null); } @Test - public void ofClassShouldSetType() throws Exception { + public void ofClassShouldSetType() { assertThat(Bindable.of(String.class).getType()) .isEqualTo(ResolvableType.forClass(String.class)); } @Test - public void ofTypeShouldSetType() throws Exception { + public void ofTypeShouldSetType() { ResolvableType type = ResolvableType.forClass(String.class); assertThat(Bindable.of(type).getType()).isEqualTo(type); } @Test - public void ofInstanceShouldSetTypeAndExistingValue() throws Exception { + public void ofInstanceShouldSetTypeAndExistingValue() { String instance = "foo"; ResolvableType type = ResolvableType.forClass(String.class); assertThat(Bindable.ofInstance(instance).getType()).isEqualTo(type); @@ -76,20 +76,19 @@ public class BindableTests { } @Test - public void ofClassWithExistingValueShouldSetTypeAndExistingValue() throws Exception { + public void ofClassWithExistingValueShouldSetTypeAndExistingValue() { assertThat(Bindable.of(String.class).withExistingValue("foo").getValue().get()) .isEqualTo("foo"); } @Test - public void ofTypeWithExistingValueShouldSetTypeAndExistingValue() throws Exception { + public void ofTypeWithExistingValueShouldSetTypeAndExistingValue() { assertThat(Bindable.of(ResolvableType.forClass(String.class)) .withExistingValue("foo").getValue().get()).isEqualTo("foo"); } @Test - public void ofTypeWhenExistingValueIsNotInstanceOfTypeShouldThrowException() - throws Exception { + public void ofTypeWhenExistingValueIsNotInstanceOfTypeShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage( "ExistingValue must be an instance of " + String.class.getName()); @@ -97,8 +96,7 @@ public class BindableTests { } @Test - public void ofTypeWhenPrimitiveWithExistingValueWrapperShouldNotThrowException() - throws Exception { + public void ofTypeWhenPrimitiveWithExistingValueWrapperShouldNotThrowException() { Bindable bindable = Bindable .of(ResolvableType.forClass(int.class)).withExistingValue(123); assertThat(bindable.getType().resolve()).isEqualTo(int.class); @@ -106,14 +104,14 @@ public class BindableTests { } @Test - public void getBoxedTypeWhenNotBoxedShouldReturnType() throws Exception { + public void getBoxedTypeWhenNotBoxedShouldReturnType() { Bindable bindable = Bindable.of(String.class); assertThat(bindable.getBoxedType()) .isEqualTo(ResolvableType.forClass(String.class)); } @Test - public void getBoxedTypeWhenPrimitiveShouldReturnBoxedType() throws Exception { + public void getBoxedTypeWhenPrimitiveShouldReturnBoxedType() { Bindable bindable = Bindable.of(int.class); assertThat(bindable.getType()).isEqualTo(ResolvableType.forClass(int.class)); assertThat(bindable.getBoxedType()) @@ -121,7 +119,7 @@ public class BindableTests { } @Test - public void getBoxedTypeWhenPrimitiveArrayShouldReturnBoxedType() throws Exception { + public void getBoxedTypeWhenPrimitiveArrayShouldReturnBoxedType() { Bindable bindable = Bindable.of(int[].class); assertThat(bindable.getType().getComponentType()) .isEqualTo(ResolvableType.forClass(int.class)); @@ -131,19 +129,19 @@ public class BindableTests { } @Test - public void getAnnotationsShouldReturnEmptyArray() throws Exception { + public void getAnnotationsShouldReturnEmptyArray() { assertThat(Bindable.of(String.class).getAnnotations()).isEmpty(); } @Test - public void withAnnotationsShouldSetAnnotations() throws Exception { + public void withAnnotationsShouldSetAnnotations() { Annotation annotation = mock(Annotation.class); assertThat(Bindable.of(String.class).withAnnotations(annotation).getAnnotations()) .containsExactly(annotation); } @Test - public void toStringShouldShowDetails() throws Exception { + public void toStringShouldShowDetails() { Annotation annotation = AnnotationUtils .synthesizeAnnotation(TestAnnotation.class); Bindable bindable = Bindable.of(String.class).withExistingValue("foo") @@ -156,7 +154,7 @@ public class BindableTests { } @Test - public void equalsAndHashCode() throws Exception { + public void equalsAndHashCode() { Annotation annotation = AnnotationUtils .synthesizeAnnotation(TestAnnotation.class); Bindable bindable1 = Bindable.of(String.class).withExistingValue("foo") diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BinderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BinderTests.java index bb802e5c36..a648ad2542 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BinderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BinderTests.java @@ -79,14 +79,14 @@ public class BinderTests { } @Test - public void createWhenSourcesIsNullShouldThrowException() throws Exception { + public void createWhenSourcesIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Sources must not be null"); new Binder((Iterable) null); } @Test - public void bindWhenNameIsNullShouldThrowException() throws Exception { + public void bindWhenNameIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Name must not be null"); this.binder.bind((ConfigurationPropertyName) null, Bindable.of(String.class), @@ -94,28 +94,28 @@ public class BinderTests { } @Test - public void bindWhenTargetIsNullShouldThrowException() throws Exception { + public void bindWhenTargetIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Target must not be null"); this.binder.bind(ConfigurationPropertyName.of("foo"), null, BindHandler.DEFAULT); } @Test - public void bindToValueWhenPropertyIsMissingShouldReturnUnbound() throws Exception { + public void bindToValueWhenPropertyIsMissingShouldReturnUnbound() { this.sources.add(new MockConfigurationPropertySource()); BindResult result = this.binder.bind("foo", Bindable.of(String.class)); assertThat(result.isBound()).isFalse(); } @Test - public void bindToValueShouldReturnPropertyValue() throws Exception { + public void bindToValueShouldReturnPropertyValue() { this.sources.add(new MockConfigurationPropertySource("foo", 123)); BindResult result = this.binder.bind("foo", Bindable.of(Integer.class)); assertThat(result.get()).isEqualTo(123); } @Test - public void bindToValueShouldReturnPropertyValueFromSecondSource() throws Exception { + public void bindToValueShouldReturnPropertyValueFromSecondSource() { this.sources.add(new MockConfigurationPropertySource("foo", 123)); this.sources.add(new MockConfigurationPropertySource("bar", 234)); BindResult result = this.binder.bind("bar", Bindable.of(Integer.class)); @@ -123,14 +123,14 @@ public class BinderTests { } @Test - public void bindToValueShouldReturnConvertedPropertyValue() throws Exception { + public void bindToValueShouldReturnConvertedPropertyValue() { this.sources.add(new MockConfigurationPropertySource("foo", "123")); BindResult result = this.binder.bind("foo", Bindable.of(Integer.class)); assertThat(result.get()).isEqualTo(123); } @Test - public void bindToValueWhenMultipleCandidatesShouldReturnFirst() throws Exception { + public void bindToValueWhenMultipleCandidatesShouldReturnFirst() { this.sources.add(new MockConfigurationPropertySource("foo", 123)); this.sources.add(new MockConfigurationPropertySource("foo", 234)); BindResult result = this.binder.bind("foo", Bindable.of(Integer.class)); @@ -138,7 +138,7 @@ public class BinderTests { } @Test - public void bindToValueWithPlaceholdersShouldResolve() throws Exception { + public void bindToValueWithPlaceholdersShouldResolve() { StandardEnvironment environment = new StandardEnvironment(); TestPropertySourceUtils.addInlinedPropertiesToEnvironment(environment, "bar=23"); this.sources.add(new MockConfigurationPropertySource("foo", "1${bar}")); @@ -149,8 +149,7 @@ public class BinderTests { } @Test - public void bindToValueWithMissingPlaceholdersShouldThrowException() - throws Exception { + public void bindToValueWithMissingPlaceholdersShouldThrowException() { StandardEnvironment environment = new StandardEnvironment(); this.sources.add(new MockConfigurationPropertySource("foo", "${bar}")); this.binder = new Binder(this.sources, @@ -162,7 +161,7 @@ public class BinderTests { } @Test - public void bindToValueShouldTriggerOnSuccess() throws Exception { + public void bindToValueShouldTriggerOnSuccess() { this.sources.add(new MockConfigurationPropertySource("foo", "1", "line1")); BindHandler handler = mock(BindHandler.class, withSettings().defaultAnswer(Answers.CALLS_REAL_METHODS)); @@ -174,15 +173,14 @@ public class BinderTests { } @Test - public void bindToJavaBeanShouldReturnPopulatedBean() throws Exception { + public void bindToJavaBeanShouldReturnPopulatedBean() { this.sources.add(new MockConfigurationPropertySource("foo.value", "bar")); JavaBean result = this.binder.bind("foo", Bindable.of(JavaBean.class)).get(); assertThat(result.getValue()).isEqualTo("bar"); } @Test - public void bindToJavaBeanWhenNonIterableShouldReturnPopulatedBean() - throws Exception { + public void bindToJavaBeanWhenNonIterableShouldReturnPopulatedBean() { MockConfigurationPropertySource source = new MockConfigurationPropertySource( "foo.value", "bar"); this.sources.add(source.nonIterable()); @@ -191,8 +189,7 @@ public class BinderTests { } @Test - public void bindToJavaBeanWhenHasPropertyWithSameNameShouldStillBind() - throws Exception { + public void bindToJavaBeanWhenHasPropertyWithSameNameShouldStillBind() { // gh-10945 MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo", "boom"); @@ -203,7 +200,7 @@ public class BinderTests { } @Test - public void bindToJavaBeanShouldTriggerOnSuccess() throws Exception { + public void bindToJavaBeanShouldTriggerOnSuccess() { this.sources .add(new MockConfigurationPropertySource("foo.value", "bar", "line1")); BindHandler handler = mock(BindHandler.class, @@ -218,7 +215,7 @@ public class BinderTests { } @Test - public void bindWhenHasMalformedDateShouldThrowException() throws Exception { + public void bindWhenHasMalformedDateShouldThrowException() { this.thrown.expectCause(instanceOf(ConversionFailedException.class)); this.sources.add(new MockConfigurationPropertySource("foo", "2014-04-01T01:30:00.000-05:00")); @@ -226,7 +223,7 @@ public class BinderTests { } @Test - public void bindWhenHasAnnotationsShouldChangeConvertedValue() throws Exception { + public void bindWhenHasAnnotationsShouldChangeConvertedValue() { this.sources.add(new MockConfigurationPropertySource("foo", "2014-04-01T01:30:00.000-05:00")); DateTimeFormat annotation = AnnotationUtils.synthesizeAnnotation( @@ -239,8 +236,7 @@ public class BinderTests { } @Test - public void bindExceptionWhenBeanBindingFailsShouldHaveNullConfigurationProperty() - throws Exception { + public void bindExceptionWhenBeanBindingFailsShouldHaveNullConfigurationProperty() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.value", "hello"); source.put("foo.items", "bar,baz"); @@ -277,7 +273,7 @@ public class BinderTests { } @Test - public void bindToBeanWithCycle() throws Exception { + public void bindToBeanWithCycle() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); this.sources.add(source.nonIterable()); Bindable target = Bindable.of(CycleBean1.class); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/CollectionBinderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/CollectionBinderTests.java index 42feb24465..912409782f 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/CollectionBinderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/CollectionBinderTests.java @@ -65,7 +65,7 @@ public class CollectionBinderTests { } @Test - public void bindToCollectionShouldReturnPopulatedCollection() throws Exception { + public void bindToCollectionShouldReturnPopulatedCollection() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo[0]", "1"); source.put("foo[1]", "2"); @@ -76,7 +76,7 @@ public class CollectionBinderTests { } @Test - public void bindToSetShouldReturnPopulatedCollection() throws Exception { + public void bindToSetShouldReturnPopulatedCollection() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo[0]", "a"); source.put("foo[1]", "b"); @@ -87,8 +87,7 @@ public class CollectionBinderTests { } @Test - public void bindToCollectionWhenNestedShouldReturnPopulatedCollection() - throws Exception { + public void bindToCollectionWhenNestedShouldReturnPopulatedCollection() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo[0][0]", "1"); source.put("foo[0][1]", "2"); @@ -104,8 +103,7 @@ public class CollectionBinderTests { } @Test - public void bindToCollectionWhenNotInOrderShouldReturnPopulatedCollection() - throws Exception { + public void bindToCollectionWhenNotInOrderShouldReturnPopulatedCollection() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo[1]", "2"); source.put("foo[0]", "1"); @@ -116,7 +114,7 @@ public class CollectionBinderTests { } @Test - public void bindToCollectionWhenNonSequentialShouldThrowException() throws Exception { + public void bindToCollectionWhenNonSequentialShouldThrowException() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo[0]", "2"); source.put("foo[1]", "1"); @@ -138,8 +136,7 @@ public class CollectionBinderTests { } @Test - public void bindToCollectionWhenNonIterableShouldReturnPopulatedCollection() - throws Exception { + public void bindToCollectionWhenNonIterableShouldReturnPopulatedCollection() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo[1]", "2"); source.put("foo[0]", "1"); @@ -150,7 +147,7 @@ public class CollectionBinderTests { } @Test - public void bindToCollectionWhenMultipleSourceShouldOnlyUseFirst() throws Exception { + public void bindToCollectionWhenMultipleSourceShouldOnlyUseFirst() { MockConfigurationPropertySource source1 = new MockConfigurationPropertySource(); source1.put("bar", "baz"); this.sources.add(source1); @@ -168,8 +165,7 @@ public class CollectionBinderTests { } @Test - public void bindToCollectionWhenHasExistingCollectionShouldReplaceAllContents() - throws Exception { + public void bindToCollectionWhenHasExistingCollectionShouldReplaceAllContents() { this.sources.add(new MockConfigurationPropertySource("foo[0]", "1")); List existing = new LinkedList<>(); existing.add(1000); @@ -182,8 +178,7 @@ public class CollectionBinderTests { } @Test - public void bindToCollectionWhenHasExistingCollectionButNoValueShouldReturnUnbound() - throws Exception { + public void bindToCollectionWhenHasExistingCollectionButNoValueShouldReturnUnbound() { this.sources.add(new MockConfigurationPropertySource("faf[0]", "1")); List existing = new LinkedList<>(); existing.add(1000); @@ -193,7 +188,7 @@ public class CollectionBinderTests { } @Test - public void bindToCollectionShouldRespectCollectionType() throws Exception { + public void bindToCollectionShouldRespectCollectionType() { this.sources.add(new MockConfigurationPropertySource("foo[0]", "1")); ResolvableType type = ResolvableType.forClassWithGenerics(LinkedList.class, Integer.class); @@ -204,23 +199,21 @@ public class CollectionBinderTests { } @Test - public void bindToCollectionWhenNoValueShouldReturnUnbound() throws Exception { + public void bindToCollectionWhenNoValueShouldReturnUnbound() { this.sources.add(new MockConfigurationPropertySource("faf.bar", "1")); BindResult> result = this.binder.bind("foo", INTEGER_LIST); assertThat(result.isBound()).isFalse(); } @Test - public void bindToCollectionWhenCommaListShouldReturnPopulatedCollection() - throws Exception { + public void bindToCollectionWhenCommaListShouldReturnPopulatedCollection() { this.sources.add(new MockConfigurationPropertySource("foo", "1,2,3")); List result = this.binder.bind("foo", INTEGER_LIST).get(); assertThat(result).containsExactly(1, 2, 3); } @Test - public void bindToCollectionWhenCommaListWithPlaceholdersShouldReturnPopulatedCollection() - throws Exception { + public void bindToCollectionWhenCommaListWithPlaceholdersShouldReturnPopulatedCollection() { StandardEnvironment environment = new StandardEnvironment(); TestPropertySourceUtils.addInlinedPropertiesToEnvironment(environment, "bar=1,2,3"); @@ -233,8 +226,7 @@ public class CollectionBinderTests { } @Test - public void bindToCollectionWhenCommaListAndIndexedShouldOnlyUseFirst() - throws Exception { + public void bindToCollectionWhenCommaListAndIndexedShouldOnlyUseFirst() { MockConfigurationPropertySource source1 = new MockConfigurationPropertySource(); source1.put("foo", "1,2"); this.sources.add(source1); @@ -246,8 +238,7 @@ public class CollectionBinderTests { } @Test - public void bindToCollectionWhenIndexedAndCommaListShouldOnlyUseFirst() - throws Exception { + public void bindToCollectionWhenIndexedAndCommaListShouldOnlyUseFirst() { MockConfigurationPropertySource source1 = new MockConfigurationPropertySource(); source1.put("foo[0]", "1"); source1.put("foo[1]", "2"); @@ -259,8 +250,7 @@ public class CollectionBinderTests { } @Test - public void bindToCollectionWhenItemContainsCommasShouldReturnPopulatedCollection() - throws Exception { + public void bindToCollectionWhenItemContainsCommasShouldReturnPopulatedCollection() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo[0]", "1,2"); source.put("foo[1]", "3"); @@ -270,8 +260,7 @@ public class CollectionBinderTests { } @Test - public void bindToCollectionWhenEmptyStringShouldReturnEmptyCollection() - throws Exception { + public void bindToCollectionWhenEmptyStringShouldReturnEmptyCollection() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo", ""); this.sources.add(source); @@ -280,8 +269,7 @@ public class CollectionBinderTests { } @Test - public void bindToNonScalarCollectionShouldReturnPopulatedCollection() - throws Exception { + public void bindToNonScalarCollectionShouldReturnPopulatedCollection() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo[0].value", "a"); source.put("foo[1].value", "b"); @@ -296,8 +284,7 @@ public class CollectionBinderTests { } @Test - public void bindToImmutableCollectionShouldReturnPopulatedCollection() - throws Exception { + public void bindToImmutableCollectionShouldReturnPopulatedCollection() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.values", "a,b,c"); this.sources.add(source); @@ -308,7 +295,7 @@ public class CollectionBinderTests { } @Test - public void bindToCollectionShouldAlsoCallSetterIfPresent() throws Exception { + public void bindToCollectionShouldAlsoCallSetterIfPresent() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.items", "a,b,c"); this.sources.add(source); @@ -320,7 +307,7 @@ public class CollectionBinderTests { @Test @Ignore - public void bindToCollectionWithNoDefaultConstructor() throws Exception { + public void bindToCollectionWithNoDefaultConstructor() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.items", "a,b,c,c"); this.sources.add(source); @@ -330,7 +317,7 @@ public class CollectionBinderTests { } @Test - public void bindToListShouldAllowDuplicateValues() throws Exception { + public void bindToListShouldAllowDuplicateValues() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.items", "a,b,c,c"); this.sources.add(source); @@ -341,7 +328,7 @@ public class CollectionBinderTests { } @Test - public void bindToSetShouldNotAllowDuplicateValues() throws Exception { + public void bindToSetShouldNotAllowDuplicateValues() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.items-set", "a,b,c,c"); this.sources.add(source); @@ -352,8 +339,7 @@ public class CollectionBinderTests { } @Test - public void bindToBeanWithNestedCollectionShouldPopulateCollection() - throws Exception { + public void bindToBeanWithNestedCollectionShouldPopulateCollection() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.value", "one"); source.put("foo.foos[0].value", "two"); @@ -368,8 +354,7 @@ public class CollectionBinderTests { } @Test - public void bindToBeanWithNestedCollectionAndNonIterableSourceShouldNotFail() - throws Exception { + public void bindToBeanWithNestedCollectionAndNonIterableSourceShouldNotFail() { // gh-10702 MockConfigurationPropertySource source = new MockConfigurationPropertySource(); this.sources.add(source.nonIterable()); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/JavaBeanBinderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/JavaBeanBinderTests.java index 199bd279f2..31c42c80b2 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/JavaBeanBinderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/JavaBeanBinderTests.java @@ -61,7 +61,7 @@ public class JavaBeanBinderTests { } @Test - public void bindToClassShouldCreateBoundBean() throws Exception { + public void bindToClassShouldCreateBoundBean() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.int-value", "12"); source.put("foo.long-value", "34"); @@ -77,7 +77,7 @@ public class JavaBeanBinderTests { } @Test - public void bindToClassWhenHasNoPrefixShouldCreateBoundBean() throws Exception { + public void bindToClassWhenHasNoPrefixShouldCreateBoundBean() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("int-value", "12"); source.put("long-value", "34"); @@ -93,7 +93,7 @@ public class JavaBeanBinderTests { } @Test - public void bindToInstanceShouldBindToInstance() throws Exception { + public void bindToInstanceShouldBindToInstance() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.int-value", "12"); source.put("foo.long-value", "34"); @@ -112,7 +112,7 @@ public class JavaBeanBinderTests { } @Test - public void bindToInstanceWithNoPropertiesShouldReturnUnbound() throws Exception { + public void bindToInstanceWithNoPropertiesShouldReturnUnbound() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); this.sources.add(source); ExampleDefaultsBean bean = new ExampleDefaultsBean(); @@ -124,7 +124,7 @@ public class JavaBeanBinderTests { } @Test - public void bindToClassShouldLeaveDefaults() throws Exception { + public void bindToClassShouldLeaveDefaults() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.bar", "999"); this.sources.add(source); @@ -135,7 +135,7 @@ public class JavaBeanBinderTests { } @Test - public void bindToExistingInstanceShouldLeaveDefaults() throws Exception { + public void bindToExistingInstanceShouldLeaveDefaults() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.bar", "999"); this.sources.add(source); @@ -151,7 +151,7 @@ public class JavaBeanBinderTests { } @Test - public void bindToClassShouldBindToMap() throws Exception { + public void bindToClassShouldBindToMap() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.map.foo-bar", "1"); source.put("foo.map.bar-baz", "2"); @@ -163,7 +163,7 @@ public class JavaBeanBinderTests { } @Test - public void bindToClassShouldBindToList() throws Exception { + public void bindToClassShouldBindToList() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.list[0]", "foo-bar"); source.put("foo.list[1]", "bar-baz"); @@ -175,8 +175,7 @@ public class JavaBeanBinderTests { } @Test - public void bindToListIfUnboundElementsPresentShouldThrowException() - throws Exception { + public void bindToListIfUnboundElementsPresentShouldThrowException() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.list[0]", "foo-bar"); source.put("foo.list[2]", "bar-baz"); @@ -188,7 +187,7 @@ public class JavaBeanBinderTests { } @Test - public void bindToClassShouldBindToSet() throws Exception { + public void bindToClassShouldBindToSet() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.set[0]", "foo-bar"); source.put("foo.set[1]", "bar-baz"); @@ -200,7 +199,7 @@ public class JavaBeanBinderTests { } @Test - public void bindToClassShouldBindToCollection() throws Exception { + public void bindToClassShouldBindToCollection() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.collection[0]", "foo-bar"); source.put("foo.collection[1]", "bar-baz"); @@ -212,7 +211,7 @@ public class JavaBeanBinderTests { } @Test - public void bindToClassWhenHasNoSetterShouldBindToMap() throws Exception { + public void bindToClassWhenHasNoSetterShouldBindToMap() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.map.foo-bar", "1"); source.put("foo.map.bar-baz", "2"); @@ -224,7 +223,7 @@ public class JavaBeanBinderTests { } @Test - public void bindToClassWhenHasNoSetterShouldBindToList() throws Exception { + public void bindToClassWhenHasNoSetterShouldBindToList() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.list[0]", "foo-bar"); source.put("foo.list[1]", "bar-baz"); @@ -236,7 +235,7 @@ public class JavaBeanBinderTests { } @Test - public void bindToClassWhenHasNoSetterShouldBindToSet() throws Exception { + public void bindToClassWhenHasNoSetterShouldBindToSet() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.set[0]", "foo-bar"); source.put("foo.set[1]", "bar-baz"); @@ -248,7 +247,7 @@ public class JavaBeanBinderTests { } @Test - public void bindToClassWhenHasNoSetterShouldBindToCollection() throws Exception { + public void bindToClassWhenHasNoSetterShouldBindToCollection() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.collection[0]", "foo-bar"); source.put("foo.collection[1]", "bar-baz"); @@ -260,7 +259,7 @@ public class JavaBeanBinderTests { } @Test - public void bindToClassShouldBindNested() throws Exception { + public void bindToClassShouldBindNested() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.value-bean.int-value", "123"); source.put("foo.value-bean.string-value", "foo"); @@ -272,8 +271,7 @@ public class JavaBeanBinderTests { } @Test - public void bindToClassWhenIterableShouldBindNestedBasedOnInstance() - throws Exception { + public void bindToClassWhenIterableShouldBindNestedBasedOnInstance() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.value-bean.int-value", "123"); source.put("foo.value-bean.string-value", "foo"); @@ -287,8 +285,7 @@ public class JavaBeanBinderTests { } @Test - public void bindToClassWhenNotIterableShouldNotBindNestedBasedOnInstance() - throws Exception { + public void bindToClassWhenNotIterableShouldNotBindNestedBasedOnInstance() { // If we can't tell that binding will happen, we don't want to randomly invoke // getters on the class and cause side effects MockConfigurationPropertySource source = new MockConfigurationPropertySource(); @@ -301,7 +298,7 @@ public class JavaBeanBinderTests { } @Test - public void bindToClassWhenHasNoSetterShouldBindNested() throws Exception { + public void bindToClassWhenHasNoSetterShouldBindNested() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.value-bean.int-value", "123"); source.put("foo.value-bean.string-value", "foo"); @@ -313,8 +310,7 @@ public class JavaBeanBinderTests { } @Test - public void bindToClassWhenHasNoSetterAndImmutableShouldThrowException() - throws Exception { + public void bindToClassWhenHasNoSetterAndImmutableShouldThrowException() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.nested.foo", "bar"); this.sources.add(source); @@ -324,7 +320,7 @@ public class JavaBeanBinderTests { } @Test - public void bindToInstanceWhenNoNestedShouldLeaveNestedAsNull() throws Exception { + public void bindToInstanceWhenNoNestedShouldLeaveNestedAsNull() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("faf.value-bean.int-value", "123"); this.sources.add(source); @@ -336,7 +332,7 @@ public class JavaBeanBinderTests { } @Test - public void bindToClassWhenPropertiesMissingShouldReturnUnbound() throws Exception { + public void bindToClassWhenPropertiesMissingShouldReturnUnbound() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("faf.int-value", "12"); this.sources.add(source); @@ -346,8 +342,7 @@ public class JavaBeanBinderTests { } @Test - public void bindToClassWhenNoDefaultConstructorShouldReturnUnbound() - throws Exception { + public void bindToClassWhenNoDefaultConstructorShouldReturnUnbound() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.value", "bar"); this.sources.add(source); @@ -357,7 +352,7 @@ public class JavaBeanBinderTests { } @Test - public void bindToInstanceWhenNoDefaultConstructorShouldBind() throws Exception { + public void bindToInstanceWhenNoDefaultConstructorShouldBind() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.value", "bar"); this.sources.add(source); @@ -371,7 +366,7 @@ public class JavaBeanBinderTests { } @Test - public void bindToClassShouldBindHierarchy() throws Exception { + public void bindToClassShouldBindHierarchy() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.int-value", "123"); source.put("foo.long-value", "456"); @@ -383,16 +378,14 @@ public class JavaBeanBinderTests { } @Test - public void bindToClassWhenPropertyCannotBeConvertedShouldThrowException() - throws Exception { + public void bindToClassWhenPropertyCannotBeConvertedShouldThrowException() { this.sources.add(new MockConfigurationPropertySource("foo.int-value", "foo")); this.thrown.expect(BindException.class); this.binder.bind("foo", Bindable.of(ExampleValueBean.class)); } @Test - public void bindToClassWhenPropertyCannotBeConvertedAndIgnoreErrorsShouldNotSetValue() - throws Exception { + public void bindToClassWhenPropertyCannotBeConvertedAndIgnoreErrorsShouldNotSetValue() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.int-value", "12"); source.put("foo.long-value", "bang"); @@ -409,7 +402,7 @@ public class JavaBeanBinderTests { } @Test - public void bindToClassWhenMismatchedGetSetShouldBind() throws Exception { + public void bindToClassWhenMismatchedGetSetShouldBind() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.value", "123"); this.sources.add(source); @@ -419,7 +412,7 @@ public class JavaBeanBinderTests { } @Test - public void bindToClassShouldNotInvokeExtraMethods() throws Exception { + public void bindToClassShouldNotInvokeExtraMethods() { MockConfigurationPropertySource source = new MockConfigurationPropertySource( "foo.value", "123"); this.sources.add(source.nonIterable()); @@ -429,7 +422,7 @@ public class JavaBeanBinderTests { } @Test - public void bindToClassWithSelfReferenceShouldBind() throws Exception { + public void bindToClassWithSelfReferenceShouldBind() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.value", "123"); this.sources.add(source); @@ -439,7 +432,7 @@ public class JavaBeanBinderTests { } @Test - public void bindToInstanceWithExistingValueShouldReturnUnbound() throws Exception { + public void bindToInstanceWithExistingValueShouldReturnUnbound() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); this.sources.add(source); ExampleNestedBean existingValue = new ExampleNestedBean(); @@ -451,7 +444,7 @@ public class JavaBeanBinderTests { } @Test - public void bindWithAnnotations() throws Exception { + public void bindWithAnnotations() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.date", "2014-04-01"); this.sources.add(source); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/MapBinderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/MapBinderTests.java index 6944c54100..be7c39de7b 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/MapBinderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/MapBinderTests.java @@ -82,7 +82,7 @@ public class MapBinderTests { } @Test - public void bindToMapShouldReturnPopulatedMap() throws Exception { + public void bindToMapShouldReturnPopulatedMap() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.bar", "1"); source.put("foo.[baz]", "2"); @@ -97,7 +97,7 @@ public class MapBinderTests { @Test @SuppressWarnings("unchecked") - public void bindToMapWithEmptyPrefix() throws Exception { + public void bindToMapWithEmptyPrefix() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.bar", "1"); this.sources.add(source); @@ -106,7 +106,7 @@ public class MapBinderTests { } @Test - public void bindToMapShouldConvertMapValue() throws Exception { + public void bindToMapShouldConvertMapValue() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.bar", "1"); source.put("foo.[baz]", "2"); @@ -121,7 +121,7 @@ public class MapBinderTests { } @Test - public void bindToMapShouldBindToMapValue() throws Exception { + public void bindToMapShouldBindToMapValue() { ResolvableType type = ResolvableType.forClassWithGenerics(Map.class, ResolvableType.forClass(String.class), STRING_INTEGER_MAP.getType()); MockConfigurationPropertySource source = new MockConfigurationPropertySource(); @@ -139,7 +139,7 @@ public class MapBinderTests { } @Test - public void bindToMapShouldBindNestedMapValue() throws Exception { + public void bindToMapShouldBindNestedMapValue() { ResolvableType nestedType = ResolvableType.forClassWithGenerics(Map.class, ResolvableType.forClass(String.class), STRING_INTEGER_MAP.getType()); ResolvableType type = ResolvableType.forClassWithGenerics(Map.class, @@ -163,7 +163,7 @@ public class MapBinderTests { @Test @SuppressWarnings("unchecked") - public void bindToMapWhenMapValueIsObjectShouldBindNestedMapValue() throws Exception { + public void bindToMapWhenMapValueIsObjectShouldBindNestedMapValue() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.nested.bar.baz", "1"); source.put("foo.nested.bar.bin", "2"); @@ -182,8 +182,7 @@ public class MapBinderTests { } @Test - public void bindToMapWhenMapValueIsObjectAndNoRootShouldBindNestedMapValue() - throws Exception { + public void bindToMapWhenMapValueIsObjectAndNoRootShouldBindNestedMapValue() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("commit.id", "abcdefg"); source.put("branch", "master"); @@ -198,7 +197,7 @@ public class MapBinderTests { } @Test - public void bindToMapWhenEmptyRootNameShouldBindMap() throws Exception { + public void bindToMapWhenEmptyRootNameShouldBindMap() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("bar.baz", "1"); source.put("bar.bin", "2"); @@ -209,7 +208,7 @@ public class MapBinderTests { } @Test - public void bindToMapWhenMultipleCandidateShouldBindFirst() throws Exception { + public void bindToMapWhenMultipleCandidateShouldBindFirst() { MockConfigurationPropertySource source1 = new MockConfigurationPropertySource(); source1.put("foo.bar", "1"); source1.put("foo.baz", "2"); @@ -226,8 +225,7 @@ public class MapBinderTests { } @Test - public void bindToMapWhenMultipleInSameSourceCandidateShouldBindFirst() - throws Exception { + public void bindToMapWhenMultipleInSameSourceCandidateShouldBindFirst() { Map map = new HashMap<>(); map.put("foo.bar", "1"); map.put("foo.b-az", "2"); @@ -245,8 +243,7 @@ public class MapBinderTests { } @Test - public void bindToMapWhenHasExistingMapShouldReplaceOnlyNewContents() - throws Exception { + public void bindToMapWhenHasExistingMapShouldReplaceOnlyNewContents() { this.sources.add(new MockConfigurationPropertySource("foo.bar", "1")); Map existing = new HashMap<>(); existing.put("bar", 1000); @@ -262,7 +259,7 @@ public class MapBinderTests { } @Test - public void bindToMapShouldRespectMapType() throws Exception { + public void bindToMapShouldRespectMapType() { this.sources.add(new MockConfigurationPropertySource("foo.bar", "1")); ResolvableType type = ResolvableType.forClassWithGenerics(HashMap.class, String.class, Integer.class); @@ -273,7 +270,7 @@ public class MapBinderTests { } @Test - public void bindToMapWhenNoValueShouldReturnUnbound() throws Exception { + public void bindToMapWhenNoValueShouldReturnUnbound() { this.sources.add(new MockConfigurationPropertySource("faf.bar", "1")); BindResult> result = this.binder.bind("foo", STRING_INTEGER_MAP); @@ -281,7 +278,7 @@ public class MapBinderTests { } @Test - public void bindToMapShouldConvertKey() throws Exception { + public void bindToMapShouldConvertKey() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo[0]", "1"); source.put("foo[1]", "2"); @@ -295,7 +292,7 @@ public class MapBinderTests { } @Test - public void bindToMapShouldBeGreedyForStrings() throws Exception { + public void bindToMapShouldBeGreedyForStrings() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.aaa.bbb.ccc", "b"); source.put("foo.bbb.ccc.ddd", "a"); @@ -309,7 +306,7 @@ public class MapBinderTests { } @Test - public void bindToMapShouldBeGreedyForScalars() throws Exception { + public void bindToMapShouldBeGreedyForScalars() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.aaa.bbb.ccc", "foo-bar"); source.put("foo.bbb.ccc.ddd", "BAR_BAZ"); @@ -324,7 +321,7 @@ public class MapBinderTests { } @Test - public void bindToMapWithPlaceholdersShouldBeGreedyForScalars() throws Exception { + public void bindToMapWithPlaceholdersShouldBeGreedyForScalars() { StandardEnvironment environment = new StandardEnvironment(); TestPropertySourceUtils.addInlinedPropertiesToEnvironment(environment, "foo=boo"); MockConfigurationPropertySource source = new MockConfigurationPropertySource( @@ -338,7 +335,7 @@ public class MapBinderTests { } @Test - public void bindToMapWithNoPropertiesShouldReturnUnbound() throws Exception { + public void bindToMapWithNoPropertiesShouldReturnUnbound() { this.binder = new Binder(this.sources); BindResult> result = this.binder.bind("foo", Bindable.mapOf(String.class, ExampleEnum.class)); @@ -346,7 +343,7 @@ public class MapBinderTests { } @Test - public void bindToMapShouldTriggerOnSuccess() throws Exception { + public void bindToMapShouldTriggerOnSuccess() { this.sources.add(new MockConfigurationPropertySource("foo.bar", "1", "line1")); BindHandler handler = mock(BindHandler.class, withSettings().defaultAnswer(Answers.CALLS_REAL_METHODS)); @@ -360,7 +357,7 @@ public class MapBinderTests { } @Test - public void bindToMapStringArrayShouldTriggerOnSuccess() throws Exception { + public void bindToMapStringArrayShouldTriggerOnSuccess() { this.sources .add(new MockConfigurationPropertySource("foo.bar", "a,b,c", "line1")); BindHandler handler = mock(BindHandler.class, @@ -377,7 +374,7 @@ public class MapBinderTests { } @Test - public void bindToMapNonScalarCollectionShouldPopulateMap() throws Exception { + public void bindToMapNonScalarCollectionShouldPopulateMap() { Bindable> valueType = Bindable.listOf(JavaBean.class); Bindable>> target = getMapBindable(String.class, valueType.getType()); @@ -394,7 +391,7 @@ public class MapBinderTests { } @Test - public void bindToPropertiesShouldBeEquivalentToMapOfStringString() throws Exception { + public void bindToPropertiesShouldBeEquivalentToMapOfStringString() { this.sources .add(new MockConfigurationPropertySource("foo.bar.baz", "1", "line1")); Bindable target = Bindable.of(Properties.class); @@ -403,8 +400,7 @@ public class MapBinderTests { } @Test - public void bindToMapShouldNotTreatClassWithStringConstructorAsScalar() - throws Exception { + public void bindToMapShouldNotTreatClassWithStringConstructorAsScalar() { this.sources.add( new MockConfigurationPropertySource("foo.bar.pattern", "1", "line1")); Bindable> target = Bindable.mapOf(String.class, Foo.class); @@ -413,7 +409,7 @@ public class MapBinderTests { } @Test - public void bindToMapStringArrayWithDotKeysShouldPreserveDot() throws Exception { + public void bindToMapStringArrayWithDotKeysShouldPreserveDot() { MockConfigurationPropertySource mockSource = new MockConfigurationPropertySource(); mockSource.put("foo.bar.baz[0]", "a"); mockSource.put("foo.bar.baz[1]", "b"); @@ -424,8 +420,7 @@ public class MapBinderTests { } @Test - public void bindToMapStringArrayWithDotKeysAndCommaSeparatedShouldPreserveDot() - throws Exception { + public void bindToMapStringArrayWithDotKeysAndCommaSeparatedShouldPreserveDot() { MockConfigurationPropertySource mockSource = new MockConfigurationPropertySource(); mockSource.put("foo.bar.baz", "a,b,c"); this.sources.add(mockSource); @@ -434,7 +429,7 @@ public class MapBinderTests { } @Test - public void bindToMapStringCollectionWithDotKeysShouldPreserveDot() throws Exception { + public void bindToMapStringCollectionWithDotKeysShouldPreserveDot() { Bindable> valueType = Bindable.listOf(String.class); Bindable>> target = getMapBindable(String.class, valueType.getType()); @@ -449,7 +444,7 @@ public class MapBinderTests { } @Test - public void bindToMapNonScalarCollectionWithDotKeysShouldBind() throws Exception { + public void bindToMapNonScalarCollectionWithDotKeysShouldBind() { Bindable> valueType = Bindable.listOf(JavaBean.class); Bindable>> target = getMapBindable(String.class, valueType.getType()); @@ -465,7 +460,7 @@ public class MapBinderTests { } @Test - public void bindToListOfMaps() throws Exception { + public void bindToListOfMaps() { Bindable> listBindable = Bindable.listOf(Integer.class); Bindable>> mapBindable = getMapBindable(String.class, listBindable.getType()); @@ -481,7 +476,7 @@ public class MapBinderTests { } @Test - public void bindToMapWithNumberKeyAndCommaSeparated() throws Exception { + public void bindToMapWithNumberKeyAndCommaSeparated() { Bindable> listBindable = Bindable.listOf(String.class); Bindable>> target = getMapBindable(Integer.class, listBindable.getType()); @@ -495,7 +490,7 @@ public class MapBinderTests { } @Test - public void bindToMapWithNumberKeyAndIndexed() throws Exception { + public void bindToMapWithNumberKeyAndIndexed() { Bindable> listBindable = Bindable.listOf(Integer.class); Bindable>> target = getMapBindable(Integer.class, listBindable.getType()); @@ -508,7 +503,7 @@ public class MapBinderTests { } @Test - public void bindingWithSquareBracketMap() throws Exception { + public void bindingWithSquareBracketMap() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.[x [B] y]", "[ball]"); this.sources.add(source); @@ -517,7 +512,7 @@ public class MapBinderTests { } @Test - public void nestedMapsShouldNotBindToNull() throws Exception { + public void nestedMapsShouldNotBindToNull() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.value", "one"); source.put("foo.foos.foo1.value", "two"); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/PropertySourcesPlaceholdersResolverTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/PropertySourcesPlaceholdersResolverTests.java index 2bcbf40e5e..3b93f4cb1c 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/PropertySourcesPlaceholdersResolverTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/PropertySourcesPlaceholdersResolverTests.java @@ -45,8 +45,7 @@ public class PropertySourcesPlaceholdersResolverTests { public ExpectedException thrown = ExpectedException.none(); @Test - public void placeholderResolverIfEnvironmentNullShouldThrowException() - throws Exception { + public void placeholderResolverIfEnvironmentNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Environment must not be null"); new PropertySourcesPlaceholdersResolver((Environment) null); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/ResolvableTypeDescriptorTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/ResolvableTypeDescriptorTests.java index 17fc48c2d6..fa8708bf51 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/ResolvableTypeDescriptorTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/ResolvableTypeDescriptorTests.java @@ -35,7 +35,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class ResolvableTypeDescriptorTests { @Test - public void forBindableShouldIncludeType() throws Exception { + public void forBindableShouldIncludeType() { ResolvableType type = ResolvableType.forClassWithGenerics(List.class, String.class); Bindable bindable = Bindable.of(type); @@ -44,7 +44,7 @@ public class ResolvableTypeDescriptorTests { } @Test - public void forBindableShouldIncludeAnnotations() throws Exception { + public void forBindableShouldIncludeAnnotations() { Annotation annotation = AnnotationUtils.synthesizeAnnotation(Test.class); Bindable bindable = Bindable.of(String.class).withAnnotations(annotation); TypeDescriptor descriptor = ResolvableTypeDescriptor.forBindable(bindable); @@ -52,7 +52,7 @@ public class ResolvableTypeDescriptorTests { } @Test - public void forTypeShouldIncludeType() throws Exception { + public void forTypeShouldIncludeType() { ResolvableType type = ResolvableType.forClassWithGenerics(List.class, String.class); TypeDescriptor descriptor = ResolvableTypeDescriptor.forType(type); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/convert/BinderConversionServiceTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/convert/BinderConversionServiceTests.java index a785ce88eb..1505138dd9 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/convert/BinderConversionServiceTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/convert/BinderConversionServiceTests.java @@ -51,8 +51,7 @@ public class BinderConversionServiceTests { } @Test - public void createConversionServiceShouldAcceptNullConversionService() - throws Exception { + public void createConversionServiceShouldAcceptNullConversionService() { BinderConversionService service = new BinderConversionService(null); assertThat(service.canConvert(String.class, TestEnum.class)).isTrue(); assertThat(service.canConvert(TypeDescriptor.valueOf(String.class), @@ -63,7 +62,7 @@ public class BinderConversionServiceTests { } @Test - public void canConvertShouldDelegateToConversionService() throws Exception { + public void canConvertShouldDelegateToConversionService() { Class from = String.class; Class to = InputStream.class; given(this.delegate.canConvert(from, to)).willReturn(true); @@ -72,8 +71,7 @@ public class BinderConversionServiceTests { } @Test - public void canConvertTypeDescriptorShouldDelegateToConversionService() - throws Exception { + public void canConvertTypeDescriptorShouldDelegateToConversionService() { TypeDescriptor from = TypeDescriptor.valueOf(String.class); TypeDescriptor to = TypeDescriptor.valueOf(InputStream.class); given(this.delegate.canConvert(from, to)).willReturn(true); @@ -82,7 +80,7 @@ public class BinderConversionServiceTests { } @Test - public void convertShouldDelegateToConversionService() throws Exception { + public void convertShouldDelegateToConversionService() { String from = "foo"; InputStream to = mock(InputStream.class); given(this.delegate.convert(from, InputStream.class)).willReturn(to); @@ -91,7 +89,7 @@ public class BinderConversionServiceTests { } @Test - public void convertTargetTypeShouldDelegateToConversionService() throws Exception { + public void convertTargetTypeShouldDelegateToConversionService() { String from = "foo"; InputStream to = mock(InputStream.class); TypeDescriptor fromType = TypeDescriptor.valueOf(String.class); @@ -102,7 +100,7 @@ public class BinderConversionServiceTests { } @Test - public void convertShouldSwallowDelegateConversionFailedException() throws Exception { + public void convertShouldSwallowDelegateConversionFailedException() { given(this.delegate.convert("one", TestEnum.class)) .willThrow(new ConversionFailedException(null, null, null, null)); assertThat(this.service.convert("one", TestEnum.class)).isEqualTo(TestEnum.ONE); @@ -110,7 +108,7 @@ public class BinderConversionServiceTests { } @Test - public void conversionServiceShouldSupportEnums() throws Exception { + public void conversionServiceShouldSupportEnums() { this.service = new BinderConversionService(null); assertThat(this.service.canConvert(String.class, TestEnum.class)).isTrue(); assertThat(this.service.convert("one", TestEnum.class)).isEqualTo(TestEnum.ONE); @@ -118,7 +116,7 @@ public class BinderConversionServiceTests { } @Test - public void conversionServiceShouldSupportStringToCharArray() throws Exception { + public void conversionServiceShouldSupportStringToCharArray() { this.service = new BinderConversionService(null); assertThat(this.service.canConvert(String.class, char[].class)).isTrue(); assertThat(this.service.convert("test", char[].class)).containsExactly('t', 'e', @@ -126,19 +124,19 @@ public class BinderConversionServiceTests { } @Test - public void conversionServiceShouldSupportStringToInetAddress() throws Exception { + public void conversionServiceShouldSupportStringToInetAddress() { this.service = new BinderConversionService(null); assertThat(this.service.canConvert(String.class, InetAddress.class)).isTrue(); } @Test - public void conversionServiceShouldSupportInetAddressToString() throws Exception { + public void conversionServiceShouldSupportInetAddressToString() { this.service = new BinderConversionService(null); assertThat(this.service.canConvert(InetAddress.class, String.class)).isTrue(); } @Test - public void conversionServiceShouldSupportStringToResource() throws Exception { + public void conversionServiceShouldSupportStringToResource() { this.service = new BinderConversionService(null); Resource resource = this.service.convert( "org/springframework/boot/context/properties/bind/convert/resource.txt", @@ -147,7 +145,7 @@ public class BinderConversionServiceTests { } @Test - public void conversionServiceShouldSupportStringToClass() throws Exception { + public void conversionServiceShouldSupportStringToClass() { this.service = new BinderConversionService(null); Class converted = this.service.convert(InputStream.class.getName(), Class.class); @@ -155,14 +153,14 @@ public class BinderConversionServiceTests { } @Test - public void conversionServiceShouldSupportStringToDuration() throws Exception { + public void conversionServiceShouldSupportStringToDuration() { this.service = new BinderConversionService(null); Duration converted = this.service.convert("10s", Duration.class); assertThat(converted).isEqualTo(Duration.ofSeconds(10)); } @Test - public void conversionServiceShouldSupportIntegerToDuration() throws Exception { + public void conversionServiceShouldSupportIntegerToDuration() { this.service = new BinderConversionService(null); Duration converted = this.service.convert(10, Duration.class); assertThat(converted).isEqualTo(Duration.ofMillis(10)); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/convert/DurationConverterTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/convert/DurationConverterTests.java index 751ae8f2f1..7742fea0d7 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/convert/DurationConverterTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/convert/DurationConverterTests.java @@ -44,7 +44,7 @@ public class DurationConverterTests { private DurationConverter converter = new DurationConverter(); @Test - public void convertWhenIso8601ShouldReturnDuration() throws Exception { + public void convertWhenIso8601ShouldReturnDuration() { assertThat(convert("PT20.345S")).isEqualTo(Duration.parse("PT20.345S")); assertThat(convert("PT15M")).isEqualTo(Duration.parse("PT15M")); assertThat(convert("+PT15M")).isEqualTo(Duration.parse("PT15M")); @@ -105,29 +105,28 @@ public class DurationConverterTests { } @Test - public void convertWhenSimpleWithoutSuffixShouldReturnDuration() throws Exception { + public void convertWhenSimpleWithoutSuffixShouldReturnDuration() { assertThat(convert("10")).isEqualTo(Duration.ofMillis(10)); assertThat(convert("+10")).isEqualTo(Duration.ofMillis(10)); assertThat(convert("-10")).isEqualTo(Duration.ofMillis(-10)); } @Test - public void convertWhenSimpleWithoutSuffixButWithAnnotationShouldReturnDuration() - throws Exception { + public void convertWhenSimpleWithoutSuffixButWithAnnotationShouldReturnDuration() { assertThat(convert("10", ChronoUnit.SECONDS)).isEqualTo(Duration.ofSeconds(10)); assertThat(convert("+10", ChronoUnit.SECONDS)).isEqualTo(Duration.ofSeconds(10)); assertThat(convert("-10", ChronoUnit.SECONDS)).isEqualTo(Duration.ofSeconds(-10)); } @Test - public void convertWhenBadFormatShouldThrowException() throws Exception { + public void convertWhenBadFormatShouldThrowException() { this.thrown.expect(IllegalStateException.class); this.thrown.expectMessage("'10foo' is not a valid duration"); convert("10foo"); } @Test - public void convertWhenEmptyShouldReturnNull() throws Exception { + public void convertWhenEmptyShouldReturnNull() { assertThat(convert("")).isNull(); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/convert/PropertyEditorConverterTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/convert/PropertyEditorConverterTests.java index 0e3b6fcf8e..e7c27e3352 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/convert/PropertyEditorConverterTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/convert/PropertyEditorConverterTests.java @@ -52,7 +52,7 @@ public class PropertyEditorConverterTests { } @Test - public void convertShouldSupportConventionBasedEditors() throws Exception { + public void convertShouldSupportConventionBasedEditors() { String source = "org/springframework/boot/context/properties/bind/convert/resource.txt"; TypeDescriptor sourceType = TypeDescriptor.forObject(source); TypeDescriptor targetType = TypeDescriptor.valueOf(Resource.class); @@ -63,7 +63,7 @@ public class PropertyEditorConverterTests { } @Test - public void convertShouldSupportDefaultEditors() throws Exception { + public void convertShouldSupportDefaultEditors() { String source = "en_UK"; TypeDescriptor sourceType = TypeDescriptor.forObject(source); TypeDescriptor targetType = TypeDescriptor.valueOf(Locale.class); @@ -74,7 +74,7 @@ public class PropertyEditorConverterTests { } @Test - public void matchShouldNotMatchCollection() throws Exception { + public void matchShouldNotMatchCollection() { TypeDescriptor sourceType = TypeDescriptor.valueOf(String.class); assertThat(this.converter.matches(sourceType, TypeDescriptor.valueOf(Collection.class))).isFalse(); @@ -85,7 +85,7 @@ public class PropertyEditorConverterTests { } @Test - public void matchShouldNotMatchMap() throws Exception { + public void matchShouldNotMatchMap() { TypeDescriptor sourceType = TypeDescriptor.valueOf(String.class); assertThat(this.converter.matches(sourceType, TypeDescriptor.valueOf(Map.class))) .isFalse(); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/convert/StringToCharArrayConverterTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/convert/StringToCharArrayConverterTests.java index a880d56e0d..cd7b5dbf97 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/convert/StringToCharArrayConverterTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/convert/StringToCharArrayConverterTests.java @@ -30,7 +30,7 @@ public class StringToCharArrayConverterTests { private StringToCharArrayConverter converter = new StringToCharArrayConverter(); @Test - public void convertShouldConvertSource() throws Exception { + public void convertShouldConvertSource() { char[] converted = this.converter.convert("test"); assertThat(converted).containsExactly('t', 'e', 's', 't'); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/convert/StringToEnumConverterFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/convert/StringToEnumConverterFactoryTests.java index f7274b1062..a3f8ad2d4d 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/convert/StringToEnumConverterFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/convert/StringToEnumConverterFactoryTests.java @@ -39,14 +39,14 @@ public class StringToEnumConverterFactoryTests { @Test @SuppressWarnings({ "unchecked", "rawtypes" }) - public void getConverterWhenEnumSubclassShouldReturnConverter() throws Exception { + public void getConverterWhenEnumSubclassShouldReturnConverter() { Converter converter = this.factory .getConverter((Class) TestSubclassEnum.ONE.getClass()); assertThat(converter).isNotNull(); } @Test - public void convertWhenExactMatchShouldConvertValue() throws Exception { + public void convertWhenExactMatchShouldConvertValue() { Converter converter = this.factory.getConverter(TestEnum.class); assertThat(converter.convert("")).isNull(); assertThat(converter.convert("ONE")).isEqualTo(TestEnum.ONE); @@ -56,7 +56,7 @@ public class StringToEnumConverterFactoryTests { } @Test - public void convertWhenFuzzyMatchShouldConvertValue() throws Exception { + public void convertWhenFuzzyMatchShouldConvertValue() { Converter converter = this.factory.getConverter(TestEnum.class); assertThat(converter.convert("")).isNull(); assertThat(converter.convert("one")).isEqualTo(TestEnum.ONE); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/convert/StringToInetAddressConverterTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/convert/StringToInetAddressConverterTests.java index ca15cfed5d..b4c3727b5c 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/convert/StringToInetAddressConverterTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/convert/StringToInetAddressConverterTests.java @@ -44,7 +44,7 @@ public class StringToInetAddressConverterTests extends AbstractInetAddressTests } @Test - public void convertWhenHostExistsShouldConvert() throws Exception { + public void convertWhenHostExistsShouldConvert() { assumeResolves("example.com"); InetAddress converted = this.converter.convert("example.com"); assertThat(converted.toString()).startsWith("example.com"); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/handler/IgnoreErrorsBindHandlerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/handler/IgnoreErrorsBindHandlerTests.java index efc1870f40..24afe5503c 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/handler/IgnoreErrorsBindHandlerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/handler/IgnoreErrorsBindHandlerTests.java @@ -56,13 +56,13 @@ public class IgnoreErrorsBindHandlerTests { } @Test - public void bindWhenNotIgnoringErrorsShouldFail() throws Exception { + public void bindWhenNotIgnoringErrorsShouldFail() { this.thrown.expect(BindException.class); this.binder.bind("example", Bindable.of(Example.class)); } @Test - public void bindWhenIgnoringErrorsShouldBind() throws Exception { + public void bindWhenIgnoringErrorsShouldBind() { Example bound = this.binder.bind("example", Bindable.of(Example.class), new IgnoreErrorsBindHandler()).get(); assertThat(bound.getFoo()).isEqualTo(0); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/handler/NoUnboundElementsBindHandlerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/handler/NoUnboundElementsBindHandlerTests.java index ac59da56ad..4d8401b9b0 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/handler/NoUnboundElementsBindHandlerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/handler/NoUnboundElementsBindHandlerTests.java @@ -45,7 +45,7 @@ public class NoUnboundElementsBindHandlerTests { private Binder binder; @Test - public void bindWhenNotUsingNoUnboundElementsHandlerShouldBind() throws Exception { + public void bindWhenNotUsingNoUnboundElementsHandlerShouldBind() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("example.foo", "bar"); source.put("example.baz", "bar"); @@ -58,7 +58,7 @@ public class NoUnboundElementsBindHandlerTests { } @Test - public void bindWhenUsingNoUnboundElementsHandlerShouldBind() throws Exception { + public void bindWhenUsingNoUnboundElementsHandlerShouldBind() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("example.foo", "bar"); this.sources.add(source); @@ -69,7 +69,7 @@ public class NoUnboundElementsBindHandlerTests { } @Test - public void bindWhenUsingNoUnboundElementsHandlerThrowException() throws Exception { + public void bindWhenUsingNoUnboundElementsHandlerThrowException() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("example.foo", "bar"); source.put("example.baz", "bar"); @@ -87,8 +87,7 @@ public class NoUnboundElementsBindHandlerTests { } @Test - public void bindWhenUsingNoUnboundElementsHandlerShouldBindIfPrefixDifferent() - throws Exception { + public void bindWhenUsingNoUnboundElementsHandlerShouldBindIfPrefixDifferent() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("example.foo", "bar"); source.put("other.baz", "bar"); @@ -100,8 +99,7 @@ public class NoUnboundElementsBindHandlerTests { } @Test - public void bindWhenUsingNoUnboundElementsHandlerShouldBindIfUnboundSystemProperties() - throws Exception { + public void bindWhenUsingNoUnboundElementsHandlerShouldBindIfUnboundSystemProperties() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("example.foo", "bar"); source.put("example.other", "baz"); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/test/PackagePrivateBeanBindingTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/test/PackagePrivateBeanBindingTests.java index 24c5daf8f6..cf055a85d1 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/test/PackagePrivateBeanBindingTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/test/PackagePrivateBeanBindingTests.java @@ -50,7 +50,7 @@ public class PackagePrivateBeanBindingTests { } @Test - public void bindToPackagePrivateClassShouldBindToInstance() throws Exception { + public void bindToPackagePrivateClassShouldBindToInstance() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.bar", "999"); this.sources.add(source); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/validation/BindValidationExceptionTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/validation/BindValidationExceptionTests.java index 083cc67a09..8abe06e998 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/validation/BindValidationExceptionTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/validation/BindValidationExceptionTests.java @@ -35,14 +35,14 @@ public class BindValidationExceptionTests { public ExpectedException thrown = ExpectedException.none(); @Test - public void createWhenValidationErrorsIsNullShouldThrowException() throws Exception { + public void createWhenValidationErrorsIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("ValidationErrors must not be null"); new BindValidationException(null); } @Test - public void getValidationErrorsShouldReturnValidationErrors() throws Exception { + public void getValidationErrorsShouldReturnValidationErrors() { ValidationErrors errors = mock(ValidationErrors.class); BindValidationException exception = new BindValidationException(errors); assertThat(exception.getValidationErrors()).isEqualTo(errors); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/validation/OriginTrackedFieldErrorTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/validation/OriginTrackedFieldErrorTests.java index 53980fa2e6..f06cc098a1 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/validation/OriginTrackedFieldErrorTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/validation/OriginTrackedFieldErrorTests.java @@ -37,17 +37,17 @@ public class OriginTrackedFieldErrorTests { private static final Origin ORIGIN = MockOrigin.of("afile"); @Test - public void ofWhenFieldErrorIsNullShouldReturnNull() throws Exception { + public void ofWhenFieldErrorIsNullShouldReturnNull() { assertThat(OriginTrackedFieldError.of(null, ORIGIN)).isNull(); } @Test - public void ofWhenOriginIsNullShouldReturnFieldErrorWithoutOrigin() throws Exception { + public void ofWhenOriginIsNullShouldReturnFieldErrorWithoutOrigin() { assertThat(OriginTrackedFieldError.of(FIELD_ERROR, null)).isSameAs(FIELD_ERROR); } @Test - public void ofShouldReturnOriginCapableFieldError() throws Exception { + public void ofShouldReturnOriginCapableFieldError() { FieldError fieldError = OriginTrackedFieldError.of(FIELD_ERROR, ORIGIN); assertThat(fieldError.getObjectName()).isEqualTo("foo"); assertThat(fieldError.getField()).isEqualTo("bar"); @@ -55,7 +55,7 @@ public class OriginTrackedFieldErrorTests { } @Test - public void toStringShouldAddOrigin() throws Exception { + public void toStringShouldAddOrigin() { assertThat(OriginTrackedFieldError.of(FIELD_ERROR, ORIGIN).toString()).isEqualTo( "Field error in object 'foo' on field 'bar': rejected value [null]" + "; codes []; arguments []; default message [faf]; origin afile"); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/validation/ValidationBindHandlerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/validation/ValidationBindHandlerTests.java index deb414dfdf..5f5c3ab033 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/validation/ValidationBindHandlerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/validation/ValidationBindHandlerTests.java @@ -87,7 +87,7 @@ public class ValidationBindHandlerTests { } @Test - public void bindShouldValidateNestedProperties() throws Exception { + public void bindShouldValidateNestedProperties() { this.sources.add(new MockConfigurationPropertySource("foo.nested.age", 4)); this.thrown.expect(BindException.class); this.thrown.expectCause(instanceOf(BindValidationException.class)); @@ -106,7 +106,7 @@ public class ValidationBindHandlerTests { } @Test - public void bindShouldFailWithAccessToBoundProperties() throws Exception { + public void bindShouldFailWithAccessToBoundProperties() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.nested.name", "baz"); source.put("foo.nested.age", "4"); @@ -122,7 +122,7 @@ public class ValidationBindHandlerTests { } @Test - public void bindShouldFailWithAccessToName() throws Exception { + public void bindShouldFailWithAccessToName() { this.sources.add(new MockConfigurationPropertySource("foo.nested.age", "4")); BindValidationException cause = bindAndExpectValidationError( () -> this.binder.bind(ConfigurationPropertyName.of("foo"), @@ -132,7 +132,7 @@ public class ValidationBindHandlerTests { } @Test - public void bindShouldFailIfExistingValueIsInvalid() throws Exception { + public void bindShouldFailIfExistingValueIsInvalid() { ExampleValidatedBean existingValue = new ExampleValidatedBean(); BindValidationException cause = bindAndExpectValidationError( () -> this.binder.bind(ConfigurationPropertyName.of("foo"), Bindable @@ -144,7 +144,7 @@ public class ValidationBindHandlerTests { } @Test - public void bindShouldNotValidateWithoutAnnotation() throws Exception { + public void bindShouldNotValidateWithoutAnnotation() { ExampleNonValidatedBean existingValue = new ExampleNonValidatedBean(); this.binder.bind(ConfigurationPropertyName.of("foo"), Bindable .of(ExampleNonValidatedBean.class).withExistingValue(existingValue), diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/validation/ValidationErrorsTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/validation/ValidationErrorsTests.java index b1c829aeb9..699069e7a4 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/validation/ValidationErrorsTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/validation/ValidationErrorsTests.java @@ -50,28 +50,28 @@ public class ValidationErrorsTests { public ExpectedException thrown = ExpectedException.none(); @Test - public void createWhenNameIsNullShouldThrowException() throws Exception { + public void createWhenNameIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Name must not be null"); new ValidationErrors(null, Collections.emptySet(), Collections.emptyList()); } @Test - public void createWhenBoundPropertiesIsNullShouldThrowException() throws Exception { + public void createWhenBoundPropertiesIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("BoundProperties must not be null"); new ValidationErrors(NAME, null, Collections.emptyList()); } @Test - public void createWhenErrorsIsNullShouldThrowException() throws Exception { + public void createWhenErrorsIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Errors must not be null"); new ValidationErrors(NAME, Collections.emptySet(), null); } @Test - public void getNameShouldReturnName() throws Exception { + public void getNameShouldReturnName() { ConfigurationPropertyName name = NAME; ValidationErrors errors = new ValidationErrors(name, Collections.emptySet(), Collections.emptyList()); @@ -79,7 +79,7 @@ public class ValidationErrorsTests { } @Test - public void getBoundPropertiesShouldReturnBoundProperties() throws Exception { + public void getBoundPropertiesShouldReturnBoundProperties() { Set boundProperties = new LinkedHashSet<>(); boundProperties.add(new ConfigurationProperty(NAME, "foo", null)); ValidationErrors errors = new ValidationErrors(NAME, boundProperties, @@ -88,7 +88,7 @@ public class ValidationErrorsTests { } @Test - public void getErrorsShouldReturnErrors() throws Exception { + public void getErrorsShouldReturnErrors() { List allErrors = new ArrayList<>(); allErrors.add(new ObjectError("foo", "bar")); ValidationErrors errors = new ValidationErrors(NAME, Collections.emptySet(), @@ -97,7 +97,7 @@ public class ValidationErrorsTests { } @Test - public void iteratorShouldIterateErrors() throws Exception { + public void iteratorShouldIterateErrors() { List allErrors = new ArrayList<>(); allErrors.add(new ObjectError("foo", "bar")); ValidationErrors errors = new ValidationErrors(NAME, Collections.emptySet(), @@ -106,7 +106,7 @@ public class ValidationErrorsTests { } @Test - public void getErrorsShouldAdaptFieldErrorsToBeOriginProviders() throws Exception { + public void getErrorsShouldAdaptFieldErrorsToBeOriginProviders() { Set boundProperties = new LinkedHashSet<>(); ConfigurationPropertyName name1 = ConfigurationPropertyName.of("foo.bar"); Origin origin1 = MockOrigin.of("line1"); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/AliasedConfigurationPropertySourceTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/AliasedConfigurationPropertySourceTests.java index 5f2782a6d6..da563758c5 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/AliasedConfigurationPropertySourceTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/AliasedConfigurationPropertySourceTests.java @@ -33,7 +33,7 @@ import static org.mockito.Mockito.withSettings; public class AliasedConfigurationPropertySourceTests { @Test - public void getConfigurationPropertyShouldConsiderAliases() throws Exception { + public void getConfigurationPropertyShouldConsiderAliases() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.bar", "bing"); source.put("foo.baz", "biff"); @@ -44,8 +44,7 @@ public class AliasedConfigurationPropertySourceTests { } @Test - public void getConfigurationPropertyWhenNotAliasesShouldReturnValue() - throws Exception { + public void getConfigurationPropertyWhenNotAliasesShouldReturnValue() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.bar", "bing"); source.put("foo.baz", "biff"); @@ -55,8 +54,7 @@ public class AliasedConfigurationPropertySourceTests { } @Test - public void containsDescendantOfWhenSourceReturnsUnknownShouldReturnUnknown() - throws Exception { + public void containsDescendantOfWhenSourceReturnsUnknownShouldReturnUnknown() { ConfigurationPropertyName name = ConfigurationPropertyName.of("foo"); ConfigurationPropertySource source = mock(ConfigurationPropertySource.class, withSettings().defaultAnswer(Answers.CALLS_REAL_METHODS)); @@ -69,8 +67,7 @@ public class AliasedConfigurationPropertySourceTests { } @Test - public void containsDescendantOfWhenSourceReturnsPresentShouldReturnPresent() - throws Exception { + public void containsDescendantOfWhenSourceReturnsPresentShouldReturnPresent() { ConfigurationPropertyName name = ConfigurationPropertyName.of("foo"); ConfigurationPropertySource source = mock(ConfigurationPropertySource.class, withSettings().defaultAnswer(Answers.CALLS_REAL_METHODS)); @@ -85,8 +82,7 @@ public class AliasedConfigurationPropertySourceTests { } @Test - public void containsDescendantOfWhenAllAreAbsentShouldReturnAbsent() - throws Exception { + public void containsDescendantOfWhenAllAreAbsentShouldReturnAbsent() { ConfigurationPropertyName name = ConfigurationPropertyName.of("foo"); ConfigurationPropertySource source = mock(ConfigurationPropertySource.class, withSettings().defaultAnswer(Answers.CALLS_REAL_METHODS)); @@ -101,8 +97,7 @@ public class AliasedConfigurationPropertySourceTests { } @Test - public void containsDescendantOfWhenAnyIsPresentShouldReturnPresent() - throws Exception { + public void containsDescendantOfWhenAnyIsPresentShouldReturnPresent() { ConfigurationPropertyName name = ConfigurationPropertyName.of("foo"); ConfigurationPropertySource source = mock(ConfigurationPropertySource.class, withSettings().defaultAnswer(Answers.CALLS_REAL_METHODS)); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/AliasedIterableConfigurationPropertySourceTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/AliasedIterableConfigurationPropertySourceTests.java index f3f3689416..934c2d581d 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/AliasedIterableConfigurationPropertySourceTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/AliasedIterableConfigurationPropertySourceTests.java @@ -30,7 +30,7 @@ public class AliasedIterableConfigurationPropertySourceTests extends AliasedConfigurationPropertySourceTests { @Test - public void streamShouldIncludeAliases() throws Exception { + public void streamShouldIncludeAliases() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.bar", "bing"); source.put("foo.baz", "biff"); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertyNameAliasesTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertyNameAliasesTests.java index f81cdd6b89..e7a41d7a3d 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertyNameAliasesTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertyNameAliasesTests.java @@ -34,14 +34,14 @@ public class ConfigurationPropertyNameAliasesTests { public ExpectedException thrown = ExpectedException.none(); @Test - public void createWithStringWhenNullNameShouldThrowException() throws Exception { + public void createWithStringWhenNullNameShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Name must not be null"); new ConfigurationPropertyNameAliases((String) null); } @Test - public void createWithStringShouldAddMapping() throws Exception { + public void createWithStringShouldAddMapping() { ConfigurationPropertyNameAliases aliases = new ConfigurationPropertyNameAliases( "foo", "bar", "baz"); assertThat(aliases.getAliases(ConfigurationPropertyName.of("foo"))) @@ -50,7 +50,7 @@ public class ConfigurationPropertyNameAliasesTests { } @Test - public void createWithNameShouldAddMapping() throws Exception { + public void createWithNameShouldAddMapping() { ConfigurationPropertyNameAliases aliases = new ConfigurationPropertyNameAliases( ConfigurationPropertyName.of("foo"), ConfigurationPropertyName.of("bar"), ConfigurationPropertyName.of("baz")); @@ -60,7 +60,7 @@ public class ConfigurationPropertyNameAliasesTests { } @Test - public void addAliasesFromStringShouldAddMapping() throws Exception { + public void addAliasesFromStringShouldAddMapping() { ConfigurationPropertyNameAliases aliases = new ConfigurationPropertyNameAliases(); aliases.addAliases("foo", "bar", "baz"); assertThat(aliases.getAliases(ConfigurationPropertyName.of("foo"))) @@ -69,7 +69,7 @@ public class ConfigurationPropertyNameAliasesTests { } @Test - public void addAliasesFromNameShouldAddMapping() throws Exception { + public void addAliasesFromNameShouldAddMapping() { ConfigurationPropertyNameAliases aliases = new ConfigurationPropertyNameAliases(); aliases.addAliases(ConfigurationPropertyName.of("foo"), ConfigurationPropertyName.of("bar"), ConfigurationPropertyName.of("baz")); @@ -79,7 +79,7 @@ public class ConfigurationPropertyNameAliasesTests { } @Test - public void addWhenHasExistingShouldAddAdditionalMappings() throws Exception { + public void addWhenHasExistingShouldAddAdditionalMappings() { ConfigurationPropertyNameAliases aliases = new ConfigurationPropertyNameAliases(); aliases.addAliases("foo", "bar"); aliases.addAliases("foo", "baz"); @@ -89,13 +89,13 @@ public class ConfigurationPropertyNameAliasesTests { } @Test - public void getAliasesWhenNotMappedShouldReturnEmptyList() throws Exception { + public void getAliasesWhenNotMappedShouldReturnEmptyList() { ConfigurationPropertyNameAliases aliases = new ConfigurationPropertyNameAliases(); assertThat(aliases.getAliases(ConfigurationPropertyName.of("foo"))).isEmpty(); } @Test - public void getAliasesWhenMappedShouldReturnMapping() throws Exception { + public void getAliasesWhenMappedShouldReturnMapping() { ConfigurationPropertyNameAliases aliases = new ConfigurationPropertyNameAliases(); aliases.addAliases("foo", "bar"); assertThat(aliases.getAliases(ConfigurationPropertyName.of("foo"))) @@ -103,7 +103,7 @@ public class ConfigurationPropertyNameAliasesTests { } @Test - public void getNameForAliasWhenHasMappingShouldReturnName() throws Exception { + public void getNameForAliasWhenHasMappingShouldReturnName() { ConfigurationPropertyNameAliases aliases = new ConfigurationPropertyNameAliases(); aliases.addAliases("foo", "bar"); aliases.addAliases("foo", "baz"); @@ -114,7 +114,7 @@ public class ConfigurationPropertyNameAliasesTests { } @Test - public void getNameForAliasWhenNotMappedShouldReturnNull() throws Exception { + public void getNameForAliasWhenNotMappedShouldReturnNull() { ConfigurationPropertyNameAliases aliases = new ConfigurationPropertyNameAliases(); aliases.addAliases("foo", "bar"); assertThat((Object) aliases.getNameForAlias(ConfigurationPropertyName.of("baz"))) diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertyNameTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertyNameTests.java index 043e9cf99d..aa89e8ab53 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertyNameTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertyNameTests.java @@ -43,49 +43,49 @@ public class ConfigurationPropertyNameTests { public ExpectedException thrown = ExpectedException.none(); @Test - public void ofNameShouldNotBeNull() throws Exception { + public void ofNameShouldNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Name must not be null"); ConfigurationPropertyName.of(null); } @Test - public void ofNameShouldNotStartWithNumber() throws Exception { + public void ofNameShouldNotStartWithNumber() { this.thrown.expect(InvalidConfigurationPropertyNameException.class); this.thrown.expectMessage("is not valid"); ConfigurationPropertyName.of("1foo"); } @Test - public void ofNameShouldNotStartWithDash() throws Exception { + public void ofNameShouldNotStartWithDash() { this.thrown.expect(InvalidConfigurationPropertyNameException.class); this.thrown.expectMessage("is not valid"); ConfigurationPropertyName.of("-foo"); } @Test - public void ofNameShouldNotStartWithDot() throws Exception { + public void ofNameShouldNotStartWithDot() { this.thrown.expect(InvalidConfigurationPropertyNameException.class); this.thrown.expectMessage("is not valid"); ConfigurationPropertyName.of(".foo"); } @Test - public void ofNameShouldNotEndWithDot() throws Exception { + public void ofNameShouldNotEndWithDot() { this.thrown.expect(InvalidConfigurationPropertyNameException.class); this.thrown.expectMessage("is not valid"); ConfigurationPropertyName.of("foo."); } @Test - public void ofNameShouldNotContainUppercase() throws Exception { + public void ofNameShouldNotContainUppercase() { this.thrown.expect(InvalidConfigurationPropertyNameException.class); this.thrown.expectMessage("is not valid"); ConfigurationPropertyName.of("fOo"); } @Test - public void ofNameShouldNotContainInvalidChars() throws Exception { + public void ofNameShouldNotContainInvalidChars() { String invalid = "_@$%*+=':;"; for (char c : invalid.toCharArray()) { try { @@ -99,7 +99,7 @@ public class ConfigurationPropertyNameTests { } @Test - public void ofNameWhenSimple() throws Exception { + public void ofNameWhenSimple() { ConfigurationPropertyName name = ConfigurationPropertyName.of("name"); assertThat(name.toString()).isEqualTo("name"); assertThat(name.getNumberOfElements()).isEqualTo(1); @@ -108,7 +108,7 @@ public class ConfigurationPropertyNameTests { } @Test - public void ofNameWhenRunOnAssociative() throws Exception { + public void ofNameWhenRunOnAssociative() { ConfigurationPropertyName name = ConfigurationPropertyName.of("foo[bar]"); assertThat(name.toString()).isEqualTo("foo[bar]"); assertThat(name.getElement(0, Form.ORIGINAL)).isEqualTo("foo"); @@ -118,7 +118,7 @@ public class ConfigurationPropertyNameTests { } @Test - public void ofNameWhenDotOnAssociative() throws Exception { + public void ofNameWhenDotOnAssociative() { ConfigurationPropertyName name = ConfigurationPropertyName.of("foo.bar"); assertThat(name.toString()).isEqualTo("foo.bar"); assertThat(name.getElement(0, Form.ORIGINAL)).isEqualTo("foo"); @@ -128,7 +128,7 @@ public class ConfigurationPropertyNameTests { } @Test - public void ofNameWhenDotAndAssociative() throws Exception { + public void ofNameWhenDotAndAssociative() { ConfigurationPropertyName name = ConfigurationPropertyName.of("foo.[bar]"); assertThat(name.toString()).isEqualTo("foo[bar]"); assertThat(name.getElement(0, Form.ORIGINAL)).isEqualTo("foo"); @@ -138,7 +138,7 @@ public class ConfigurationPropertyNameTests { } @Test - public void ofNameWhenDoubleRunOnAndAssociative() throws Exception { + public void ofNameWhenDoubleRunOnAndAssociative() { ConfigurationPropertyName name = ConfigurationPropertyName.of("foo[bar]baz"); assertThat(name.toString()).isEqualTo("foo[bar].baz"); assertThat(name.getElement(0, Form.ORIGINAL)).isEqualTo("foo"); @@ -150,7 +150,7 @@ public class ConfigurationPropertyNameTests { } @Test - public void ofNameWhenDoubleDotAndAssociative() throws Exception { + public void ofNameWhenDoubleDotAndAssociative() { ConfigurationPropertyName name = ConfigurationPropertyName.of("foo.[bar].baz"); assertThat(name.toString()).isEqualTo("foo[bar].baz"); assertThat(name.getElement(0, Form.ORIGINAL)).isEqualTo("foo"); @@ -162,28 +162,28 @@ public class ConfigurationPropertyNameTests { } @Test - public void ofNameWhenMissingCloseBracket() throws Exception { + public void ofNameWhenMissingCloseBracket() { this.thrown.expect(InvalidConfigurationPropertyNameException.class); this.thrown.expectMessage("is not valid"); ConfigurationPropertyName.of("[bar"); } @Test - public void ofNameWhenMissingOpenBracket() throws Exception { + public void ofNameWhenMissingOpenBracket() { this.thrown.expect(InvalidConfigurationPropertyNameException.class); this.thrown.expectMessage("is not valid"); ConfigurationPropertyName.of("bar]"); } @Test - public void ofNameWhenMultipleMismatchedBrackets() throws Exception { + public void ofNameWhenMultipleMismatchedBrackets() { this.thrown.expect(InvalidConfigurationPropertyNameException.class); this.thrown.expectMessage("is not valid"); ConfigurationPropertyName.of("[a[[[b]ar]"); } @Test - public void ofNameWhenNestedBrackets() throws Exception { + public void ofNameWhenNestedBrackets() { ConfigurationPropertyName name = ConfigurationPropertyName.of("foo[a[c][[b]ar]]"); assertThat(name.toString()).isEqualTo("foo[a[c][[b]ar]]"); assertThat(name.getElement(0, Form.ORIGINAL)).isEqualTo("foo"); @@ -191,14 +191,14 @@ public class ConfigurationPropertyNameTests { } @Test - public void ofNameWithWhitespaceInName() throws Exception { + public void ofNameWithWhitespaceInName() { this.thrown.expect(InvalidConfigurationPropertyNameException.class); this.thrown.expectMessage("is not valid"); ConfigurationPropertyName.of("foo. bar"); } @Test - public void ofNameWithWhitespaceInAssociativeElement() throws Exception { + public void ofNameWithWhitespaceInAssociativeElement() { ConfigurationPropertyName name = ConfigurationPropertyName.of("foo[b a r]"); assertThat(name.toString()).isEqualTo("foo[b a r]"); assertThat(name.getElement(0, Form.ORIGINAL)).isEqualTo("foo"); @@ -208,7 +208,7 @@ public class ConfigurationPropertyNameTests { } @Test - public void ofNameWithUppercaseInAssociativeElement() throws Exception { + public void ofNameWithUppercaseInAssociativeElement() { ConfigurationPropertyName name = ConfigurationPropertyName.of("foo[BAR]"); assertThat(name.toString()).isEqualTo("foo[BAR]"); assertThat(name.getElement(0, Form.ORIGINAL)).isEqualTo("foo"); @@ -218,29 +218,28 @@ public class ConfigurationPropertyNameTests { } @Test - public void ofWhenNameIsEmptyShouldReturnEmptyName() throws Exception { + public void ofWhenNameIsEmptyShouldReturnEmptyName() { ConfigurationPropertyName name = ConfigurationPropertyName.of(""); assertThat(name.toString()).isEqualTo(""); assertThat(name.append("foo").toString()).isEqualTo("foo"); } @Test - public void adaptWhenNameIsNullShouldThrowException() throws Exception { + public void adaptWhenNameIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Name must not be null"); ConfigurationPropertyName.adapt(null, '.'); } @Test - public void adaptWhenElementValueProcessorIsNullShouldThrowException() - throws Exception { + public void adaptWhenElementValueProcessorIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("ElementValueProcessor must not be null"); ConfigurationPropertyName.adapt("foo", '.', null); } @Test - public void adaptShouldCreateName() throws Exception { + public void adaptShouldCreateName() { ConfigurationPropertyName expected = ConfigurationPropertyName.of("foo.bar.baz"); ConfigurationPropertyName name = ConfigurationPropertyName.adapt("foo.bar.baz", '.'); @@ -248,7 +247,7 @@ public class ConfigurationPropertyNameTests { } @Test - public void adaptShouldStripInvalidChars() throws Exception { + public void adaptShouldStripInvalidChars() { ConfigurationPropertyName name = ConfigurationPropertyName.adapt("f@@.b%r", '.'); assertThat(name.getElement(0, Form.UNIFORM)).isEqualTo("f"); assertThat(name.getElement(0, Form.ORIGINAL)).isEqualTo("f"); @@ -258,7 +257,7 @@ public class ConfigurationPropertyNameTests { } @Test - public void adaptShouldSupportUnderscore() throws Exception { + public void adaptShouldSupportUnderscore() { ConfigurationPropertyName name = ConfigurationPropertyName.adapt("f-_o.b_r", '.'); assertThat(name.getElement(0, Form.UNIFORM)).isEqualTo("fo"); assertThat(name.getElement(0, Form.ORIGINAL)).isEqualTo("f-_o"); @@ -268,7 +267,7 @@ public class ConfigurationPropertyNameTests { } @Test - public void adaptShouldSupportMixedCase() throws Exception { + public void adaptShouldSupportMixedCase() { ConfigurationPropertyName name = ConfigurationPropertyName.adapt("fOo.bAr", '.'); assertThat(name.getElement(0, Form.UNIFORM)).isEqualTo("foo"); assertThat(name.getElement(0, Form.ORIGINAL)).isEqualTo("fOo"); @@ -278,14 +277,14 @@ public class ConfigurationPropertyNameTests { } @Test - public void adaptShouldUseElementValueProcessor() throws Exception { + public void adaptShouldUseElementValueProcessor() { ConfigurationPropertyName name = ConfigurationPropertyName.adapt("FOO_THE-BAR", '_', (c) -> c.toString().replace("-", "")); assertThat(name.toString()).isEqualTo("foo.thebar"); } @Test - public void adaptShouldSupportIndexedElements() throws Exception { + public void adaptShouldSupportIndexedElements() { ConfigurationPropertyName name = ConfigurationPropertyName.adapt("foo", '.'); assertThat(name.toString()).isEqualTo("foo"); assertThat(name.getNumberOfElements()).isEqualTo(1); @@ -304,23 +303,23 @@ public class ConfigurationPropertyNameTests { } @Test - public void isEmptyWhenEmptyShouldReturnTrue() throws Exception { + public void isEmptyWhenEmptyShouldReturnTrue() { assertThat(ConfigurationPropertyName.of("").isEmpty()).isTrue(); } @Test - public void isEmptyWhenNotEmptyShouldReturnFalse() throws Exception { + public void isEmptyWhenNotEmptyShouldReturnFalse() { assertThat(ConfigurationPropertyName.of("x").isEmpty()).isFalse(); } @Test - public void isLastElementIndexedWhenIndexedShouldReturnTrue() throws Exception { + public void isLastElementIndexedWhenIndexedShouldReturnTrue() { assertThat(ConfigurationPropertyName.of("foo[0]").isLastElementIndexed()) .isTrue(); } @Test - public void isLastElementIndexedWhenNotIndexedShouldReturnFalse() throws Exception { + public void isLastElementIndexedWhenNotIndexedShouldReturnFalse() { assertThat(ConfigurationPropertyName.of("foo.bar").isLastElementIndexed()) .isFalse(); assertThat(ConfigurationPropertyName.of("foo[0].bar").isLastElementIndexed()) @@ -328,35 +327,35 @@ public class ConfigurationPropertyNameTests { } @Test - public void getLastElementShouldGetLastElement() throws Exception { + public void getLastElementShouldGetLastElement() { ConfigurationPropertyName name = ConfigurationPropertyName.adapt("foo.bAr", '.'); assertThat(name.getLastElement(Form.ORIGINAL)).isEqualTo("bAr"); assertThat(name.getLastElement(Form.UNIFORM)).isEqualTo("bar"); } @Test - public void getLastElementWhenEmptyShouldReturnEmptyString() throws Exception { + public void getLastElementWhenEmptyShouldReturnEmptyString() { ConfigurationPropertyName name = ConfigurationPropertyName.EMPTY; assertThat(name.getLastElement(Form.ORIGINAL)).isEqualTo(""); assertThat(name.getLastElement(Form.UNIFORM)).isEqualTo(""); } @Test - public void getElementShouldNotIncludeAngleBrackets() throws Exception { + public void getElementShouldNotIncludeAngleBrackets() { ConfigurationPropertyName name = ConfigurationPropertyName.of("[foo]"); assertThat(name.getElement(0, Form.ORIGINAL)).isEqualTo("foo"); assertThat(name.getElement(0, Form.UNIFORM)).isEqualTo("foo"); } @Test - public void getElementInUniformFormShouldNotIncludeDashes() throws Exception { + public void getElementInUniformFormShouldNotIncludeDashes() { ConfigurationPropertyName name = ConfigurationPropertyName.of("f-o-o"); assertThat(name.getElement(0, Form.ORIGINAL)).isEqualTo("f-o-o"); assertThat(name.getElement(0, Form.UNIFORM)).isEqualTo("foo"); } @Test - public void getElementInOriginalFormShouldReturnElement() throws Exception { + public void getElementInOriginalFormShouldReturnElement() { assertThat(getElements("foo.bar", Form.ORIGINAL)).containsExactly("foo", "bar"); assertThat(getElements("foo[0]", Form.ORIGINAL)).containsExactly("foo", "0"); assertThat(getElements("foo.[0]", Form.ORIGINAL)).containsExactly("foo", "0"); @@ -371,7 +370,7 @@ public class ConfigurationPropertyNameTests { } @Test - public void getElementInUniformFormShouldReturnElement() throws Exception { + public void getElementInUniformFormShouldReturnElement() { assertThat(getElements("foo.bar", Form.UNIFORM)).containsExactly("foo", "bar"); assertThat(getElements("foo[0]", Form.UNIFORM)).containsExactly("foo", "0"); assertThat(getElements("foo.[0]", Form.UNIFORM)).containsExactly("foo", "0"); @@ -395,7 +394,7 @@ public class ConfigurationPropertyNameTests { } @Test - public void getNumberOfElementsShouldReturnNumberOfElement() throws Exception { + public void getNumberOfElementsShouldReturnNumberOfElement() { assertThat(ConfigurationPropertyName.of("").getNumberOfElements()).isEqualTo(0); assertThat(ConfigurationPropertyName.of("x").getNumberOfElements()).isEqualTo(1); assertThat(ConfigurationPropertyName.of("x.y").getNumberOfElements()) @@ -405,13 +404,13 @@ public class ConfigurationPropertyNameTests { } @Test - public void appendWhenNotIndexedShouldAppendWithDot() throws Exception { + public void appendWhenNotIndexedShouldAppendWithDot() { ConfigurationPropertyName name = ConfigurationPropertyName.of("foo"); assertThat(name.append("bar").toString()).isEqualTo("foo.bar"); } @Test - public void appendWhenIndexedShouldAppendWithBrackets() throws Exception { + public void appendWhenIndexedShouldAppendWithBrackets() { ConfigurationPropertyName name = ConfigurationPropertyName.of("foo") .append("[bar]"); assertThat(name.isLastElementIndexed()).isTrue(); @@ -419,52 +418,52 @@ public class ConfigurationPropertyNameTests { } @Test - public void appendWhenElementNameIsNotValidShouldThrowException() throws Exception { + public void appendWhenElementNameIsNotValidShouldThrowException() { this.thrown.expect(InvalidConfigurationPropertyNameException.class); this.thrown.expectMessage("Configuration property name '1bar' is not valid"); ConfigurationPropertyName.of("foo").append("1bar"); } @Test - public void appendWhenElementNameMultiDotShouldThrowException() throws Exception { + public void appendWhenElementNameMultiDotShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Element value 'bar.baz' must be a single item"); ConfigurationPropertyName.of("foo").append("bar.baz"); } @Test - public void appendWhenElementNameIsNullShouldReturnName() throws Exception { + public void appendWhenElementNameIsNullShouldReturnName() { ConfigurationPropertyName name = ConfigurationPropertyName.of("foo"); assertThat((Object) name.append((String) null)).isSameAs(name); } @Test - public void chopWhenLessThenSizeShouldReturnChopped() throws Exception { + public void chopWhenLessThenSizeShouldReturnChopped() { ConfigurationPropertyName name = ConfigurationPropertyName.of("foo.bar.baz"); assertThat(name.chop(1).toString()).isEqualTo("foo"); assertThat(name.chop(2).toString()).isEqualTo("foo.bar"); } @Test - public void chopWhenGreaterThanSizeShouldReturnExisting() throws Exception { + public void chopWhenGreaterThanSizeShouldReturnExisting() { ConfigurationPropertyName name = ConfigurationPropertyName.of("foo.bar.baz"); assertThat(name.chop(4)).isEqualTo(name); } @Test - public void chopWhenEqualToSizeShouldReturnExisting() throws Exception { + public void chopWhenEqualToSizeShouldReturnExisting() { ConfigurationPropertyName name = ConfigurationPropertyName.of("foo.bar.baz"); assertThat(name.chop(3)).isEqualTo(name); } @Test - public void isParentOfWhenSameShouldReturnFalse() throws Exception { + public void isParentOfWhenSameShouldReturnFalse() { ConfigurationPropertyName name = ConfigurationPropertyName.of("foo"); assertThat(name.isParentOf(name)).isFalse(); } @Test - public void isParentOfWhenParentShouldReturnTrue() throws Exception { + public void isParentOfWhenParentShouldReturnTrue() { ConfigurationPropertyName name = ConfigurationPropertyName.of("foo"); ConfigurationPropertyName child = ConfigurationPropertyName.of("foo.bar"); assertThat(name.isParentOf(child)).isTrue(); @@ -472,7 +471,7 @@ public class ConfigurationPropertyNameTests { } @Test - public void isParentOfWhenGrandparentShouldReturnFalse() throws Exception { + public void isParentOfWhenGrandparentShouldReturnFalse() { ConfigurationPropertyName name = ConfigurationPropertyName.of("foo"); ConfigurationPropertyName grandchild = ConfigurationPropertyName .of("foo.bar.baz"); @@ -481,7 +480,7 @@ public class ConfigurationPropertyNameTests { } @Test - public void isParentOfWhenRootReturnTrue() throws Exception { + public void isParentOfWhenRootReturnTrue() { ConfigurationPropertyName name = ConfigurationPropertyName.of(""); ConfigurationPropertyName child = ConfigurationPropertyName.of("foo"); ConfigurationPropertyName grandchild = ConfigurationPropertyName.of("foo.bar"); @@ -491,13 +490,13 @@ public class ConfigurationPropertyNameTests { } @Test - public void isAncestorOfWhenSameShouldReturnFalse() throws Exception { + public void isAncestorOfWhenSameShouldReturnFalse() { ConfigurationPropertyName name = ConfigurationPropertyName.of("foo"); assertThat(name.isAncestorOf(name)).isFalse(); } @Test - public void isAncestorOfWhenParentShouldReturnTrue() throws Exception { + public void isAncestorOfWhenParentShouldReturnTrue() { ConfigurationPropertyName name = ConfigurationPropertyName.of("foo"); ConfigurationPropertyName child = ConfigurationPropertyName.of("foo.bar"); assertThat(name.isAncestorOf(child)).isTrue(); @@ -505,7 +504,7 @@ public class ConfigurationPropertyNameTests { } @Test - public void isAncestorOfWhenGrandparentShouldReturnTrue() throws Exception { + public void isAncestorOfWhenGrandparentShouldReturnTrue() { ConfigurationPropertyName name = ConfigurationPropertyName.of("foo"); ConfigurationPropertyName grandchild = ConfigurationPropertyName .of("foo.bar.baz"); @@ -514,7 +513,7 @@ public class ConfigurationPropertyNameTests { } @Test - public void isAncestorOfWhenRootShouldReturnTrue() throws Exception { + public void isAncestorOfWhenRootShouldReturnTrue() { ConfigurationPropertyName name = ConfigurationPropertyName.of(""); ConfigurationPropertyName grandchild = ConfigurationPropertyName .of("foo.bar.baz"); @@ -523,7 +522,7 @@ public class ConfigurationPropertyNameTests { } @Test - public void compareShouldSortNames() throws Exception { + public void compareShouldSortNames() { List names = new ArrayList<>(); names.add(ConfigurationPropertyName.of("foo[10]")); names.add(ConfigurationPropertyName.of("foo.bard")); @@ -538,14 +537,14 @@ public class ConfigurationPropertyNameTests { } @Test - public void toStringShouldBeLowerCaseDashed() throws Exception { + public void toStringShouldBeLowerCaseDashed() { ConfigurationPropertyName name = ConfigurationPropertyName.adapt("fOO.b_-a-r", '.'); assertThat(name.toString()).isEqualTo("foo.b-a-r"); } @Test - public void equalsAndHashCode() throws Exception { + public void equalsAndHashCode() { ConfigurationPropertyName n01 = ConfigurationPropertyName.of("foo[bar]"); ConfigurationPropertyName n02 = ConfigurationPropertyName.of("foo[bar]"); ConfigurationPropertyName n03 = ConfigurationPropertyName.of("foo.bar"); @@ -576,7 +575,7 @@ public class ConfigurationPropertyNameTests { } @Test - public void isValidWhenValidShouldReturnTrue() throws Exception { + public void isValidWhenValidShouldReturnTrue() { assertThat(ConfigurationPropertyName.isValid("")).isTrue(); assertThat(ConfigurationPropertyName.isValid("foo")).isTrue(); assertThat(ConfigurationPropertyName.isValid("foo.bar")).isTrue(); @@ -588,7 +587,7 @@ public class ConfigurationPropertyNameTests { } @Test - public void isValidWhenNotValidShouldReturnFalse() throws Exception { + public void isValidWhenNotValidShouldReturnFalse() { assertThat(ConfigurationPropertyName.isValid(null)).isFalse(); assertThat(ConfigurationPropertyName.isValid("1foo")).isFalse(); assertThat(ConfigurationPropertyName.isValid("FooBar")).isFalse(); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertySourcesPropertySourceTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertySourcesPropertySourceTests.java index b43a91fb25..cc350f426b 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertySourcesPropertySourceTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertySourcesPropertySourceTests.java @@ -37,14 +37,14 @@ public class ConfigurationPropertySourcesPropertySourceTests { "test", this.configurationSources); @Test - public void getPropertyShouldReturnValue() throws Exception { + public void getPropertyShouldReturnValue() { this.configurationSources .add(new MockConfigurationPropertySource("foo.bar", "baz")); assertThat(this.propertySource.getProperty("foo.bar")).isEqualTo("baz"); } @Test - public void getPropertyWhenNameIsNotValidShouldReturnNull() throws Exception { + public void getPropertyWhenNameIsNotValidShouldReturnNull() { this.configurationSources .add(new MockConfigurationPropertySource("foo.bar", "baz")); assertThat(this.propertySource.getProperty("FOO.B-A-R")).isNull(); @@ -53,7 +53,7 @@ public class ConfigurationPropertySourcesPropertySourceTests { } @Test - public void getPropertyWhenMultipleShouldReturnFirst() throws Exception { + public void getPropertyWhenMultipleShouldReturnFirst() { this.configurationSources .add(new MockConfigurationPropertySource("foo.bar", "baz")); this.configurationSources @@ -62,14 +62,14 @@ public class ConfigurationPropertySourcesPropertySourceTests { } @Test - public void getPropertyWhenNoneShouldReturnFirst() throws Exception { + public void getPropertyWhenNoneShouldReturnFirst() { this.configurationSources .add(new MockConfigurationPropertySource("foo.bar", "baz")); assertThat(this.propertySource.getProperty("foo.foo")).isNull(); } @Test - public void getPropertyOriginShouldReturnOrigin() throws Exception { + public void getPropertyOriginShouldReturnOrigin() { this.configurationSources .add(new MockConfigurationPropertySource("foo.bar", "baz", "line1")); assertThat(this.propertySource.getOrigin("foo.bar").toString()) @@ -77,19 +77,19 @@ public class ConfigurationPropertySourcesPropertySourceTests { } @Test - public void getPropertyOriginWhenMissingShouldReturnNull() throws Exception { + public void getPropertyOriginWhenMissingShouldReturnNull() { this.configurationSources .add(new MockConfigurationPropertySource("foo.bar", "baz", "line1")); assertThat(this.propertySource.getOrigin("foo.foo")).isNull(); } @Test - public void getNameShouldReturnName() throws Exception { + public void getNameShouldReturnName() { assertThat(this.propertySource.getName()).isEqualTo("test"); } @Test - public void getSourceShouldReturnSource() throws Exception { + public void getSourceShouldReturnSource() { assertThat(this.propertySource.getSource()).isSameAs(this.configurationSources); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertySourcesTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertySourcesTests.java index aa9ef5e315..02f7b48538 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertySourcesTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertySourcesTests.java @@ -42,7 +42,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class ConfigurationPropertySourcesTests { @Test - public void attachShouldAddAdapterAtBeginning() throws Exception { + public void attachShouldAddAdapterAtBeginning() { ConfigurableEnvironment environment = new StandardEnvironment(); MutablePropertySources sources = environment.getPropertySources(); sources.addLast(new SystemEnvironmentPropertySource("system", @@ -57,13 +57,13 @@ public class ConfigurationPropertySourcesTests { } @Test - public void getWhenNotAttachedShouldReturnAdapted() throws Exception { + public void getWhenNotAttachedShouldReturnAdapted() { ConfigurableEnvironment environment = new StandardEnvironment(); assertThat(ConfigurationPropertySources.get(environment)).isNotEmpty(); } @Test - public void getWhenAttachedShouldReturnAttached() throws Exception { + public void getWhenAttachedShouldReturnAttached() { ConfigurableEnvironment environment = new StandardEnvironment(); MutablePropertySources sources = environment.getPropertySources(); sources.addFirst( @@ -74,7 +74,7 @@ public class ConfigurationPropertySourcesTests { } @Test - public void environmentPropertyExpansionShouldWorkWhenAttached() throws Exception { + public void environmentPropertyExpansionShouldWorkWhenAttached() { ConfigurableEnvironment environment = new StandardEnvironment(); Map source = new LinkedHashMap<>(); source.put("fooBar", "Spring ${barBaz} ${bar-baz}"); @@ -86,8 +86,7 @@ public class ConfigurationPropertySourcesTests { } @Test - public void fromPropertySourceShouldReturnSpringConfigurationPropertySource() - throws Exception { + public void fromPropertySourceShouldReturnSpringConfigurationPropertySource() { PropertySource source = new MapPropertySource("foo", Collections.singletonMap("foo", "bar")); ConfigurationPropertySource configurationPropertySource = ConfigurationPropertySources @@ -97,7 +96,7 @@ public class ConfigurationPropertySourcesTests { } @Test - public void fromPropertySourceShouldFlattenPropertySources() throws Exception { + public void fromPropertySourceShouldFlattenPropertySources() { StandardEnvironment environment = new StandardEnvironment(); environment.getPropertySources().addFirst( new MapPropertySource("foo", Collections.singletonMap("foo", "bar"))); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertyStateTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertyStateTests.java index 20eb5f9305..bbaaa71656 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertyStateTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertyStateTests.java @@ -37,14 +37,14 @@ public class ConfigurationPropertyStateTests { public ExpectedException thrown = ExpectedException.none(); @Test - public void searchWhenIterableIsNullShouldThrowException() throws Exception { + public void searchWhenIterableIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Source must not be null"); ConfigurationPropertyState.search(null, (e) -> true); } @Test - public void searchWhenPredicateIsNullShouldThrowException() throws Exception { + public void searchWhenPredicateIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Predicate must not be null"); ConfigurationPropertyState.search(Collections.emptyList(), null); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertyTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertyTests.java index 443018f58d..9732d1518a 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertyTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertyTests.java @@ -41,40 +41,40 @@ public class ConfigurationPropertyTests { public ExpectedException thrown = ExpectedException.none(); @Test - public void createWhenNameIsNullShouldThrowException() throws Exception { + public void createWhenNameIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Name must not be null"); new ConfigurationProperty(null, "bar", null); } @Test - public void createWhenValueIsNullShouldThrowException() throws Exception { + public void createWhenValueIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Value must not be null"); new ConfigurationProperty(NAME, null, null); } @Test - public void getNameShouldReturnName() throws Exception { + public void getNameShouldReturnName() { ConfigurationProperty property = ConfigurationProperty.of(NAME, "foo", null); assertThat((Object) property.getName()).isEqualTo(NAME); } @Test - public void getValueShouldReturnValue() throws Exception { + public void getValueShouldReturnValue() { ConfigurationProperty property = ConfigurationProperty.of(NAME, "foo", null); assertThat(property.getValue()).isEqualTo("foo"); } @Test - public void getPropertyOriginShouldReturnValuePropertyOrigin() throws Exception { + public void getPropertyOriginShouldReturnValuePropertyOrigin() { Origin origin = mock(Origin.class); OriginProvider property = ConfigurationProperty.of(NAME, "foo", origin); assertThat(property.getOrigin()).isEqualTo(origin); } @Test - public void equalsAndHashCode() throws Exception { + public void equalsAndHashCode() { ConfigurationProperty property1 = new ConfigurationProperty( ConfigurationPropertyName.of("foo"), "bar", null); ConfigurationProperty property2 = new ConfigurationProperty( @@ -89,7 +89,7 @@ public class ConfigurationPropertyTests { } @Test - public void toStringShouldReturnValue() throws Exception { + public void toStringShouldReturnValue() { ConfigurationProperty property = ConfigurationProperty.of(NAME, "foo", null); assertThat(property.toString()).contains("name").contains("value"); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/DefaultPropertyMapperTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/DefaultPropertyMapperTests.java index 8154ee8e14..7a9e7b4e9b 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/DefaultPropertyMapperTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/DefaultPropertyMapperTests.java @@ -34,7 +34,7 @@ public class DefaultPropertyMapperTests extends AbstractPropertyMapperTests { } @Test - public void mapFromStringShouldReturnBestGuess() throws Exception { + public void mapFromStringShouldReturnBestGuess() { assertThat(namesFromString("server")).containsExactly("server"); assertThat(namesFromString("server.port")).containsExactly("server.port"); assertThat(namesFromString("host[0]")).containsExactly("host[0]"); @@ -50,7 +50,7 @@ public class DefaultPropertyMapperTests extends AbstractPropertyMapperTests { } @Test - public void mapFromConfigurationShouldReturnBestGuess() throws Exception { + public void mapFromConfigurationShouldReturnBestGuess() { assertThat(namesFromConfiguration("server")).containsExactly("server"); assertThat(namesFromConfiguration("server.port")).containsExactly("server.port"); assertThat(namesFromConfiguration("host[0]")).containsExactly("host[0]"); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/FilteredConfigurationPropertiesSourceTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/FilteredConfigurationPropertiesSourceTests.java index 7d3b4e2eab..62bff37b4b 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/FilteredConfigurationPropertiesSourceTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/FilteredConfigurationPropertiesSourceTests.java @@ -40,14 +40,14 @@ public class FilteredConfigurationPropertiesSourceTests { public ExpectedException thrown = ExpectedException.none(); @Test - public void createWhenSourceIsNullShouldThrowException() throws Exception { + public void createWhenSourceIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Source must not be null"); new FilteredConfigurationPropertiesSource(null, Objects::nonNull); } @Test - public void createWhenFilterIsNullShouldThrowException() throws Exception { + public void createWhenFilterIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Filter must not be null"); new FilteredConfigurationPropertiesSource(new MockConfigurationPropertySource(), @@ -55,7 +55,7 @@ public class FilteredConfigurationPropertiesSourceTests { } @Test - public void getValueShouldFilterNames() throws Exception { + public void getValueShouldFilterNames() { ConfigurationPropertySource source = createTestSource(); ConfigurationPropertySource filtered = source.filter(this::noBrackets); ConfigurationPropertyName name = ConfigurationPropertyName.of("a"); @@ -68,8 +68,7 @@ public class FilteredConfigurationPropertiesSourceTests { } @Test - public void containsDescendantOfWhenSourceReturnsEmptyShouldReturnEmpty() - throws Exception { + public void containsDescendantOfWhenSourceReturnsEmptyShouldReturnEmpty() { ConfigurationPropertyName name = ConfigurationPropertyName.of("foo"); ConfigurationPropertySource source = mock(ConfigurationPropertySource.class, withSettings().defaultAnswer(Answers.CALLS_REAL_METHODS)); @@ -81,8 +80,7 @@ public class FilteredConfigurationPropertiesSourceTests { } @Test - public void containsDescendantOfWhenSourceReturnsFalseShouldReturnFalse() - throws Exception { + public void containsDescendantOfWhenSourceReturnsFalseShouldReturnFalse() { ConfigurationPropertyName name = ConfigurationPropertyName.of("foo"); ConfigurationPropertySource source = mock(ConfigurationPropertySource.class, withSettings().defaultAnswer(Answers.CALLS_REAL_METHODS)); @@ -94,8 +92,7 @@ public class FilteredConfigurationPropertiesSourceTests { } @Test - public void containsDescendantOfWhenSourceReturnsTrueShouldReturnEmpty() - throws Exception { + public void containsDescendantOfWhenSourceReturnsTrueShouldReturnEmpty() { ConfigurationPropertyName name = ConfigurationPropertyName.of("foo"); ConfigurationPropertySource source = mock(ConfigurationPropertySource.class, withSettings().defaultAnswer(Answers.CALLS_REAL_METHODS)); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/FilteredIterableConfigurationPropertiesSourceTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/FilteredIterableConfigurationPropertiesSourceTests.java index f9ad7e7f81..7e910f1bfe 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/FilteredIterableConfigurationPropertiesSourceTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/FilteredIterableConfigurationPropertiesSourceTests.java @@ -30,7 +30,7 @@ public class FilteredIterableConfigurationPropertiesSourceTests extends FilteredConfigurationPropertiesSourceTests { @Test - public void iteratorShouldFilterNames() throws Exception { + public void iteratorShouldFilterNames() { MockConfigurationPropertySource source = (MockConfigurationPropertySource) createTestSource(); IterableConfigurationPropertySource filtered = source.filter(this::noBrackets); assertThat(filtered.iterator()).extracting(ConfigurationPropertyName::toString) @@ -44,7 +44,7 @@ public class FilteredIterableConfigurationPropertiesSourceTests } @Test - public void containsDescendantOfShouldUseContents() throws Exception { + public void containsDescendantOfShouldUseContents() { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.bar.baz", "1"); source.put("foo.bar[0]", "1"); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/MapConfigurationPropertySourceTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/MapConfigurationPropertySourceTests.java index cad2161631..db0027ba97 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/MapConfigurationPropertySourceTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/MapConfigurationPropertySourceTests.java @@ -37,14 +37,14 @@ public class MapConfigurationPropertySourceTests { public ExpectedException thrown = ExpectedException.none(); @Test - public void createWhenMapIsNullShouldThrowException() throws Exception { + public void createWhenMapIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Map must not be null"); new MapConfigurationPropertySource(null); } @Test - public void createWhenMapHasEntriesShouldAdaptMap() throws Exception { + public void createWhenMapHasEntriesShouldAdaptMap() { Map map = new LinkedHashMap<>(); map.put("foo.BAR", "spring"); map.put(ConfigurationPropertyName.of("foo.baz"), "boot"); @@ -54,7 +54,7 @@ public class MapConfigurationPropertySourceTests { } @Test - public void putAllWhenMapIsNullShouldThrowException() throws Exception { + public void putAllWhenMapIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Map must not be null"); MapConfigurationPropertySource source = new MapConfigurationPropertySource(); @@ -62,7 +62,7 @@ public class MapConfigurationPropertySourceTests { } @Test - public void putAllShouldPutEntries() throws Exception { + public void putAllShouldPutEntries() { Map map = new LinkedHashMap<>(); map.put("foo.BAR", "spring"); map.put("foo.baz", "boot"); @@ -73,14 +73,14 @@ public class MapConfigurationPropertySourceTests { } @Test - public void putShouldPutEntry() throws Exception { + public void putShouldPutEntry() { MapConfigurationPropertySource source = new MapConfigurationPropertySource(); source.put("foo.bar", "baz"); assertThat(getValue(source, "foo.bar")).isEqualTo("baz"); } @Test - public void getConfigurationPropertyShouldGetFromMemory() throws Exception { + public void getConfigurationPropertyShouldGetFromMemory() { MapConfigurationPropertySource source = new MapConfigurationPropertySource(); source.put("foo.bar", "baz"); assertThat(getValue(source, "foo.bar")).isEqualTo("baz"); @@ -89,7 +89,7 @@ public class MapConfigurationPropertySourceTests { } @Test - public void iteratorShouldGetFromMemory() throws Exception { + public void iteratorShouldGetFromMemory() { MapConfigurationPropertySource source = new MapConfigurationPropertySource(); source.put("foo.BAR", "spring"); source.put("foo.baz", "boot"); @@ -99,7 +99,7 @@ public class MapConfigurationPropertySourceTests { } @Test - public void streamShouldGetFromMemory() throws Exception { + public void streamShouldGetFromMemory() { MapConfigurationPropertySource source = new MapConfigurationPropertySource(); source.put("foo.BAR", "spring"); source.put("foo.baz", "boot"); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/SpringConfigurationPropertySourceTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/SpringConfigurationPropertySourceTests.java index 3911288b57..a3877cf56b 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/SpringConfigurationPropertySourceTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/SpringConfigurationPropertySourceTests.java @@ -43,21 +43,21 @@ public class SpringConfigurationPropertySourceTests { public ExpectedException thrown = ExpectedException.none(); @Test - public void createWhenPropertySourceIsNullShouldThrowException() throws Exception { + public void createWhenPropertySourceIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("PropertySource must not be null"); new SpringConfigurationPropertySource(null, mock(PropertyMapper.class), null); } @Test - public void createWhenMapperIsNullShouldThrowException() throws Exception { + public void createWhenMapperIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Mapper must not be null"); new SpringConfigurationPropertySource(mock(PropertySource.class), null, null); } @Test - public void getValueShouldUseDirectMapping() throws Exception { + public void getValueShouldUseDirectMapping() { Map source = new LinkedHashMap<>(); source.put("key1", "value1"); source.put("key2", "value2"); @@ -72,7 +72,7 @@ public class SpringConfigurationPropertySourceTests { } @Test - public void getValueShouldUseExtractor() throws Exception { + public void getValueShouldUseExtractor() { Map source = new LinkedHashMap<>(); source.put("key", "value"); PropertySource propertySource = new MapPropertySource("test", source); @@ -86,7 +86,7 @@ public class SpringConfigurationPropertySourceTests { } @Test - public void getValueOrigin() throws Exception { + public void getValueOrigin() { Map source = new LinkedHashMap<>(); source.put("key", "value"); PropertySource propertySource = new MapPropertySource("test", source); @@ -100,7 +100,7 @@ public class SpringConfigurationPropertySourceTests { } @Test - public void getValueWhenOriginCapableShouldIncludeSourceOrigin() throws Exception { + public void getValueWhenOriginCapableShouldIncludeSourceOrigin() { Map source = new LinkedHashMap<>(); source.put("key", "value"); PropertySource propertySource = new OriginCapablePropertySource<>( @@ -115,7 +115,7 @@ public class SpringConfigurationPropertySourceTests { } @Test - public void containsDescendantOfShouldReturnEmpty() throws Exception { + public void containsDescendantOfShouldReturnEmpty() { Map source = new LinkedHashMap<>(); source.put("foo.bar", "value"); PropertySource propertySource = new MapPropertySource("test", source); @@ -126,14 +126,14 @@ public class SpringConfigurationPropertySourceTests { } @Test - public void fromWhenPropertySourceIsNullShouldThrowException() throws Exception { + public void fromWhenPropertySourceIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Source must not be null"); SpringConfigurationPropertySource.from(null); } @Test - public void fromWhenNonEnumerableShouldReturnNonIterable() throws Exception { + public void fromWhenNonEnumerableShouldReturnNonIterable() { PropertySource propertySource = new PropertySource("test", new Object()) { @@ -149,8 +149,7 @@ public class SpringConfigurationPropertySourceTests { } @Test - public void fromWhenEnumerableButRestrictedShouldReturnNonIterable() - throws Exception { + public void fromWhenEnumerableButRestrictedShouldReturnNonIterable() { Map source = new LinkedHashMap() { @Override @@ -165,7 +164,7 @@ public class SpringConfigurationPropertySourceTests { } @Test - public void getWhenEnumerableShouldBeIterable() throws Exception { + public void getWhenEnumerableShouldBeIterable() { Map source = new LinkedHashMap<>(); source.put("fooBar", "Spring ${barBaz} ${bar-baz}"); source.put("barBaz", "Boot"); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/SpringConfigurationPropertySourcesTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/SpringConfigurationPropertySourcesTests.java index 67a1694399..d753c78e84 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/SpringConfigurationPropertySourcesTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/SpringConfigurationPropertySourcesTests.java @@ -44,14 +44,14 @@ public class SpringConfigurationPropertySourcesTests { public ExpectedException thrown = ExpectedException.none(); @Test - public void createWhenPropertySourcesIsNullShouldThrowException() throws Exception { + public void createWhenPropertySourcesIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Sources must not be null"); new SpringConfigurationPropertySources(null); } @Test - public void shouldAdaptPropertySource() throws Exception { + public void shouldAdaptPropertySource() { MutablePropertySources sources = new MutablePropertySources(); sources.addFirst( new MapPropertySource("test", Collections.singletonMap("a", "b"))); @@ -64,7 +64,7 @@ public class SpringConfigurationPropertySourcesTests { } @Test - public void shouldAdaptSystemEnvironmentPropertySource() throws Exception { + public void shouldAdaptSystemEnvironmentPropertySource() { MutablePropertySources sources = new MutablePropertySources(); sources.addLast(new SystemEnvironmentPropertySource( StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME, @@ -78,7 +78,7 @@ public class SpringConfigurationPropertySourcesTests { } @Test - public void shouldExtendedAdaptSystemEnvironmentPropertySource() throws Exception { + public void shouldExtendedAdaptSystemEnvironmentPropertySource() { MutablePropertySources sources = new MutablePropertySources(); sources.addLast(new SystemEnvironmentPropertySource( "test-" + StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME, @@ -92,7 +92,7 @@ public class SpringConfigurationPropertySourcesTests { } @Test - public void shouldNotAdaptSystemEnvironmentPropertyOverrideSource() throws Exception { + public void shouldNotAdaptSystemEnvironmentPropertyOverrideSource() { MutablePropertySources sources = new MutablePropertySources(); sources.addLast(new SystemEnvironmentPropertySource("override", Collections.singletonMap("server.port", "1234"))); @@ -105,7 +105,7 @@ public class SpringConfigurationPropertySourcesTests { } @Test - public void shouldAdaptMultiplePropertySources() throws Exception { + public void shouldAdaptMultiplePropertySources() { MutablePropertySources sources = new MutablePropertySources(); sources.addLast(new SystemEnvironmentPropertySource("system", Collections.singletonMap("SERVER_PORT", "1234"))); @@ -127,7 +127,7 @@ public class SpringConfigurationPropertySourcesTests { } @Test - public void shouldFlattenEnvironment() throws Exception { + public void shouldFlattenEnvironment() { StandardEnvironment environment = new StandardEnvironment(); environment.getPropertySources().addFirst( new MapPropertySource("foo", Collections.singletonMap("foo", "bar"))); @@ -150,7 +150,7 @@ public class SpringConfigurationPropertySourcesTests { } @Test - public void shouldTrackChanges() throws Exception { + public void shouldTrackChanges() { MutablePropertySources sources = new MutablePropertySources(); sources.addLast( new MapPropertySource("test1", Collections.singletonMap("a", "b"))); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/SpringIterableConfigurationPropertySourceTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/SpringIterableConfigurationPropertySourceTests.java index b8a57dd8f1..b05a0b2797 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/SpringIterableConfigurationPropertySourceTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/SpringIterableConfigurationPropertySourceTests.java @@ -44,14 +44,14 @@ public class SpringIterableConfigurationPropertySourceTests { public ExpectedException thrown = ExpectedException.none(); @Test - public void createWhenPropertySourceIsNullShouldThrowException() throws Exception { + public void createWhenPropertySourceIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("PropertySource must not be null"); new SpringIterableConfigurationPropertySource(null, mock(PropertyMapper.class)); } @Test - public void createWhenMapperIsNullShouldThrowException() throws Exception { + public void createWhenMapperIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Mapper must not be null"); new SpringIterableConfigurationPropertySource( @@ -59,7 +59,7 @@ public class SpringIterableConfigurationPropertySourceTests { } @Test - public void iteratorShouldAdaptNames() throws Exception { + public void iteratorShouldAdaptNames() { Map source = new LinkedHashMap<>(); source.put("key1", "value1"); source.put("key2", "value2"); @@ -78,7 +78,7 @@ public class SpringIterableConfigurationPropertySourceTests { } @Test - public void getValueShouldUseDirectMapping() throws Exception { + public void getValueShouldUseDirectMapping() { Map source = new LinkedHashMap<>(); source.put("key1", "value1"); source.put("key2", "value2"); @@ -94,7 +94,7 @@ public class SpringIterableConfigurationPropertySourceTests { } @Test - public void getValueShouldUseEnumerableMapping() throws Exception { + public void getValueShouldUseEnumerableMapping() { Map source = new LinkedHashMap<>(); source.put("key1", "value1"); source.put("key2", "value2"); @@ -111,7 +111,7 @@ public class SpringIterableConfigurationPropertySourceTests { } @Test - public void getValueShouldUseExtractor() throws Exception { + public void getValueShouldUseExtractor() { Map source = new LinkedHashMap<>(); source.put("key", "value"); EnumerablePropertySource propertySource = new MapPropertySource("test", @@ -126,7 +126,7 @@ public class SpringIterableConfigurationPropertySourceTests { } @Test - public void getValueOrigin() throws Exception { + public void getValueOrigin() { Map source = new LinkedHashMap<>(); source.put("key", "value"); EnumerablePropertySource propertySource = new MapPropertySource("test", @@ -141,7 +141,7 @@ public class SpringIterableConfigurationPropertySourceTests { } @Test - public void getValueWhenOriginCapableShouldIncludeSourceOrigin() throws Exception { + public void getValueWhenOriginCapableShouldIncludeSourceOrigin() { Map source = new LinkedHashMap<>(); source.put("key", "value"); EnumerablePropertySource propertySource = new OriginCapablePropertySource<>( @@ -156,7 +156,7 @@ public class SpringIterableConfigurationPropertySourceTests { } @Test - public void containsDescendantOfShouldCheckSourceNames() throws Exception { + public void containsDescendantOfShouldCheckSourceNames() { Map source = new LinkedHashMap<>(); source.put("foo.bar", "value"); source.put("faf", "value"); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/SystemEnvironmentPropertyMapperTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/SystemEnvironmentPropertyMapperTests.java index 13a3acca96..a99ddab42e 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/SystemEnvironmentPropertyMapperTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/SystemEnvironmentPropertyMapperTests.java @@ -42,7 +42,7 @@ public class SystemEnvironmentPropertyMapperTests extends AbstractPropertyMapper } @Test - public void mapFromStringShouldReturnBestGuess() throws Exception { + public void mapFromStringShouldReturnBestGuess() { assertThat(namesFromString("SERVER")).containsExactly("server"); assertThat(namesFromString("SERVER_PORT")).containsExactly("server.port"); assertThat(namesFromString("HOST_0")).containsExactly("host[0]"); @@ -57,7 +57,7 @@ public class SystemEnvironmentPropertyMapperTests extends AbstractPropertyMapper } @Test - public void mapFromConfigurationShouldReturnBestGuess() throws Exception { + public void mapFromConfigurationShouldReturnBestGuess() { assertThat(namesFromConfiguration("server")).containsExactly("SERVER"); assertThat(namesFromConfiguration("server.port")).containsExactly("SERVER_PORT"); assertThat(namesFromConfiguration("host[0]")).containsExactly("HOST_0"); @@ -70,7 +70,7 @@ public class SystemEnvironmentPropertyMapperTests extends AbstractPropertyMapper } @Test - public void mapFromStringWhenListShortcutShouldExtractValues() throws Exception { + public void mapFromStringWhenListShortcutShouldExtractValues() { Map source = new LinkedHashMap<>(); source.put("SERVER__", "foo,bar,baz"); PropertySource propertySource = new MapPropertySource("test", source); @@ -85,8 +85,7 @@ public class SystemEnvironmentPropertyMapperTests extends AbstractPropertyMapper } @Test - public void mapFromConfigurationShouldIncludeShortcutAndExtractValues() - throws Exception { + public void mapFromConfigurationShouldIncludeShortcutAndExtractValues() { Map source = new LinkedHashMap<>(); source.put("SERVER__", "foo,bar,baz"); PropertySource propertySource = new MapPropertySource("test", source); @@ -104,7 +103,7 @@ public class SystemEnvironmentPropertyMapperTests extends AbstractPropertyMapper } @Test - public void underscoreShouldNotMapToEmptyString() throws Exception { + public void underscoreShouldNotMapToEmptyString() { Map source = new LinkedHashMap<>(); PropertySource propertySource = new MapPropertySource("test", source); List mappings = getMapper().map(propertySource, "_"); @@ -116,7 +115,7 @@ public class SystemEnvironmentPropertyMapperTests extends AbstractPropertyMapper } @Test - public void underscoreWithWhitespaceShouldNotMapToEmptyString() throws Exception { + public void underscoreWithWhitespaceShouldNotMapToEmptyString() { Map source = new LinkedHashMap<>(); PropertySource propertySource = new MapPropertySource("test", source); List mappings = getMapper().map(propertySource, " _"); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/UnboundElementsSourceFilterTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/UnboundElementsSourceFilterTests.java index 43d592469e..b82cfaf1c8 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/UnboundElementsSourceFilterTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/UnboundElementsSourceFilterTests.java @@ -38,14 +38,13 @@ public class UnboundElementsSourceFilterTests { private ConfigurationPropertySource source; @Before - public void setUp() throws Exception { + public void setUp() { this.filter = new UnboundElementsSourceFilter(); this.source = mock(ConfigurationPropertySource.class); } @Test - public void filterWhenSourceIsSystemPropertiesPropertySourceShouldReturnFalse() - throws Exception { + public void filterWhenSourceIsSystemPropertiesPropertySourceShouldReturnFalse() { MockPropertySource propertySource = new MockPropertySource( StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME); given(this.source.getUnderlyingSource()).willReturn(propertySource); @@ -53,8 +52,7 @@ public class UnboundElementsSourceFilterTests { } @Test - public void filterWhenSourceIsSystemEnvironmentPropertySourceShouldReturnFalse() - throws Exception { + public void filterWhenSourceIsSystemEnvironmentPropertySourceShouldReturnFalse() { MockPropertySource propertySource = new MockPropertySource( StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME); given(this.source.getUnderlyingSource()).willReturn(propertySource); @@ -62,7 +60,7 @@ public class UnboundElementsSourceFilterTests { } @Test - public void filterWhenSourceIsNotSystemShouldReturnTrue() throws Exception { + public void filterWhenSourceIsNotSystemShouldReturnTrue() { MockPropertySource propertySource = new MockPropertySource("test"); given(this.source.getUnderlyingSource()).willReturn(propertySource); assertThat(this.filter.apply(this.source)).isTrue(); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/BeanCurrentlyInCreationFailureAnalyzerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/BeanCurrentlyInCreationFailureAnalyzerTests.java index fe6496ffeb..3c46f715dc 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/BeanCurrentlyInCreationFailureAnalyzerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/BeanCurrentlyInCreationFailureAnalyzerTests.java @@ -118,7 +118,7 @@ public class BeanCurrentlyInCreationFailureAnalyzerTests { } @Test - public void cycleWithAnUnknownStartIsNotAnalyzed() throws IOException { + public void cycleWithAnUnknownStartIsNotAnalyzed() { assertThat(this.analyzer.analyze(new BeanCurrentlyInCreationException("test"))) .isNull(); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/BindFailureAnalyzerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/BindFailureAnalyzerTests.java index f7ff7c782c..e4f1ba4fa6 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/BindFailureAnalyzerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/BindFailureAnalyzerTests.java @@ -44,7 +44,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class BindFailureAnalyzerTests { @Test - public void analysisForUnboundElementsIsNull() throws Exception { + public void analysisForUnboundElementsIsNull() { FailureAnalysis analysis = performAnalysis( UnboundElementsFailureConfiguration.class, "test.foo.listValue[0]=hello", "test.foo.listValue[2]=world"); @@ -52,14 +52,14 @@ public class BindFailureAnalyzerTests { } @Test - public void analysisForValidationExceptionIsNull() throws Exception { + public void analysisForValidationExceptionIsNull() { FailureAnalysis analysis = performAnalysis( FieldValidationFailureConfiguration.class, "test.foo.value=1"); assertThat(analysis).isNull(); } @Test - public void bindExceptionDueToOtherFailure() throws Exception { + public void bindExceptionDueToOtherFailure() { FailureAnalysis analysis = performAnalysis(GenericFailureConfiguration.class, "test.foo.value=${BAR}"); assertThat(analysis.getDescription()).contains(failure("test.foo.value", "${BAR}", diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/BindValidationFailureAnalyzerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/BindValidationFailureAnalyzerTests.java index 008e572cd9..db6632893b 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/BindValidationFailureAnalyzerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/BindValidationFailureAnalyzerTests.java @@ -74,7 +74,7 @@ public class BindValidationFailureAnalyzerTests { } @Test - public void bindExceptionWithOriginDueToValidationFailure() throws Exception { + public void bindExceptionWithOriginDueToValidationFailure() { FailureAnalysis analysis = performAnalysis( FieldValidationFailureConfiguration.class, "test.foo.value=4"); assertThat(analysis.getDescription()) @@ -82,7 +82,7 @@ public class BindValidationFailureAnalyzerTests { } @Test - public void bindExceptionWithObjectErrorsDueToValidationFailure() throws Exception { + public void bindExceptionWithObjectErrorsDueToValidationFailure() { FailureAnalysis analysis = performAnalysis( ObjectValidationFailureConfiguration.class); assertThat(analysis.getDescription()) @@ -90,7 +90,7 @@ public class BindValidationFailureAnalyzerTests { } @Test - public void otherBindExceptionShouldReturnAnalysis() throws Exception { + public void otherBindExceptionShouldReturnAnalysis() { BindException cause = new BindException(new FieldValidationFailureProperties(), "fieldValidationFailureProperties"); cause.addError(new FieldError("test", "value", "must not be null")); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/InvalidConfigurationPropertyNameFailureAnalyzerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/InvalidConfigurationPropertyNameFailureAnalyzerTests.java index bb0f7218d7..616337ee44 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/InvalidConfigurationPropertyNameFailureAnalyzerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/InvalidConfigurationPropertyNameFailureAnalyzerTests.java @@ -37,8 +37,7 @@ public class InvalidConfigurationPropertyNameFailureAnalyzerTests { private InvalidConfigurationPropertyNameFailureAnalyzer analyzer = new InvalidConfigurationPropertyNameFailureAnalyzer(); @Test - public void analysisWhenRootCauseIsBeanCreationFailureShouldContainBeanName() - throws Exception { + public void analysisWhenRootCauseIsBeanCreationFailureShouldContainBeanName() { BeanCreationException failure = createFailure(InvalidPrefixConfiguration.class); FailureAnalysis analysis = this.analyzer.analyze(failure); assertThat(analysis.getDescription()).contains(String.format( diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/UnboundConfigurationPropertyFailureAnalyzerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/UnboundConfigurationPropertyFailureAnalyzerTests.java index 9987ccbc55..1ad6e29343 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/UnboundConfigurationPropertyFailureAnalyzerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/UnboundConfigurationPropertyFailureAnalyzerTests.java @@ -54,7 +54,7 @@ public class UnboundConfigurationPropertyFailureAnalyzerTests { } @Test - public void bindExceptionDueToUnboundElements() throws Exception { + public void bindExceptionDueToUnboundElements() { FailureAnalysis analysis = performAnalysis( UnboundElementsFailureConfiguration.class, "test.foo.listValue[0]=hello", "test.foo.listValue[2]=world"); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/ValidationExceptionFailureAnalyzerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/ValidationExceptionFailureAnalyzerTests.java index 74781cfece..ea1f06e943 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/ValidationExceptionFailureAnalyzerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/ValidationExceptionFailureAnalyzerTests.java @@ -39,7 +39,7 @@ import static org.junit.Assert.fail; public class ValidationExceptionFailureAnalyzerTests { @Test - public void test() throws Exception { + public void test() { try { new AnnotationConfigApplicationContext(TestConfiguration.class).close(); fail("Expected failure did not occur"); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedMapPropertySourceTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedMapPropertySourceTests.java index 3737726dad..958277df9f 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedMapPropertySourceTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedMapPropertySourceTests.java @@ -43,35 +43,35 @@ public class OriginTrackedMapPropertySourceTests { private Origin origin = mock(Origin.class); @Test - public void getPropertyWhenMissingShouldReturnNull() throws Exception { + public void getPropertyWhenMissingShouldReturnNull() { assertThat(this.source.getProperty("test")).isNull(); } @Test - public void getPropertyWhenNonTrackedShouldReturnValue() throws Exception { + public void getPropertyWhenNonTrackedShouldReturnValue() { this.map.put("test", "foo"); assertThat(this.source.getProperty("test")).isEqualTo("foo"); } @Test - public void getPropertyWhenTrackedShouldReturnValue() throws Exception { + public void getPropertyWhenTrackedShouldReturnValue() { this.map.put("test", OriginTrackedValue.of("foo", this.origin)); assertThat(this.source.getProperty("test")).isEqualTo("foo"); } @Test - public void getPropertyOriginWhenMissingShouldReturnNull() throws Exception { + public void getPropertyOriginWhenMissingShouldReturnNull() { assertThat(this.source.getOrigin("test")).isNull(); } @Test - public void getPropertyOriginWhenNonTrackedShouldReturnNull() throws Exception { + public void getPropertyOriginWhenNonTrackedShouldReturnNull() { this.map.put("test", "foo"); assertThat(this.source.getOrigin("test")).isNull(); } @Test - public void getPropertyOriginWhenTrackedShouldReturnOrigin() throws Exception { + public void getPropertyOriginWhenTrackedShouldReturnOrigin() { this.map.put("test", OriginTrackedValue.of("foo", this.origin)); assertThat(this.source.getOrigin("test")).isEqualTo(this.origin); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedPropertiesLoaderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedPropertiesLoaderTests.java index db90db45cc..00127bc079 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedPropertiesLoaderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedPropertiesLoaderTests.java @@ -58,56 +58,56 @@ public class OriginTrackedPropertiesLoaderTests { } @Test - public void getSimpleProperty() throws Exception { + public void getSimpleProperty() { OriginTrackedValue value = this.properties.get("test"); assertThat(getValue(value)).isEqualTo("properties"); assertThat(getLocation(value)).isEqualTo("11:6"); } @Test - public void getSimplePropertyWithColonSeparator() throws Exception { + public void getSimplePropertyWithColonSeparator() { OriginTrackedValue value = this.properties.get("test-colon-separator"); assertThat(getValue(value)).isEqualTo("my-property"); assertThat(getLocation(value)).isEqualTo("15:23"); } @Test - public void getPropertyWithSeparatorSurroundedBySpaces() throws Exception { + public void getPropertyWithSeparatorSurroundedBySpaces() { OriginTrackedValue value = this.properties.get("blah"); assertThat(getValue(value)).isEqualTo("hello world"); assertThat(getLocation(value)).isEqualTo("2:12"); } @Test - public void getUnicodeProperty() throws Exception { + public void getUnicodeProperty() { OriginTrackedValue value = this.properties.get("test-unicode"); assertThat(getValue(value)).isEqualTo("properties&test"); assertThat(getLocation(value)).isEqualTo("12:14"); } @Test - public void getEscapedProperty() throws Exception { + public void getEscapedProperty() { OriginTrackedValue value = this.properties.get("test=property"); assertThat(getValue(value)).isEqualTo("helloworld"); assertThat(getLocation(value)).isEqualTo("14:15"); } @Test - public void getPropertyWithTab() throws Exception { + public void getPropertyWithTab() { OriginTrackedValue value = this.properties.get("test-tab-property"); assertThat(getValue(value)).isEqualTo("foo\tbar"); assertThat(getLocation(value)).isEqualTo("16:19"); } @Test - public void getPropertyWithBang() throws Exception { + public void getPropertyWithBang() { OriginTrackedValue value = this.properties.get("test-bang-property"); assertThat(getValue(value)).isEqualTo("foo!"); assertThat(getLocation(value)).isEqualTo("34:20"); } @Test - public void getPropertyWithValueComment() throws Exception { + public void getPropertyWithValueComment() { OriginTrackedValue value = this.properties.get("test-property-value-comment"); assertThat(getValue(value)).isEqualTo("foo !bar #foo"); assertThat(getLocation(value)).isEqualTo("36:29"); @@ -121,35 +121,35 @@ public class OriginTrackedPropertiesLoaderTests { } @Test - public void getPropertyWithCarriageReturn() throws Exception { + public void getPropertyWithCarriageReturn() { OriginTrackedValue value = this.properties.get("test-return-property"); assertThat(getValue(value)).isEqualTo("foo\rbar"); assertThat(getLocation(value)).isEqualTo("17:22"); } @Test - public void getPropertyWithNewLine() throws Exception { + public void getPropertyWithNewLine() { OriginTrackedValue value = this.properties.get("test-newline-property"); assertThat(getValue(value)).isEqualTo("foo\nbar"); assertThat(getLocation(value)).isEqualTo("18:23"); } @Test - public void getPropertyWithFormFeed() throws Exception { + public void getPropertyWithFormFeed() { OriginTrackedValue value = this.properties.get("test-form-feed-property"); assertThat(getValue(value)).isEqualTo("foo\fbar"); assertThat(getLocation(value)).isEqualTo("19:25"); } @Test - public void getPropertyWithWhiteSpace() throws Exception { + public void getPropertyWithWhiteSpace() { OriginTrackedValue value = this.properties.get("test-whitespace-property"); assertThat(getValue(value)).isEqualTo("foo bar"); assertThat(getLocation(value)).isEqualTo("20:32"); } @Test - public void getCommentedOutPropertyShouldBeNull() throws Exception { + public void getCommentedOutPropertyShouldBeNull() { assertThat(this.properties.get("commented-property")).isNull(); assertThat(this.properties.get("#commented-property")).isNull(); assertThat(this.properties.get("commented-two")).isNull(); @@ -157,63 +157,63 @@ public class OriginTrackedPropertiesLoaderTests { } @Test - public void getMultiline() throws Exception { + public void getMultiline() { OriginTrackedValue value = this.properties.get("test-multiline"); assertThat(getValue(value)).isEqualTo("ab\\c"); assertThat(getLocation(value)).isEqualTo("21:17"); } @Test - public void getImmediateMultiline() throws Exception { + public void getImmediateMultiline() { OriginTrackedValue value = this.properties.get("test-multiline-immediate"); assertThat(getValue(value)).isEqualTo("foo"); assertThat(getLocation(value)).isEqualTo("32:1"); } @Test - public void getPropertyWithWhitespaceAfterKey() throws Exception { + public void getPropertyWithWhitespaceAfterKey() { OriginTrackedValue value = this.properties.get("bar"); assertThat(getValue(value)).isEqualTo("foo=baz"); assertThat(getLocation(value)).isEqualTo("3:7"); } @Test - public void getPropertyWithSpaceSeparator() throws Exception { + public void getPropertyWithSpaceSeparator() { OriginTrackedValue value = this.properties.get("hello"); assertThat(getValue(value)).isEqualTo("world"); assertThat(getLocation(value)).isEqualTo("4:9"); } @Test - public void getPropertyWithBackslashEscaped() throws Exception { + public void getPropertyWithBackslashEscaped() { OriginTrackedValue value = this.properties.get("proper\\ty"); assertThat(getValue(value)).isEqualTo("test"); assertThat(getLocation(value)).isEqualTo("5:11"); } @Test - public void getPropertyWithEmptyValue() throws Exception { + public void getPropertyWithEmptyValue() { OriginTrackedValue value = this.properties.get("foo"); assertThat(getValue(value)).isEqualTo(""); assertThat(getLocation(value)).isEqualTo("7:0"); } @Test - public void getPropertyWithBackslashEscapedInValue() throws Exception { + public void getPropertyWithBackslashEscapedInValue() { OriginTrackedValue value = this.properties.get("bat"); assertThat(getValue(value)).isEqualTo("a\\"); assertThat(getLocation(value)).isEqualTo("7:7"); } @Test - public void getPropertyWithSeparatorInValue() throws Exception { + public void getPropertyWithSeparatorInValue() { OriginTrackedValue value = this.properties.get("bling"); assertThat(getValue(value)).isEqualTo("a=b"); assertThat(getLocation(value)).isEqualTo("8:9"); } @Test - public void getListProperty() throws Exception { + public void getListProperty() { OriginTrackedValue apple = this.properties.get("foods[0]"); assertThat(getValue(apple)).isEqualTo("Apple"); assertThat(getLocation(apple)).isEqualTo("24:9"); @@ -229,7 +229,7 @@ public class OriginTrackedPropertiesLoaderTests { } @Test - public void getPropertyWithISO88591Character() throws Exception { + public void getPropertyWithISO88591Character() { OriginTrackedValue value = this.properties.get("test-iso8859-1-chars"); assertThat(getValue(value)).isEqualTo("æ×ÈÅÞßáñÀÿ"); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedYamlLoaderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedYamlLoaderTests.java index 4b8c777f44..d12e4118e8 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedYamlLoaderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedYamlLoaderTests.java @@ -41,20 +41,20 @@ public class OriginTrackedYamlLoaderTests { private Map result; @Before - public void setUp() throws Exception { + public void setUp() { Resource resource = new ClassPathResource("test-yaml.yml", getClass()); this.loader = new OriginTrackedYamlLoader(resource, null); } @Test - public void processSimpleKey() throws Exception { + public void processSimpleKey() { OriginTrackedValue value = getValue("name"); assertThat(value.toString()).isEqualTo("Martin D'vloper"); assertThat(getLocation(value)).isEqualTo("3:7"); } @Test - public void processMap() throws Exception { + public void processMap() { OriginTrackedValue perl = getValue("languages.perl"); OriginTrackedValue python = getValue("languages.python"); OriginTrackedValue pascal = getValue("languages.pascal"); @@ -67,7 +67,7 @@ public class OriginTrackedYamlLoaderTests { } @Test - public void processCollection() throws Exception { + public void processCollection() { OriginTrackedValue apple = getValue("foods[0]"); OriginTrackedValue orange = getValue("foods[1]"); OriginTrackedValue strawberry = getValue("foods[2]"); @@ -83,7 +83,7 @@ public class OriginTrackedYamlLoaderTests { } @Test - public void processMultiline() throws Exception { + public void processMultiline() { OriginTrackedValue education = getValue("education"); assertThat(education.toString()) .isEqualTo("4 GCSEs\n3 A-Levels\nBSc in the Internet of Things\n"); @@ -91,7 +91,7 @@ public class OriginTrackedYamlLoaderTests { } @Test - public void processWithActiveProfile() throws Exception { + public void processWithActiveProfile() { Resource resource = new ClassPathResource("test-yaml.yml", getClass()); this.loader = new OriginTrackedYamlLoader(resource, "development"); Map result = this.loader.load(); @@ -99,7 +99,7 @@ public class OriginTrackedYamlLoaderTests { } @Test - public void processListOfMaps() throws Exception { + public void processListOfMaps() { OriginTrackedValue name = getValue("example.foo[0].name"); OriginTrackedValue url = getValue("example.foo[0].url"); OriginTrackedValue bar1 = getValue("example.foo[0].bar[0].bar1"); @@ -115,7 +115,7 @@ public class OriginTrackedYamlLoaderTests { } @Test - public void processEmptyAndNullValues() throws Exception { + public void processEmptyAndNullValues() { OriginTrackedValue empty = getValue("empty"); OriginTrackedValue nullValue = getValue("null-value"); assertThat(empty.getValue()).isEqualTo(""); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/PropertiesPropertySourceLoaderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/PropertiesPropertySourceLoaderTests.java index 859b26002f..89440398e4 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/PropertiesPropertySourceLoaderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/PropertiesPropertySourceLoaderTests.java @@ -34,7 +34,7 @@ public class PropertiesPropertySourceLoaderTests { private PropertiesPropertySourceLoader loader = new PropertiesPropertySourceLoader(); @Test - public void getFileExtensions() throws Exception { + public void getFileExtensions() { assertThat(this.loader.getFileExtensions()) .isEqualTo(new String[] { "properties", "xml" }); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/SpringApplicationJsonEnvironmentPostProcessorTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/SpringApplicationJsonEnvironmentPostProcessorTests.java index 51787fd528..7e436377ea 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/SpringApplicationJsonEnvironmentPostProcessorTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/SpringApplicationJsonEnvironmentPostProcessorTests.java @@ -121,7 +121,7 @@ public class SpringApplicationJsonEnvironmentPostProcessorTests { } @Test - public void propertySourceShouldTrackOrigin() throws Exception { + public void propertySourceShouldTrackOrigin() { assertThat(this.environment.resolvePlaceholders("${foo:}")).isEmpty(); TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.environment, "spring.application.json={\"foo\":\"bar\"}"); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/SystemEnvironmentPropertySourceEnvironmentPostProcessorTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/SystemEnvironmentPropertySourceEnvironmentPostProcessorTests.java index a0690fa473..4b06e5908b 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/SystemEnvironmentPropertySourceEnvironmentPostProcessorTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/SystemEnvironmentPropertySourceEnvironmentPostProcessorTests.java @@ -41,13 +41,12 @@ public class SystemEnvironmentPropertySourceEnvironmentPostProcessorTests { private ConfigurableEnvironment environment; @Before - public void setUp() throws Exception { + public void setUp() { this.environment = new StandardEnvironment(); } @Test - public void postProcessShouldReplaceSystemEnvironmentPropertySource() - throws Exception { + public void postProcessShouldReplaceSystemEnvironmentPropertySource() { SystemEnvironmentPropertySourceEnvironmentPostProcessor postProcessor = new SystemEnvironmentPropertySourceEnvironmentPostProcessor(); postProcessor.postProcessEnvironment(this.environment, null); PropertySource replaced = this.environment.getPropertySources() @@ -58,7 +57,7 @@ public class SystemEnvironmentPropertySourceEnvironmentPostProcessorTests { @Test @SuppressWarnings("unchecked") - public void replacedPropertySourceShouldBeOriginAware() throws Exception { + public void replacedPropertySourceShouldBeOriginAware() { SystemEnvironmentPropertySourceEnvironmentPostProcessor postProcessor = new SystemEnvironmentPropertySourceEnvironmentPostProcessor(); PropertySource original = this.environment.getPropertySources() .get("systemEnvironment"); @@ -76,8 +75,7 @@ public class SystemEnvironmentPropertySourceEnvironmentPostProcessorTests { } @Test - public void replacedPropertySourceWhenPropertyAbsentShouldReturnNullOrigin() - throws Exception { + public void replacedPropertySourceWhenPropertyAbsentShouldReturnNullOrigin() { SystemEnvironmentPropertySourceEnvironmentPostProcessor postProcessor = new SystemEnvironmentPropertySourceEnvironmentPostProcessor(); postProcessor.postProcessEnvironment(this.environment, null); OriginAwareSystemEnvironmentPropertySource replaced = (OriginAwareSystemEnvironmentPropertySource) this.environment @@ -86,7 +84,7 @@ public class SystemEnvironmentPropertySourceEnvironmentPostProcessorTests { } @Test - public void replacedPropertySourceShouldResolveProperty() throws Exception { + public void replacedPropertySourceShouldResolveProperty() { SystemEnvironmentPropertySourceEnvironmentPostProcessor postProcessor = new SystemEnvironmentPropertySourceEnvironmentPostProcessor(); Map source = Collections.singletonMap("FOO_BAR_BAZ", "hello"); this.environment.getPropertySources().replace("systemEnvironment", diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jackson/JsonObjectDeserializerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jackson/JsonObjectDeserializerTests.java index d7f0048cde..e4ce9eb62a 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jackson/JsonObjectDeserializerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jackson/JsonObjectDeserializerTests.java @@ -16,7 +16,6 @@ package org.springframework.boot.jackson; -import java.io.IOException; import java.io.InputStream; import java.math.BigDecimal; import java.math.BigInteger; @@ -64,20 +63,20 @@ public class JsonObjectDeserializerTests { } @Test - public void nullSafeValueWhenValueIsNullShouldReturnNull() throws Exception { + public void nullSafeValueWhenValueIsNullShouldReturnNull() { String value = this.testDeserializer.testNullSafeValue(null, String.class); assertThat(value).isNull(); } @Test - public void nullSafeValueWhenClassIsNullShouldThrowException() throws Exception { + public void nullSafeValueWhenClassIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Type must not be null"); this.testDeserializer.testNullSafeValue(mock(JsonNode.class), null); } @Test - public void nullSafeValueWhenClassIsStringShouldReturnString() throws Exception { + public void nullSafeValueWhenClassIsStringShouldReturnString() { JsonNode node = mock(JsonNode.class); given(node.textValue()).willReturn("abc"); String value = this.testDeserializer.testNullSafeValue(node, String.class); @@ -85,7 +84,7 @@ public class JsonObjectDeserializerTests { } @Test - public void nullSafeValueWhenClassIsBooleanShouldReturnBoolean() throws Exception { + public void nullSafeValueWhenClassIsBooleanShouldReturnBoolean() { JsonNode node = mock(JsonNode.class); given(node.booleanValue()).willReturn(true); Boolean value = this.testDeserializer.testNullSafeValue(node, Boolean.class); @@ -93,7 +92,7 @@ public class JsonObjectDeserializerTests { } @Test - public void nullSafeValueWhenClassIsLongShouldReturnLong() throws Exception { + public void nullSafeValueWhenClassIsLongShouldReturnLong() { JsonNode node = mock(JsonNode.class); given(node.longValue()).willReturn(10L); Long value = this.testDeserializer.testNullSafeValue(node, Long.class); @@ -101,7 +100,7 @@ public class JsonObjectDeserializerTests { } @Test - public void nullSafeValueWhenClassIsIntegerShouldReturnInteger() throws Exception { + public void nullSafeValueWhenClassIsIntegerShouldReturnInteger() { JsonNode node = mock(JsonNode.class); given(node.intValue()).willReturn(10); Integer value = this.testDeserializer.testNullSafeValue(node, Integer.class); @@ -109,7 +108,7 @@ public class JsonObjectDeserializerTests { } @Test - public void nullSafeValueWhenClassIsShortShouldReturnShort() throws Exception { + public void nullSafeValueWhenClassIsShortShouldReturnShort() { JsonNode node = mock(JsonNode.class); given(node.shortValue()).willReturn((short) 10); Short value = this.testDeserializer.testNullSafeValue(node, Short.class); @@ -117,7 +116,7 @@ public class JsonObjectDeserializerTests { } @Test - public void nullSafeValueWhenClassIsDoubleShouldReturnDouble() throws Exception { + public void nullSafeValueWhenClassIsDoubleShouldReturnDouble() { JsonNode node = mock(JsonNode.class); given(node.doubleValue()).willReturn(1.1D); Double value = this.testDeserializer.testNullSafeValue(node, Double.class); @@ -125,7 +124,7 @@ public class JsonObjectDeserializerTests { } @Test - public void nullSafeValueWhenClassIsFloatShouldReturnFloat() throws Exception { + public void nullSafeValueWhenClassIsFloatShouldReturnFloat() { JsonNode node = mock(JsonNode.class); given(node.floatValue()).willReturn(1.1F); Float value = this.testDeserializer.testNullSafeValue(node, Float.class); @@ -133,8 +132,7 @@ public class JsonObjectDeserializerTests { } @Test - public void nullSafeValueWhenClassIsBigDecimalShouldReturnBigDecimal() - throws Exception { + public void nullSafeValueWhenClassIsBigDecimalShouldReturnBigDecimal() { JsonNode node = mock(JsonNode.class); given(node.decimalValue()).willReturn(BigDecimal.TEN); BigDecimal value = this.testDeserializer.testNullSafeValue(node, @@ -143,8 +141,7 @@ public class JsonObjectDeserializerTests { } @Test - public void nullSafeValueWhenClassIsBigIntegerShouldReturnBigInteger() - throws Exception { + public void nullSafeValueWhenClassIsBigIntegerShouldReturnBigInteger() { JsonNode node = mock(JsonNode.class); given(node.bigIntegerValue()).willReturn(BigInteger.TEN); BigInteger value = this.testDeserializer.testNullSafeValue(node, @@ -153,7 +150,7 @@ public class JsonObjectDeserializerTests { } @Test - public void nullSafeValueWhenClassIsUnknownShouldThrowException() throws Exception { + public void nullSafeValueWhenClassIsUnknownShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Unsupported value type java.io.InputStream"); this.testDeserializer.testNullSafeValue(mock(JsonNode.class), InputStream.class); @@ -161,14 +158,14 @@ public class JsonObjectDeserializerTests { } @Test - public void getRequiredNodeWhenTreeIsNullShouldThrowException() throws Exception { + public void getRequiredNodeWhenTreeIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Tree must not be null"); this.testDeserializer.testGetRequiredNode(null, "test"); } @Test - public void getRequiredNodeWhenNodeIsNullShouldThrowException() throws Exception { + public void getRequiredNodeWhenNodeIsNullShouldThrowException() { JsonNode tree = mock(JsonNode.class); given(tree.get("test")).willReturn(null); this.thrown.expect(IllegalStateException.class); @@ -177,7 +174,7 @@ public class JsonObjectDeserializerTests { } @Test - public void getRequiredNodeWhenNodeIsNullNodeShouldThrowException() throws Exception { + public void getRequiredNodeWhenNodeIsNullNodeShouldThrowException() { JsonNode tree = mock(JsonNode.class); given(tree.get("test")).willReturn(NullNode.instance); this.thrown.expect(IllegalStateException.class); @@ -186,7 +183,7 @@ public class JsonObjectDeserializerTests { } @Test - public void getRequiredNodeWhenNodeIsFoundShouldReturnNode() throws Exception { + public void getRequiredNodeWhenNodeIsFoundShouldReturnNode() { JsonNode node = mock(JsonNode.class); JsonNode tree = node; given(tree.get("test")).willReturn(node); @@ -198,8 +195,7 @@ public class JsonObjectDeserializerTests { @Override protected T deserializeObject(JsonParser jsonParser, - DeserializationContext context, ObjectCodec codec, JsonNode tree) - throws IOException { + DeserializationContext context, ObjectCodec codec, JsonNode tree) { return null; } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jdbc/DatabaseDriverTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jdbc/DatabaseDriverTests.java index 7b0f2301c0..0396a75b88 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jdbc/DatabaseDriverTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jdbc/DatabaseDriverTests.java @@ -68,7 +68,7 @@ public class DatabaseDriverTests { } @Test - public void databaseProductNameLookups() throws Exception { + public void databaseProductNameLookups() { assertThat(DatabaseDriver.fromProductName("newone")) .isEqualTo(DatabaseDriver.UNKNOWN); assertThat(DatabaseDriver.fromProductName("Apache Derby")) diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jta/atomikos/AtomikosConnectionFactoryBeanTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jta/atomikos/AtomikosConnectionFactoryBeanTests.java index 93461001c3..ac60042ea1 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jta/atomikos/AtomikosConnectionFactoryBeanTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jta/atomikos/AtomikosConnectionFactoryBeanTests.java @@ -16,8 +16,6 @@ package org.springframework.boot.jta.atomikos; -import javax.jms.JMSException; - import org.junit.Test; import static org.assertj.core.api.Assertions.assertThat; @@ -50,7 +48,7 @@ public class AtomikosConnectionFactoryBeanTests { extends AtomikosConnectionFactoryBean { @Override - public synchronized void init() throws JMSException { + public synchronized void init() { } @Override diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jta/atomikos/AtomikosDataSourceBeanTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jta/atomikos/AtomikosDataSourceBeanTests.java index 9bbcc8f9a1..eb8bb20a32 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jta/atomikos/AtomikosDataSourceBeanTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jta/atomikos/AtomikosDataSourceBeanTests.java @@ -16,7 +16,6 @@ package org.springframework.boot.jta.atomikos; -import com.atomikos.jdbc.AtomikosSQLException; import org.junit.Test; import static org.assertj.core.api.Assertions.assertThat; @@ -47,7 +46,7 @@ public class AtomikosDataSourceBeanTests { private static class MockAtomikosDataSourceBean extends AtomikosDataSourceBean { @Override - public synchronized void init() throws AtomikosSQLException { + public synchronized void init() { } @Override diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jta/bitronix/PoolingConnectionFactoryBeanTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jta/bitronix/PoolingConnectionFactoryBeanTests.java index 73df8d6352..841502f368 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jta/bitronix/PoolingConnectionFactoryBeanTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jta/bitronix/PoolingConnectionFactoryBeanTests.java @@ -40,7 +40,7 @@ public class PoolingConnectionFactoryBeanTests { }; @Test - public void sensibleDefaults() throws Exception { + public void sensibleDefaults() { assertThat(this.bean.getMaxPoolSize()).isEqualTo(10); assertThat(this.bean.getTestConnections()).isTrue(); assertThat(this.bean.getAutomaticEnlistingEnabled()).isTrue(); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jta/bitronix/PoolingDataSourceBeanTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jta/bitronix/PoolingDataSourceBeanTests.java index 86683b3a07..6ca8e1412a 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jta/bitronix/PoolingDataSourceBeanTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jta/bitronix/PoolingDataSourceBeanTests.java @@ -39,7 +39,7 @@ public class PoolingDataSourceBeanTests { private PoolingDataSourceBean bean = new PoolingDataSourceBean(); @Test - public void sensibleDefaults() throws Exception { + public void sensibleDefaults() { assertThat(this.bean.getMaxPoolSize()).isEqualTo(10); assertThat(this.bean.getAutomaticEnlistingEnabled()).isTrue(); assertThat(this.bean.isEnableJdbc4ConnectionTest()).isTrue(); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/DeferredLogTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/DeferredLogTests.java index 5d01653bd4..8d639874c6 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/DeferredLogTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/DeferredLogTests.java @@ -41,121 +41,121 @@ public class DeferredLogTests { private Log log = mock(Log.class); @Test - public void isTraceEnabled() throws Exception { + public void isTraceEnabled() { assertThat(this.deferredLog.isTraceEnabled()).isTrue(); } @Test - public void isDebugEnabled() throws Exception { + public void isDebugEnabled() { assertThat(this.deferredLog.isDebugEnabled()).isTrue(); } @Test - public void isInfoEnabled() throws Exception { + public void isInfoEnabled() { assertThat(this.deferredLog.isInfoEnabled()).isTrue(); } @Test - public void isWarnEnabled() throws Exception { + public void isWarnEnabled() { assertThat(this.deferredLog.isWarnEnabled()).isTrue(); } @Test - public void isErrorEnabled() throws Exception { + public void isErrorEnabled() { assertThat(this.deferredLog.isErrorEnabled()).isTrue(); } @Test - public void isFatalEnabled() throws Exception { + public void isFatalEnabled() { assertThat(this.deferredLog.isFatalEnabled()).isTrue(); } @Test - public void trace() throws Exception { + public void trace() { this.deferredLog.trace(this.message); this.deferredLog.replayTo(this.log); verify(this.log).trace(this.message, null); } @Test - public void traceWithThrowable() throws Exception { + public void traceWithThrowable() { this.deferredLog.trace(this.message, this.throwable); this.deferredLog.replayTo(this.log); verify(this.log).trace(this.message, this.throwable); } @Test - public void debug() throws Exception { + public void debug() { this.deferredLog.debug(this.message); this.deferredLog.replayTo(this.log); verify(this.log).debug(this.message, null); } @Test - public void debugWithThrowable() throws Exception { + public void debugWithThrowable() { this.deferredLog.debug(this.message, this.throwable); this.deferredLog.replayTo(this.log); verify(this.log).debug(this.message, this.throwable); } @Test - public void info() throws Exception { + public void info() { this.deferredLog.info(this.message); this.deferredLog.replayTo(this.log); verify(this.log).info(this.message, null); } @Test - public void infoWithThrowable() throws Exception { + public void infoWithThrowable() { this.deferredLog.info(this.message, this.throwable); this.deferredLog.replayTo(this.log); verify(this.log).info(this.message, this.throwable); } @Test - public void warn() throws Exception { + public void warn() { this.deferredLog.warn(this.message); this.deferredLog.replayTo(this.log); verify(this.log).warn(this.message, null); } @Test - public void warnWithThrowable() throws Exception { + public void warnWithThrowable() { this.deferredLog.warn(this.message, this.throwable); this.deferredLog.replayTo(this.log); verify(this.log).warn(this.message, this.throwable); } @Test - public void error() throws Exception { + public void error() { this.deferredLog.error(this.message); this.deferredLog.replayTo(this.log); verify(this.log).error(this.message, null); } @Test - public void errorWithThrowable() throws Exception { + public void errorWithThrowable() { this.deferredLog.error(this.message, this.throwable); this.deferredLog.replayTo(this.log); verify(this.log).error(this.message, this.throwable); } @Test - public void fatal() throws Exception { + public void fatal() { this.deferredLog.fatal(this.message); this.deferredLog.replayTo(this.log); verify(this.log).fatal(this.message, null); } @Test - public void fatalWithThrowable() throws Exception { + public void fatalWithThrowable() { this.deferredLog.fatal(this.message, this.throwable); this.deferredLog.replayTo(this.log); verify(this.log).fatal(this.message, this.throwable); } @Test - public void clearsOnReplayTo() throws Exception { + public void clearsOnReplayTo() { this.deferredLog.info("1"); this.deferredLog.fatal("2"); Log log2 = mock(Log.class); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/LogFileTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/LogFileTests.java index a39b19d9a2..f99727db45 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/LogFileTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/LogFileTests.java @@ -38,14 +38,14 @@ import static org.assertj.core.api.Assertions.assertThat; public class LogFileTests { @Test - public void noProperties() throws Exception { + public void noProperties() { PropertyResolver resolver = getPropertyResolver(null, null); LogFile logFile = LogFile.get(resolver); assertThat(logFile).isNull(); } @Test - public void loggingFile() throws Exception { + public void loggingFile() { PropertyResolver resolver = getPropertyResolver("log.file", null); LogFile logFile = LogFile.get(resolver); Properties properties = new Properties(); @@ -57,7 +57,7 @@ public class LogFileTests { } @Test - public void loggingPath() throws Exception { + public void loggingPath() { PropertyResolver resolver = getPropertyResolver(null, "logpath"); LogFile logFile = LogFile.get(resolver); Properties properties = new Properties(); @@ -70,7 +70,7 @@ public class LogFileTests { } @Test - public void loggingFileAndPath() throws Exception { + public void loggingFileAndPath() { PropertyResolver resolver = getPropertyResolver("log.file", "logpath"); LogFile logFile = LogFile.get(resolver); Properties properties = new Properties(); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/java/JavaLoggingSystemTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/java/JavaLoggingSystemTests.java index dad4ca69ad..028a73813c 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/java/JavaLoggingSystemTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/java/JavaLoggingSystemTests.java @@ -18,7 +18,6 @@ package org.springframework.boot.logging.java; import java.io.File; import java.io.FileFilter; -import java.io.IOException; import java.util.EnumSet; import java.util.List; import java.util.Locale; @@ -64,7 +63,7 @@ public class JavaLoggingSystemTests extends AbstractLoggingSystemTests { private Locale defaultLocale; @Before - public void init() throws SecurityException, IOException { + public void init() throws SecurityException { this.defaultLocale = Locale.getDefault(); Locale.setDefault(Locale.ENGLISH); this.logger = Logger.getLogger(getClass().getName()); @@ -81,7 +80,7 @@ public class JavaLoggingSystemTests extends AbstractLoggingSystemTests { } @Test - public void noFile() throws Exception { + public void noFile() { this.loggingSystem.beforeInitialize(); this.logger.info("Hidden"); this.loggingSystem.initialize(null, null, null); @@ -92,7 +91,7 @@ public class JavaLoggingSystemTests extends AbstractLoggingSystemTests { } @Test - public void withFile() throws Exception { + public void withFile() { File temp = new File(tmpDir()); File[] logFiles = temp.listFiles(SPRING_LOG_FILTER); for (File file : logFiles) { @@ -108,7 +107,7 @@ public class JavaLoggingSystemTests extends AbstractLoggingSystemTests { } @Test - public void testCustomFormatter() throws Exception { + public void testCustomFormatter() { this.loggingSystem.beforeInitialize(); this.loggingSystem.initialize(null, null, null); this.logger.info("Hello world"); @@ -117,7 +116,7 @@ public class JavaLoggingSystemTests extends AbstractLoggingSystemTests { } @Test - public void testSystemPropertyInitializesFormat() throws Exception { + public void testSystemPropertyInitializesFormat() { System.setProperty(LoggingSystemProperties.PID_KEY, "1234"); this.loggingSystem.beforeInitialize(); this.loggingSystem.initialize(null, "classpath:" + ClassUtils @@ -129,7 +128,7 @@ public class JavaLoggingSystemTests extends AbstractLoggingSystemTests { } @Test - public void testNonDefaultConfigLocation() throws Exception { + public void testNonDefaultConfigLocation() { this.loggingSystem.beforeInitialize(); this.loggingSystem.initialize(null, "classpath:logging-nondefault.properties", null); @@ -139,7 +138,7 @@ public class JavaLoggingSystemTests extends AbstractLoggingSystemTests { } @Test(expected = IllegalStateException.class) - public void testNonexistentConfigLocation() throws Exception { + public void testNonexistentConfigLocation() { this.loggingSystem.beforeInitialize(); this.loggingSystem.initialize(null, "classpath:logging-nonexistent.properties", null); @@ -153,7 +152,7 @@ public class JavaLoggingSystemTests extends AbstractLoggingSystemTests { } @Test - public void setLevel() throws Exception { + public void setLevel() { this.loggingSystem.beforeInitialize(); this.loggingSystem.initialize(null, null, null); this.logger.fine("Hello"); @@ -164,7 +163,7 @@ public class JavaLoggingSystemTests extends AbstractLoggingSystemTests { } @Test - public void setLevelToNull() throws Exception { + public void setLevelToNull() { this.loggingSystem.beforeInitialize(); this.loggingSystem.initialize(null, null, null); this.logger.fine("Hello"); @@ -177,7 +176,7 @@ public class JavaLoggingSystemTests extends AbstractLoggingSystemTests { } @Test - public void getLoggingConfigurations() throws Exception { + public void getLoggingConfigurations() { this.loggingSystem.beforeInitialize(); this.loggingSystem.initialize(null, null, null); this.loggingSystem.setLogLevel(getClass().getName(), LogLevel.DEBUG); @@ -189,7 +188,7 @@ public class JavaLoggingSystemTests extends AbstractLoggingSystemTests { } @Test - public void getLoggingConfiguration() throws Exception { + public void getLoggingConfiguration() { this.loggingSystem.beforeInitialize(); this.loggingSystem.initialize(null, null, null); this.loggingSystem.setLogLevel(getClass().getName(), LogLevel.DEBUG); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/ColorConverterTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/ColorConverterTests.java index 3659c2fcd2..4c0cd9dae6 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/ColorConverterTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/ColorConverterTests.java @@ -72,42 +72,42 @@ public class ColorConverterTests { } @Test - public void green() throws Exception { + public void green() { StringBuilder output = new StringBuilder(); newConverter("green").format(this.event, output); assertThat(output.toString()).isEqualTo("\033[32min\033[0;39m"); } @Test - public void yellow() throws Exception { + public void yellow() { StringBuilder output = new StringBuilder(); newConverter("yellow").format(this.event, output); assertThat(output.toString()).isEqualTo("\033[33min\033[0;39m"); } @Test - public void blue() throws Exception { + public void blue() { StringBuilder output = new StringBuilder(); newConverter("blue").format(this.event, output); assertThat(output.toString()).isEqualTo("\033[34min\033[0;39m"); } @Test - public void magenta() throws Exception { + public void magenta() { StringBuilder output = new StringBuilder(); newConverter("magenta").format(this.event, output); assertThat(output.toString()).isEqualTo("\033[35min\033[0;39m"); } @Test - public void cyan() throws Exception { + public void cyan() { StringBuilder output = new StringBuilder(); newConverter("cyan").format(this.event, output); assertThat(output.toString()).isEqualTo("\033[36min\033[0;39m"); } @Test - public void highlightFatal() throws Exception { + public void highlightFatal() { this.event.setLevel(Level.FATAL); StringBuilder output = new StringBuilder(); newConverter(null).format(this.event, output); @@ -115,7 +115,7 @@ public class ColorConverterTests { } @Test - public void highlightError() throws Exception { + public void highlightError() { this.event.setLevel(Level.ERROR); StringBuilder output = new StringBuilder(); newConverter(null).format(this.event, output); @@ -123,7 +123,7 @@ public class ColorConverterTests { } @Test - public void highlightWarn() throws Exception { + public void highlightWarn() { this.event.setLevel(Level.WARN); StringBuilder output = new StringBuilder(); newConverter(null).format(this.event, output); @@ -131,7 +131,7 @@ public class ColorConverterTests { } @Test - public void highlightDebug() throws Exception { + public void highlightDebug() { this.event.setLevel(Level.DEBUG); StringBuilder output = new StringBuilder(); newConverter(null).format(this.event, output); @@ -139,7 +139,7 @@ public class ColorConverterTests { } @Test - public void highlightTrace() throws Exception { + public void highlightTrace() { this.event.setLevel(Level.TRACE); StringBuilder output = new StringBuilder(); newConverter(null).format(this.event, output); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/ExtendedWhitespaceThrowablePatternConverterTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/ExtendedWhitespaceThrowablePatternConverterTests.java index f576e4c5df..01bab8fc36 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/ExtendedWhitespaceThrowablePatternConverterTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/ExtendedWhitespaceThrowablePatternConverterTests.java @@ -38,7 +38,7 @@ public class ExtendedWhitespaceThrowablePatternConverterTests { .newInstance(new DefaultConfiguration(), new String[] {}); @Test - public void noStackTrace() throws Exception { + public void noStackTrace() { LogEvent event = Log4jLogEvent.newBuilder().build(); StringBuilder builder = new StringBuilder(); this.converter.format(event, builder); @@ -46,7 +46,7 @@ public class ExtendedWhitespaceThrowablePatternConverterTests { } @Test - public void withStackTrace() throws Exception { + public void withStackTrace() { LogEvent event = Log4jLogEvent.newBuilder().setThrown(new Exception()).build(); StringBuilder builder = new StringBuilder(); this.converter.format(event, builder); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystemTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystemTests.java index 5cca9f5ad2..5d90482fe6 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystemTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystemTests.java @@ -79,7 +79,7 @@ public class Log4J2LoggingSystemTests extends AbstractLoggingSystemTests { } @Test - public void noFile() throws Exception { + public void noFile() { this.loggingSystem.beforeInitialize(); this.logger.info("Hidden"); this.loggingSystem.initialize(null, null, null); @@ -92,7 +92,7 @@ public class Log4J2LoggingSystemTests extends AbstractLoggingSystemTests { } @Test - public void withFile() throws Exception { + public void withFile() { this.loggingSystem.beforeInitialize(); this.logger.info("Hidden"); this.loggingSystem.initialize(null, null, getLogFile(null, tmpDir())); @@ -105,7 +105,7 @@ public class Log4J2LoggingSystemTests extends AbstractLoggingSystemTests { } @Test - public void testNonDefaultConfigLocation() throws Exception { + public void testNonDefaultConfigLocation() { this.loggingSystem.beforeInitialize(); this.loggingSystem.initialize(null, "classpath:log4j2-nondefault.xml", getLogFile(tmpDir() + "/tmp.log", null)); @@ -120,7 +120,7 @@ public class Log4J2LoggingSystemTests extends AbstractLoggingSystemTests { } @Test(expected = IllegalStateException.class) - public void testNonexistentConfigLocation() throws Exception { + public void testNonexistentConfigLocation() { this.loggingSystem.beforeInitialize(); this.loggingSystem.initialize(null, "classpath:log4j2-nonexistent.xml", null); } @@ -132,7 +132,7 @@ public class Log4J2LoggingSystemTests extends AbstractLoggingSystemTests { } @Test - public void setLevel() throws Exception { + public void setLevel() { this.loggingSystem.beforeInitialize(); this.loggingSystem.initialize(null, null, null); this.logger.debug("Hello"); @@ -143,7 +143,7 @@ public class Log4J2LoggingSystemTests extends AbstractLoggingSystemTests { } @Test - public void setLevelToNull() throws Exception { + public void setLevelToNull() { this.loggingSystem.beforeInitialize(); this.loggingSystem.initialize(null, null, null); this.logger.debug("Hello"); @@ -156,7 +156,7 @@ public class Log4J2LoggingSystemTests extends AbstractLoggingSystemTests { } @Test - public void getLoggingConfigurations() throws Exception { + public void getLoggingConfigurations() { this.loggingSystem.beforeInitialize(); this.loggingSystem.initialize(null, null, null); this.loggingSystem.setLogLevel(getClass().getName(), LogLevel.DEBUG); @@ -168,7 +168,7 @@ public class Log4J2LoggingSystemTests extends AbstractLoggingSystemTests { } @Test - public void getLoggingConfiguration() throws Exception { + public void getLoggingConfiguration() { this.loggingSystem.beforeInitialize(); this.loggingSystem.initialize(null, null, null); this.loggingSystem.setLogLevel(getClass().getName(), LogLevel.DEBUG); @@ -179,8 +179,7 @@ public class Log4J2LoggingSystemTests extends AbstractLoggingSystemTests { } @Test - public void setLevelOfUnconfiguredLoggerDoesNotAffectRootConfiguration() - throws Exception { + public void setLevelOfUnconfiguredLoggerDoesNotAffectRootConfiguration() { this.loggingSystem.beforeInitialize(); this.loggingSystem.initialize(null, null, null); LogManager.getRootLogger().debug("Hello"); @@ -232,7 +231,7 @@ public class Log4J2LoggingSystemTests extends AbstractLoggingSystemTests { } @Test - public void springConfigLocations() throws Exception { + public void springConfigLocations() { String[] locations = getSpringConfigLocations(this.loggingSystem); assertThat(locations).isEqualTo(new String[] { "log4j2-spring.xml" }); } @@ -250,7 +249,7 @@ public class Log4J2LoggingSystemTests extends AbstractLoggingSystemTests { } @Test - public void beforeInitializeFilterDisablesErrorLogging() throws Exception { + public void beforeInitializeFilterDisablesErrorLogging() { this.loggingSystem.beforeInitialize(); assertThat(this.logger.isErrorEnabled()).isFalse(); this.loggingSystem.initialize(null, null, getLogFile(null, tmpDir())); @@ -279,7 +278,7 @@ public class Log4J2LoggingSystemTests extends AbstractLoggingSystemTests { } @Test - public void initializationIsOnlyPerformedOnceUntilCleanedUp() throws Exception { + public void initializationIsOnlyPerformedOnceUntilCleanedUp() { LoggerContext loggerContext = (LoggerContext) LogManager.getContext(false); PropertyChangeListener listener = mock(PropertyChangeListener.class); loggerContext.addPropertyChangeListener(listener); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/WhitespaceThrowablePatternConverterTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/WhitespaceThrowablePatternConverterTests.java index 48069e998e..7076e4a98a 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/WhitespaceThrowablePatternConverterTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/WhitespaceThrowablePatternConverterTests.java @@ -37,7 +37,7 @@ public class WhitespaceThrowablePatternConverterTests { .newInstance(new DefaultConfiguration(), new String[] {}); @Test - public void noStackTrace() throws Exception { + public void noStackTrace() { LogEvent event = Log4jLogEvent.newBuilder().build(); StringBuilder builder = new StringBuilder(); this.converter.format(event, builder); @@ -45,7 +45,7 @@ public class WhitespaceThrowablePatternConverterTests { } @Test - public void withStackTrace() throws Exception { + public void withStackTrace() { LogEvent event = Log4jLogEvent.newBuilder().setThrown(new Exception()).build(); StringBuilder builder = new StringBuilder(); this.converter.format(event, builder); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/ColorConverterTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/ColorConverterTests.java index 337653ec35..e798aeea5c 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/ColorConverterTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/ColorConverterTests.java @@ -59,77 +59,77 @@ public class ColorConverterTests { } @Test - public void faint() throws Exception { + public void faint() { this.converter.setOptionList(Collections.singletonList("faint")); String out = this.converter.transform(this.event, this.in); assertThat(out).isEqualTo("\033[2min\033[0;39m"); } @Test - public void red() throws Exception { + public void red() { this.converter.setOptionList(Collections.singletonList("red")); String out = this.converter.transform(this.event, this.in); assertThat(out).isEqualTo("\033[31min\033[0;39m"); } @Test - public void green() throws Exception { + public void green() { this.converter.setOptionList(Collections.singletonList("green")); String out = this.converter.transform(this.event, this.in); assertThat(out).isEqualTo("\033[32min\033[0;39m"); } @Test - public void yellow() throws Exception { + public void yellow() { this.converter.setOptionList(Collections.singletonList("yellow")); String out = this.converter.transform(this.event, this.in); assertThat(out).isEqualTo("\033[33min\033[0;39m"); } @Test - public void blue() throws Exception { + public void blue() { this.converter.setOptionList(Collections.singletonList("blue")); String out = this.converter.transform(this.event, this.in); assertThat(out).isEqualTo("\033[34min\033[0;39m"); } @Test - public void magenta() throws Exception { + public void magenta() { this.converter.setOptionList(Collections.singletonList("magenta")); String out = this.converter.transform(this.event, this.in); assertThat(out).isEqualTo("\033[35min\033[0;39m"); } @Test - public void cyan() throws Exception { + public void cyan() { this.converter.setOptionList(Collections.singletonList("cyan")); String out = this.converter.transform(this.event, this.in); assertThat(out).isEqualTo("\033[36min\033[0;39m"); } @Test - public void highlightError() throws Exception { + public void highlightError() { this.event.setLevel(Level.ERROR); String out = this.converter.transform(this.event, this.in); assertThat(out).isEqualTo("\033[31min\033[0;39m"); } @Test - public void highlightWarn() throws Exception { + public void highlightWarn() { this.event.setLevel(Level.WARN); String out = this.converter.transform(this.event, this.in); assertThat(out).isEqualTo("\033[33min\033[0;39m"); } @Test - public void highlightDebug() throws Exception { + public void highlightDebug() { this.event.setLevel(Level.DEBUG); String out = this.converter.transform(this.event, this.in); assertThat(out).isEqualTo("\033[32min\033[0;39m"); } @Test - public void highlightTrace() throws Exception { + public void highlightTrace() { this.event.setLevel(Level.TRACE); String out = this.converter.transform(this.event, this.in); assertThat(out).isEqualTo("\033[32min\033[0;39m"); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/ExtendedWhitespaceThrowableProxyConverterTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/ExtendedWhitespaceThrowableProxyConverterTests.java index 7905fc056d..0faa489eb1 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/ExtendedWhitespaceThrowableProxyConverterTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/ExtendedWhitespaceThrowableProxyConverterTests.java @@ -37,13 +37,13 @@ public class ExtendedWhitespaceThrowableProxyConverterTests { private final LoggingEvent event = new LoggingEvent(); @Test - public void noStackTrace() throws Exception { + public void noStackTrace() { String s = this.converter.convert(this.event); assertThat(s).isEmpty(); } @Test - public void withStackTrace() throws Exception { + public void withStackTrace() { this.event.setThrowableProxy(new ThrowableProxy(new RuntimeException())); String s = this.converter.convert(this.event); assertThat(s).startsWith(LINE_SEPARATOR).endsWith(LINE_SEPARATOR); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java index 14cae94634..b8b7eff226 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java @@ -103,7 +103,7 @@ public class LogbackLoggingSystemTests extends AbstractLoggingSystemTests { } @Test - public void noFile() throws Exception { + public void noFile() { this.loggingSystem.beforeInitialize(); this.logger.info("Hidden"); this.loggingSystem.initialize(this.initializationContext, null, null); @@ -134,13 +134,13 @@ public class LogbackLoggingSystemTests extends AbstractLoggingSystemTests { } @Test - public void testBasicConfigLocation() throws Exception { + public void testBasicConfigLocation() { this.loggingSystem.beforeInitialize(); assertThat(getConsoleAppender()).isNotNull(); } @Test - public void testNonDefaultConfigLocation() throws Exception { + public void testNonDefaultConfigLocation() { this.loggingSystem.beforeInitialize(); this.loggingSystem.initialize(this.initializationContext, "classpath:logback-nondefault.xml", @@ -153,7 +153,7 @@ public class LogbackLoggingSystemTests extends AbstractLoggingSystemTests { } @Test - public void testLogbackSpecificSystemProperty() throws Exception { + public void testLogbackSpecificSystemProperty() { System.setProperty("logback.configurationFile", "/foo/my-file.xml"); try { this.loggingSystem.beforeInitialize(); @@ -168,7 +168,7 @@ public class LogbackLoggingSystemTests extends AbstractLoggingSystemTests { } @Test(expected = IllegalStateException.class) - public void testNonexistentConfigLocation() throws Exception { + public void testNonexistentConfigLocation() { this.loggingSystem.beforeInitialize(); this.loggingSystem.initialize(this.initializationContext, "classpath:logback-nonexistent.xml", null); @@ -182,7 +182,7 @@ public class LogbackLoggingSystemTests extends AbstractLoggingSystemTests { } @Test - public void setLevel() throws Exception { + public void setLevel() { this.loggingSystem.beforeInitialize(); this.loggingSystem.initialize(this.initializationContext, null, null); this.logger.debug("Hello"); @@ -193,7 +193,7 @@ public class LogbackLoggingSystemTests extends AbstractLoggingSystemTests { } @Test - public void setLevelToNull() throws Exception { + public void setLevelToNull() { this.loggingSystem.beforeInitialize(); this.loggingSystem.initialize(this.initializationContext, null, null); this.logger.debug("Hello"); @@ -206,7 +206,7 @@ public class LogbackLoggingSystemTests extends AbstractLoggingSystemTests { } @Test - public void getLoggingConfigurations() throws Exception { + public void getLoggingConfigurations() { this.loggingSystem.beforeInitialize(); this.loggingSystem.initialize(this.initializationContext, null, null); this.loggingSystem.setLogLevel(getClass().getName(), LogLevel.DEBUG); @@ -218,7 +218,7 @@ public class LogbackLoggingSystemTests extends AbstractLoggingSystemTests { } @Test - public void getLoggingConfiguration() throws Exception { + public void getLoggingConfiguration() { this.loggingSystem.beforeInitialize(); this.loggingSystem.initialize(this.initializationContext, null, null); this.loggingSystem.setLogLevel(getClass().getName(), LogLevel.DEBUG); @@ -229,7 +229,7 @@ public class LogbackLoggingSystemTests extends AbstractLoggingSystemTests { } @Test - public void getLoggingConfigurationForALL() throws Exception { + public void getLoggingConfigurationForALL() { this.loggingSystem.beforeInitialize(); this.loggingSystem.initialize(this.initializationContext, null, null); Logger logger = (Logger) StaticLoggerBinder.getSingleton().getLoggerFactory() @@ -242,7 +242,7 @@ public class LogbackLoggingSystemTests extends AbstractLoggingSystemTests { } @Test - public void systemLevelTraceShouldReturnNativeLevelTraceNotAll() throws Exception { + public void systemLevelTraceShouldReturnNativeLevelTraceNotAll() { this.loggingSystem.beforeInitialize(); this.loggingSystem.initialize(this.initializationContext, null, null); this.loggingSystem.setLogLevel(getClass().getName(), LogLevel.TRACE); @@ -284,14 +284,14 @@ public class LogbackLoggingSystemTests extends AbstractLoggingSystemTests { } @Test - public void standardConfigLocations() throws Exception { + public void standardConfigLocations() { String[] locations = this.loggingSystem.getStandardConfigLocations(); assertThat(locations).containsExactly("logback-test.groovy", "logback-test.xml", "logback.groovy", "logback.xml"); } @Test - public void springConfigLocations() throws Exception { + public void springConfigLocations() { String[] locations = getSpringConfigLocations(this.loggingSystem); assertThat(locations).containsExactly("logback-test-spring.groovy", "logback-test-spring.xml", "logback-spring.groovy", "logback-spring.xml"); @@ -444,7 +444,7 @@ public class LogbackLoggingSystemTests extends AbstractLoggingSystemTests { } @Test - public void initializeShouldSetSystemProperty() throws Exception { + public void initializeShouldSetSystemProperty() { // gh-5491 this.loggingSystem.beforeInitialize(); this.logger.info("Hidden"); @@ -456,7 +456,7 @@ public class LogbackLoggingSystemTests extends AbstractLoggingSystemTests { } @Test - public void initializationIsOnlyPerformedOnceUntilCleanedUp() throws Exception { + public void initializationIsOnlyPerformedOnceUntilCleanedUp() { LoggerContext loggerContext = (LoggerContext) StaticLoggerBinder.getSingleton() .getLoggerFactory(); LoggerContextListener listener = mock(LoggerContextListener.class); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/WhitespaceThrowableProxyConverterTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/WhitespaceThrowableProxyConverterTests.java index 3c7834be2d..220c746588 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/WhitespaceThrowableProxyConverterTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/WhitespaceThrowableProxyConverterTests.java @@ -37,13 +37,13 @@ public class WhitespaceThrowableProxyConverterTests { private final LoggingEvent event = new LoggingEvent(); @Test - public void noStackTrace() throws Exception { + public void noStackTrace() { String s = this.converter.convert(this.event); assertThat(s).isEqualTo(""); } @Test - public void withStackTrace() throws Exception { + public void withStackTrace() { this.event.setThrowableProxy(new ThrowableProxy(new RuntimeException())); String s = this.converter.convert(this.event); assertThat(s).startsWith(LINE_SEPARATOR).endsWith(LINE_SEPARATOR); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/OriginLookupTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/OriginLookupTests.java index 1413413bb5..be8593619e 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/OriginLookupTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/OriginLookupTests.java @@ -31,20 +31,19 @@ import static org.mockito.Mockito.mock; public class OriginLookupTests { @Test - public void getOriginWhenSourceIsNullShouldReturnNull() throws Exception { + public void getOriginWhenSourceIsNullShouldReturnNull() { assertThat(OriginLookup.getOrigin(null, "foo")).isNull(); } @Test - public void getOriginWhenSourceIsNotLookupShouldReturnLookupOrigin() - throws Exception { + public void getOriginWhenSourceIsNotLookupShouldReturnLookupOrigin() { Object source = new Object(); assertThat(OriginLookup.getOrigin(source, "foo")).isNull(); } @Test @SuppressWarnings("unchecked") - public void getOriginWhenSourceIsLookupShouldReturnLookupOrigin() throws Exception { + public void getOriginWhenSourceIsLookupShouldReturnLookupOrigin() { OriginLookup source = mock(OriginLookup.class); Origin origin = MockOrigin.of("bar"); given(source.getOrigin("foo")).willReturn(origin); @@ -53,8 +52,7 @@ public class OriginLookupTests { @Test @SuppressWarnings("unchecked") - public void getOriginWhenSourceLookupThrowsAndErrorShouldReturnNull() - throws Exception { + public void getOriginWhenSourceLookupThrowsAndErrorShouldReturnNull() { OriginLookup source = mock(OriginLookup.class); willThrow(RuntimeException.class).given(source).getOrigin("foo"); assertThat(OriginLookup.getOrigin(source, "foo")).isNull(); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/OriginTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/OriginTests.java index bb9b2c56d8..1eb363f104 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/OriginTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/OriginTests.java @@ -30,25 +30,24 @@ import static org.mockito.Mockito.mock; public class OriginTests { @Test - public void fromWhenSourceIsNullShouldReturnNull() throws Exception { + public void fromWhenSourceIsNullShouldReturnNull() { assertThat(Origin.from(null)).isNull(); } @Test - public void fromWhenSourceIsRegularObjectShouldReturnNull() throws Exception { + public void fromWhenSourceIsRegularObjectShouldReturnNull() { Object source = new Object(); assertThat(Origin.from(source)).isNull(); } @Test - public void fromWhenSourceIsOriginShouldReturnSource() throws Exception { + public void fromWhenSourceIsOriginShouldReturnSource() { Origin origin = mock(Origin.class); assertThat(Origin.from(origin)).isEqualTo(origin); } @Test - public void fromWhenSourceIsOriginProviderShouldReturnProvidedOrigin() - throws Exception { + public void fromWhenSourceIsOriginProviderShouldReturnProvidedOrigin() { Origin origin = mock(Origin.class); OriginProvider originProvider = mock(OriginProvider.class); given(originProvider.getOrigin()).willReturn(origin); @@ -56,15 +55,14 @@ public class OriginTests { } @Test - public void fromWhenSourceIsThrowableShouldUseCause() throws Exception { + public void fromWhenSourceIsThrowableShouldUseCause() { Origin origin = mock(Origin.class); Exception exception = new RuntimeException(new TestException(origin, null)); assertThat(Origin.from(exception)).isEqualTo(origin); } @Test - public void fromWhenSourceIsThrowableAndOriginProviderThatReturnsNullShouldUseCause() - throws Exception { + public void fromWhenSourceIsThrowableAndOriginProviderThatReturnsNullShouldUseCause() { Origin origin = mock(Origin.class); Exception exception = new TestException(null, new TestException(origin, null)); assertThat(Origin.from(exception)).isEqualTo(origin); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/OriginTrackedValueTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/OriginTrackedValueTests.java index 0f3ef77b98..742bf23362 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/OriginTrackedValueTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/OriginTrackedValueTests.java @@ -29,26 +29,26 @@ import static org.mockito.Mockito.mock; public class OriginTrackedValueTests { @Test - public void getValueShouldReturnValue() throws Exception { + public void getValueShouldReturnValue() { Object value = new Object(); assertThat(OriginTrackedValue.of(value).getValue()).isEqualTo(value); } @Test - public void getOriginShouldReturnOrigin() throws Exception { + public void getOriginShouldReturnOrigin() { Object value = new Object(); Origin origin = mock(Origin.class); assertThat(OriginTrackedValue.of(value, origin).getOrigin()).isEqualTo(origin); } @Test - public void toStringShouldReturnValueToString() throws Exception { + public void toStringShouldReturnValueToString() { Object value = new Object(); assertThat(OriginTrackedValue.of(value).toString()).isEqualTo(value.toString()); } @Test - public void hashCodeAndEqualsShouldIgnoreOrigin() throws Exception { + public void hashCodeAndEqualsShouldIgnoreOrigin() { Object value1 = new Object(); OriginTrackedValue tracked1 = OriginTrackedValue.of(value1); OriginTrackedValue tracked2 = OriginTrackedValue.of(value1, mock(Origin.class)); @@ -59,13 +59,13 @@ public class OriginTrackedValueTests { } @Test - public void ofWhenValueIsNullShouldReturnNull() throws Exception { + public void ofWhenValueIsNullShouldReturnNull() { assertThat(OriginTrackedValue.of(null)).isNull(); assertThat(OriginTrackedValue.of(null, mock(Origin.class))).isNull(); } @Test - public void ofWhenValueIsCharSequenceShouldReturnCharSequence() throws Exception { + public void ofWhenValueIsCharSequenceShouldReturnCharSequence() { String value = "foo"; OriginTrackedValue tracked = OriginTrackedValue.of(value); assertThat(tracked).isInstanceOf(CharSequence.class); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/PropertySourceOriginTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/PropertySourceOriginTests.java index 8d29961b9c..c7fada14ef 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/PropertySourceOriginTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/PropertySourceOriginTests.java @@ -48,35 +48,35 @@ public class PropertySourceOriginTests { } @Test - public void createWhenPropertyNameIsNullShouldThrowException() throws Exception { + public void createWhenPropertyNameIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("PropertyName must not be empty"); new PropertySourceOrigin(mock(PropertySource.class), null); } @Test - public void createWhenPropertyNameIsEmptyShouldThrowException() throws Exception { + public void createWhenPropertyNameIsEmptyShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("PropertyName must not be empty"); new PropertySourceOrigin(mock(PropertySource.class), ""); } @Test - public void getPropertySourceShouldReturnPropertySource() throws Exception { + public void getPropertySourceShouldReturnPropertySource() { MapPropertySource propertySource = new MapPropertySource("test", new HashMap<>()); PropertySourceOrigin origin = new PropertySourceOrigin(propertySource, "foo"); assertThat(origin.getPropertySource()).isEqualTo(propertySource); } @Test - public void getPropertyNameShouldReturnPropertyName() throws Exception { + public void getPropertyNameShouldReturnPropertyName() { MapPropertySource propertySource = new MapPropertySource("test", new HashMap<>()); PropertySourceOrigin origin = new PropertySourceOrigin(propertySource, "foo"); assertThat(origin.getPropertyName()).isEqualTo("foo"); } @Test - public void toStringShouldShowDetails() throws Exception { + public void toStringShouldShowDetails() { MapPropertySource propertySource = new MapPropertySource("test", new HashMap<>()); PropertySourceOrigin origin = new PropertySourceOrigin(propertySource, "foo"); assertThat(origin.toString()).isEqualTo("\"foo\" from property source \"test\""); @@ -84,8 +84,7 @@ public class PropertySourceOriginTests { @Test @SuppressWarnings("unchecked") - public void getWhenPropertySourceSupportsOriginLookupShouldReturnOrigin() - throws Exception { + public void getWhenPropertySourceSupportsOriginLookupShouldReturnOrigin() { Origin origin = mock(Origin.class); PropertySource propertySource = mock(PropertySource.class, withSettings().extraInterfaces(OriginLookup.class)); @@ -95,8 +94,7 @@ public class PropertySourceOriginTests { } @Test - public void getWhenPropertySourceSupportsOriginLookupButNoOriginShouldWrap() - throws Exception { + public void getWhenPropertySourceSupportsOriginLookupButNoOriginShouldWrap() { PropertySource propertySource = mock(PropertySource.class, withSettings().extraInterfaces(OriginLookup.class)); assertThat(PropertySourceOrigin.get(propertySource, "foo")) @@ -104,7 +102,7 @@ public class PropertySourceOriginTests { } @Test - public void getWhenPropertySourceIsNotOriginAwareShouldWrap() throws Exception { + public void getWhenPropertySourceIsNotOriginAwareShouldWrap() { MapPropertySource propertySource = new MapPropertySource("test", new HashMap<>()); PropertySourceOrigin origin = new PropertySourceOrigin(propertySource, "foo"); assertThat(origin.getPropertySource()).isEqualTo(propertySource); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/SystemEnvironmentOriginTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/SystemEnvironmentOriginTests.java index 07a18e29e8..99894ff2ea 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/SystemEnvironmentOriginTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/SystemEnvironmentOriginTests.java @@ -33,25 +33,25 @@ public class SystemEnvironmentOriginTests { public ExpectedException thrown = ExpectedException.none(); @Test - public void createWhenPropertyIsNullShouldThrowException() throws Exception { + public void createWhenPropertyIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); new SystemEnvironmentOrigin(null); } @Test - public void createWhenPropertyNameIsEmptyShouldThrowException() throws Exception { + public void createWhenPropertyNameIsEmptyShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); new SystemEnvironmentOrigin(""); } @Test - public void getPropertyShouldReturnProperty() throws Exception { + public void getPropertyShouldReturnProperty() { SystemEnvironmentOrigin origin = new SystemEnvironmentOrigin("FOO_BAR"); assertThat(origin.getProperty()).isEqualTo("FOO_BAR"); } @Test - public void toStringShouldReturnStringWithDetails() throws Exception { + public void toStringShouldReturnStringWithDetails() { SystemEnvironmentOrigin origin = new SystemEnvironmentOrigin("FOO_BAR"); assertThat(origin.toString()) .isEqualTo("System Environment Property \"FOO_BAR\""); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/TextResourceOriginTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/TextResourceOriginTests.java index 6b7d0d1a8d..27a6f280c7 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/TextResourceOriginTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/TextResourceOriginTests.java @@ -31,26 +31,26 @@ import static org.assertj.core.api.Assertions.assertThat; public class TextResourceOriginTests { @Test - public void createWithNullResourceShouldSetNullResource() throws Exception { + public void createWithNullResourceShouldSetNullResource() { TextResourceOrigin origin = new TextResourceOrigin(null, null); assertThat(origin.getResource()).isNull(); } @Test - public void createWithNullLocationShouldSetNullLocation() throws Exception { + public void createWithNullLocationShouldSetNullLocation() { TextResourceOrigin origin = new TextResourceOrigin(null, null); assertThat(origin.getLocation()).isNull(); } @Test - public void getResourceShouldReturnResource() throws Exception { + public void getResourceShouldReturnResource() { ClassPathResource resource = new ClassPathResource("foo.txt"); TextResourceOrigin origin = new TextResourceOrigin(resource, null); assertThat(origin.getResource()).isEqualTo(resource); } @Test - public void getLocationShouldReturnLocation() throws Exception { + public void getLocationShouldReturnLocation() { Location location = new Location(1, 2); TextResourceOrigin origin = new TextResourceOrigin(null, location); assertThat(origin.getLocation()).isEqualTo(location); @@ -58,25 +58,25 @@ public class TextResourceOriginTests { } @Test - public void getLocationLineShouldReturnLine() throws Exception { + public void getLocationLineShouldReturnLine() { Location location = new Location(1, 2); assertThat(location.getLine()).isEqualTo(1); } @Test - public void getLocationColumnShouldReturnColumn() throws Exception { + public void getLocationColumnShouldReturnColumn() { Location location = new Location(1, 2); assertThat(location.getColumn()).isEqualTo(2); } @Test - public void locationToStringShouldReturnNiceString() throws Exception { + public void locationToStringShouldReturnNiceString() { Location location = new Location(1, 2); assertThat(location.toString()).isEqualTo("2:3"); } @Test - public void toStringShouldReturnNiceString() throws Exception { + public void toStringShouldReturnNiceString() { ClassPathResource resource = new ClassPathResource("foo.txt"); Location location = new Location(1, 2); TextResourceOrigin origin = new TextResourceOrigin(resource, location); @@ -84,21 +84,21 @@ public class TextResourceOriginTests { } @Test - public void toStringWhenResourceIsNullShouldReturnNiceString() throws Exception { + public void toStringWhenResourceIsNullShouldReturnNiceString() { Location location = new Location(1, 2); TextResourceOrigin origin = new TextResourceOrigin(null, location); assertThat(origin.toString()).isEqualTo("unknown resource [?]:2:3"); } @Test - public void toStringWhenLocationIsNullShouldReturnNiceString() throws Exception { + public void toStringWhenLocationIsNullShouldReturnNiceString() { ClassPathResource resource = new ClassPathResource("foo.txt"); TextResourceOrigin origin = new TextResourceOrigin(resource, null); assertThat(origin.toString()).isEqualTo("class path resource [foo.txt]"); } @Test - public void locationEqualsAndHashCodeShouldUseLineAndColumn() throws Exception { + public void locationEqualsAndHashCodeShouldUseLineAndColumn() { Location location1 = new Location(1, 2); Location location2 = new Location(1, 2); Location location3 = new Location(2, 2); @@ -111,7 +111,7 @@ public class TextResourceOriginTests { } @Test - public void equalsAndHashCodeShouldResourceAndLocation() throws Exception { + public void equalsAndHashCodeShouldResourceAndLocation() { TextResourceOrigin origin1 = new TextResourceOrigin( new ClassPathResource("foo.txt"), new Location(1, 2)); TextResourceOrigin origin2 = new TextResourceOrigin( diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/orm/jpa/hibernate/SpringPhysicalNamingStrategyTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/orm/jpa/hibernate/SpringPhysicalNamingStrategyTests.java index 9ccdf87a26..38fe9c27a3 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/orm/jpa/hibernate/SpringPhysicalNamingStrategyTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/orm/jpa/hibernate/SpringPhysicalNamingStrategyTests.java @@ -46,7 +46,7 @@ public class SpringPhysicalNamingStrategyTests { private StandardServiceRegistry serviceRegistry; @Before - public void setup() throws Exception { + public void setup() { this.metadataSources = new MetadataSources(); this.metadataSources.addAnnotatedClass(TelephoneNumber.class); this.serviceRegistry = getServiceRegistry(this.metadataSources); @@ -61,14 +61,14 @@ public class SpringPhysicalNamingStrategyTests { } @Test - public void tableNameShouldBeLowercaseUnderscore() throws Exception { + public void tableNameShouldBeLowercaseUnderscore() { PersistentClass binding = this.metadata .getEntityBinding(TelephoneNumber.class.getName()); assertThat(binding.getTable().getQuotedName()).isEqualTo("telephone_number"); } @Test - public void tableNameShouldNotBeLowerCaseIfCaseSensitive() throws Exception { + public void tableNameShouldNotBeLowerCaseIfCaseSensitive() { this.metadata = this.metadataSources.getMetadataBuilder(this.serviceRegistry) .applyPhysicalNamingStrategy(new TestSpringPhysicalNamingStrategy()) .build(); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/security/ApplicationContextRequestMatcherTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/security/ApplicationContextRequestMatcherTests.java index 830353e8f2..b6cb1e3fdf 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/security/ApplicationContextRequestMatcherTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/security/ApplicationContextRequestMatcherTests.java @@ -41,23 +41,21 @@ public class ApplicationContextRequestMatcherTests { public ExpectedException thrown = ExpectedException.none(); @Test - public void createWhenContextClassIsNullShouldThrowException() throws Exception { + public void createWhenContextClassIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Context class must not be null"); new TestApplicationContextRequestMatcher<>(null); } @Test - public void matchesWhenContextClassIsApplicationContextShouldProvideContext() - throws Exception { + public void matchesWhenContextClassIsApplicationContextShouldProvideContext() { StaticWebApplicationContext context = createWebApplicationContext(); assertThat(new TestApplicationContextRequestMatcher<>(ApplicationContext.class) .callMatchesAndReturnProvidedContext(context)).isEqualTo(context); } @Test - public void matchesWhenContextClassIsExistingBeanShouldProvideBean() - throws Exception { + public void matchesWhenContextClassIsExistingBeanShouldProvideBean() { StaticWebApplicationContext context = createWebApplicationContext(); context.registerSingleton("existingBean", ExistingBean.class); assertThat(new TestApplicationContextRequestMatcher<>(ExistingBean.class) @@ -66,7 +64,7 @@ public class ApplicationContextRequestMatcherTests { } @Test - public void matchesWhenContextClassIsNewBeanShouldProvideBean() throws Exception { + public void matchesWhenContextClassIsNewBeanShouldProvideBean() { StaticWebApplicationContext context = createWebApplicationContext(); context.registerSingleton("existingBean", ExistingBean.class); assertThat(new TestApplicationContextRequestMatcher<>(NewBean.class) diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/system/JavaVersionTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/system/JavaVersionTests.java index dacccb4497..e0c54637ca 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/system/JavaVersionTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/system/JavaVersionTests.java @@ -48,32 +48,32 @@ public class JavaVersionTests { } @Test - public void isEqualOrNewerThanWhenComparingSameShouldBeTrue() throws Exception { + public void isEqualOrNewerThanWhenComparingSameShouldBeTrue() { assertThat(JavaVersion.EIGHT.isEqualOrNewerThan(JavaVersion.EIGHT)).isTrue(); } @Test - public void isEqualOrNewerThanWhenSmallerToGreaterShouldBeFalse() throws Exception { + public void isEqualOrNewerThanWhenSmallerToGreaterShouldBeFalse() { assertThat(JavaVersion.EIGHT.isEqualOrNewerThan(JavaVersion.NINE)).isFalse(); } @Test - public void isEqualOrNewerThanWhenGreaterToSmallerShouldBeTrue() throws Exception { + public void isEqualOrNewerThanWhenGreaterToSmallerShouldBeTrue() { assertThat(JavaVersion.NINE.isEqualOrNewerThan(JavaVersion.EIGHT)).isTrue(); } @Test - public void isOlderThanThanWhenComparingSameShouldBeFalse() throws Exception { + public void isOlderThanThanWhenComparingSameShouldBeFalse() { assertThat(JavaVersion.EIGHT.isOlderThan(JavaVersion.EIGHT)).isFalse(); } @Test - public void isOlderThanWhenSmallerToGreaterShouldBeTrue() throws Exception { + public void isOlderThanWhenSmallerToGreaterShouldBeTrue() { assertThat(JavaVersion.EIGHT.isOlderThan(JavaVersion.NINE)).isTrue(); } @Test - public void isOlderThanWhenGreaterToSmallerShouldBeFalse() throws Exception { + public void isOlderThanWhenGreaterToSmallerShouldBeFalse() { assertThat(JavaVersion.NINE.isOlderThan(JavaVersion.EIGHT)).isFalse(); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/type/classreading/ConcurrentReferenceCachingMetadataReaderFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/type/classreading/ConcurrentReferenceCachingMetadataReaderFactoryTests.java index d5b2191e56..a878ddfed3 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/type/classreading/ConcurrentReferenceCachingMetadataReaderFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/type/classreading/ConcurrentReferenceCachingMetadataReaderFactoryTests.java @@ -16,8 +16,6 @@ package org.springframework.boot.type.classreading; -import java.io.IOException; - import org.junit.Test; import org.springframework.core.io.Resource; @@ -63,7 +61,7 @@ public class ConcurrentReferenceCachingMetadataReaderFactoryTests { extends ConcurrentReferenceCachingMetadataReaderFactory { @Override - public MetadataReader createMetadataReader(Resource resource) throws IOException { + public MetadataReader createMetadataReader(Resource resource) { return mock(MetadataReader.class); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/validation/MessageInterpolatorFactoryWithoutElIntegrationTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/validation/MessageInterpolatorFactoryWithoutElIntegrationTests.java index 1e95c6e33b..c607324537 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/validation/MessageInterpolatorFactoryWithoutElIntegrationTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/validation/MessageInterpolatorFactoryWithoutElIntegrationTests.java @@ -44,7 +44,7 @@ public class MessageInterpolatorFactoryWithoutElIntegrationTests { public ExpectedException thrown = ExpectedException.none(); @Test - public void defaultMessageInterpolatorShouldFail() throws Exception { + public void defaultMessageInterpolatorShouldFail() { // Sanity test this.thrown.expect(ValidationException.class); this.thrown.expectMessage("javax.el.ExpressionFactory"); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/RestTemplateBuilderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/RestTemplateBuilderTests.java index 63d09821fd..ef3faf4dfe 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/RestTemplateBuilderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/RestTemplateBuilderTests.java @@ -78,7 +78,7 @@ public class RestTemplateBuilderTests { } @Test - public void createWhenCustomizersAreNullShouldThrowException() throws Exception { + public void createWhenCustomizersAreNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Customizers must not be null"); RestTemplateCustomizer[] customizers = null; @@ -86,28 +86,28 @@ public class RestTemplateBuilderTests { } @Test - public void createWithCustomizersShouldApplyCustomizers() throws Exception { + public void createWithCustomizersShouldApplyCustomizers() { RestTemplateCustomizer customizer = mock(RestTemplateCustomizer.class); RestTemplate template = new RestTemplateBuilder(customizer).build(); verify(customizer).customize(template); } @Test - public void buildShouldDetectRequestFactory() throws Exception { + public void buildShouldDetectRequestFactory() { RestTemplate restTemplate = this.builder.build(); assertThat(restTemplate.getRequestFactory()) .isInstanceOf(HttpComponentsClientHttpRequestFactory.class); } @Test - public void detectRequestFactoryWhenFalseShouldDisableDetection() throws Exception { + public void detectRequestFactoryWhenFalseShouldDisableDetection() { RestTemplate restTemplate = this.builder.detectRequestFactory(false).build(); assertThat(restTemplate.getRequestFactory()) .isInstanceOf(SimpleClientHttpRequestFactory.class); } @Test - public void rootUriShouldApply() throws Exception { + public void rootUriShouldApply() { RestTemplate restTemplate = this.builder.rootUri("http://example.com").build(); MockRestServiceServer server = MockRestServiceServer.bindTo(restTemplate).build(); server.expect(requestTo("http://example.com/hello")).andRespond(withSuccess()); @@ -116,7 +116,7 @@ public class RestTemplateBuilderTests { } @Test - public void rootUriShouldApplyAfterUriTemplateHandler() throws Exception { + public void rootUriShouldApplyAfterUriTemplateHandler() { UriTemplateHandler uriTemplateHandler = mock(UriTemplateHandler.class); RestTemplate template = this.builder.uriTemplateHandler(uriTemplateHandler) .rootUri("http://example.com").build(); @@ -127,30 +127,28 @@ public class RestTemplateBuilderTests { } @Test - public void messageConvertersWhenConvertersAreNullShouldThrowException() - throws Exception { + public void messageConvertersWhenConvertersAreNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("MessageConverters must not be null"); this.builder.messageConverters((HttpMessageConverter[]) null); } @Test - public void messageConvertersCollectionWhenConvertersAreNullShouldThrowException() - throws Exception { + public void messageConvertersCollectionWhenConvertersAreNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("MessageConverters must not be null"); this.builder.messageConverters((Set>) null); } @Test - public void messageConvertersShouldApply() throws Exception { + public void messageConvertersShouldApply() { RestTemplate template = this.builder.messageConverters(this.messageConverter) .build(); assertThat(template.getMessageConverters()).containsOnly(this.messageConverter); } @Test - public void messageConvertersShouldReplaceExisting() throws Exception { + public void messageConvertersShouldReplaceExisting() { RestTemplate template = this.builder .messageConverters(new ResourceHttpMessageConverter()) .messageConverters(Collections.singleton(this.messageConverter)).build(); @@ -158,23 +156,21 @@ public class RestTemplateBuilderTests { } @Test - public void additionalMessageConvertersWhenConvertersAreNullShouldThrowException() - throws Exception { + public void additionalMessageConvertersWhenConvertersAreNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("MessageConverters must not be null"); this.builder.additionalMessageConverters((HttpMessageConverter[]) null); } @Test - public void additionalMessageConvertersCollectionWhenConvertersAreNullShouldThrowException() - throws Exception { + public void additionalMessageConvertersCollectionWhenConvertersAreNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("MessageConverters must not be null"); this.builder.additionalMessageConverters((Set>) null); } @Test - public void additionalMessageConvertersShouldAddToExisting() throws Exception { + public void additionalMessageConvertersShouldAddToExisting() { HttpMessageConverter resourceConverter = new ResourceHttpMessageConverter(); RestTemplate template = this.builder.messageConverters(resourceConverter) .additionalMessageConverters(this.messageConverter).build(); @@ -183,7 +179,7 @@ public class RestTemplateBuilderTests { } @Test - public void defaultMessageConvertersShouldSetDefaultList() throws Exception { + public void defaultMessageConvertersShouldSetDefaultList() { RestTemplate template = new RestTemplate( Collections.singletonList(new StringHttpMessageConverter())); this.builder.defaultMessageConverters().configure(template); @@ -192,7 +188,7 @@ public class RestTemplateBuilderTests { } @Test - public void defaultMessageConvertersShouldClearExisting() throws Exception { + public void defaultMessageConvertersShouldClearExisting() { RestTemplate template = new RestTemplate( Collections.singletonList(new StringHttpMessageConverter())); this.builder.additionalMessageConverters(this.messageConverter) @@ -202,29 +198,27 @@ public class RestTemplateBuilderTests { } @Test - public void interceptorsWhenInterceptorsAreNullShouldThrowException() - throws Exception { + public void interceptorsWhenInterceptorsAreNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("interceptors must not be null"); this.builder.interceptors((ClientHttpRequestInterceptor[]) null); } @Test - public void interceptorsCollectionWhenInterceptorsAreNullShouldThrowException() - throws Exception { + public void interceptorsCollectionWhenInterceptorsAreNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("interceptors must not be null"); this.builder.interceptors((Set) null); } @Test - public void interceptorsShouldApply() throws Exception { + public void interceptorsShouldApply() { RestTemplate template = this.builder.interceptors(this.interceptor).build(); assertThat(template.getInterceptors()).containsOnly(this.interceptor); } @Test - public void interceptorsShouldReplaceExisting() throws Exception { + public void interceptorsShouldReplaceExisting() { RestTemplate template = this.builder .interceptors(mock(ClientHttpRequestInterceptor.class)) .interceptors(Collections.singleton(this.interceptor)).build(); @@ -232,23 +226,21 @@ public class RestTemplateBuilderTests { } @Test - public void additionalInterceptorsWhenInterceptorsAreNullShouldThrowException() - throws Exception { + public void additionalInterceptorsWhenInterceptorsAreNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("interceptors must not be null"); this.builder.additionalInterceptors((ClientHttpRequestInterceptor[]) null); } @Test - public void additionalInterceptorsCollectionWhenInterceptorsAreNullShouldThrowException() - throws Exception { + public void additionalInterceptorsCollectionWhenInterceptorsAreNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("interceptors must not be null"); this.builder.additionalInterceptors((Set) null); } @Test - public void additionalInterceptorsShouldAddToExisting() throws Exception { + public void additionalInterceptorsShouldAddToExisting() { ClientHttpRequestInterceptor interceptor = mock( ClientHttpRequestInterceptor.class); RestTemplate template = this.builder.interceptors(interceptor) @@ -258,15 +250,14 @@ public class RestTemplateBuilderTests { } @Test - public void requestFactoryClassWhenFactoryIsNullShouldThrowException() - throws Exception { + public void requestFactoryClassWhenFactoryIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("RequestFactory must not be null"); this.builder.requestFactory((Class) null); } @Test - public void requestFactoryClassShouldApply() throws Exception { + public void requestFactoryClassShouldApply() { RestTemplate template = this.builder .requestFactory(SimpleClientHttpRequestFactory.class).build(); assertThat(template.getRequestFactory()) @@ -274,7 +265,7 @@ public class RestTemplateBuilderTests { } @Test - public void requestFactoryPackagePrivateClassShouldApply() throws Exception { + public void requestFactoryPackagePrivateClassShouldApply() { RestTemplate template = this.builder .requestFactory(TestClientHttpRequestFactory.class).build(); assertThat(template.getRequestFactory()) @@ -282,29 +273,28 @@ public class RestTemplateBuilderTests { } @Test - public void requestFactoryWhenFactoryIsNullShouldThrowException() throws Exception { + public void requestFactoryWhenFactoryIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("RequestFactory must not be null"); this.builder.requestFactory((ClientHttpRequestFactory) null); } @Test - public void requestFactoryShouldApply() throws Exception { + public void requestFactoryShouldApply() { ClientHttpRequestFactory requestFactory = mock(ClientHttpRequestFactory.class); RestTemplate template = this.builder.requestFactory(requestFactory).build(); assertThat(template.getRequestFactory()).isSameAs(requestFactory); } @Test - public void uriTemplateHandlerWhenHandlerIsNullShouldThrowException() - throws Exception { + public void uriTemplateHandlerWhenHandlerIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("UriTemplateHandler must not be null"); this.builder.uriTemplateHandler(null); } @Test - public void uriTemplateHandlerShouldApply() throws Exception { + public void uriTemplateHandlerShouldApply() { UriTemplateHandler uriTemplateHandler = mock(UriTemplateHandler.class); RestTemplate template = this.builder.uriTemplateHandler(uriTemplateHandler) .build(); @@ -312,21 +302,21 @@ public class RestTemplateBuilderTests { } @Test - public void errorHandlerWhenHandlerIsNullShouldThrowException() throws Exception { + public void errorHandlerWhenHandlerIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("ErrorHandler must not be null"); this.builder.errorHandler(null); } @Test - public void errorHandlerShouldApply() throws Exception { + public void errorHandlerShouldApply() { ResponseErrorHandler errorHandler = mock(ResponseErrorHandler.class); RestTemplate template = this.builder.errorHandler(errorHandler).build(); assertThat(template.getErrorHandler()).isSameAs(errorHandler); } @Test - public void basicAuthorizationShouldApply() throws Exception { + public void basicAuthorizationShouldApply() { RestTemplate template = this.builder.basicAuthorization("spring", "boot").build(); ClientHttpRequestInterceptor interceptor = template.getInterceptors().get(0); assertThat(interceptor).isInstanceOf(BasicAuthorizationInterceptor.class); @@ -335,29 +325,28 @@ public class RestTemplateBuilderTests { } @Test - public void customizersWhenCustomizersAreNullShouldThrowException() throws Exception { + public void customizersWhenCustomizersAreNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("RestTemplateCustomizers must not be null"); this.builder.customizers((RestTemplateCustomizer[]) null); } @Test - public void customizersCollectionWhenCustomizersAreNullShouldThrowException() - throws Exception { + public void customizersCollectionWhenCustomizersAreNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("RestTemplateCustomizers must not be null"); this.builder.customizers((Set) null); } @Test - public void customizersShouldApply() throws Exception { + public void customizersShouldApply() { RestTemplateCustomizer customizer = mock(RestTemplateCustomizer.class); RestTemplate template = this.builder.customizers(customizer).build(); verify(customizer).customize(template); } @Test - public void customizersShouldBeAppliedLast() throws Exception { + public void customizersShouldBeAppliedLast() { RestTemplate template = spy(new RestTemplate()); this.builder.additionalCustomizers((restTemplate) -> verify(restTemplate) .setRequestFactory((ClientHttpRequestFactory) any())); @@ -365,7 +354,7 @@ public class RestTemplateBuilderTests { } @Test - public void customizersShouldReplaceExisting() throws Exception { + public void customizersShouldReplaceExisting() { RestTemplateCustomizer customizer1 = mock(RestTemplateCustomizer.class); RestTemplateCustomizer customizer2 = mock(RestTemplateCustomizer.class); RestTemplate template = this.builder.customizers(customizer1) @@ -375,23 +364,21 @@ public class RestTemplateBuilderTests { } @Test - public void additionalCustomizersWhenCustomizersAreNullShouldThrowException() - throws Exception { + public void additionalCustomizersWhenCustomizersAreNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("RestTemplateCustomizers must not be null"); this.builder.additionalCustomizers((RestTemplateCustomizer[]) null); } @Test - public void additionalCustomizersCollectionWhenCustomizersAreNullShouldThrowException() - throws Exception { + public void additionalCustomizersCollectionWhenCustomizersAreNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("RestTemplateCustomizers must not be null"); this.builder.additionalCustomizers((Set) null); } @Test - public void additionalCustomizersShouldAddToExisting() throws Exception { + public void additionalCustomizersShouldAddToExisting() { RestTemplateCustomizer customizer1 = mock(RestTemplateCustomizer.class); RestTemplateCustomizer customizer2 = mock(RestTemplateCustomizer.class); RestTemplate template = this.builder.customizers(customizer1) @@ -401,19 +388,19 @@ public class RestTemplateBuilderTests { } @Test - public void buildShouldReturnRestTemplate() throws Exception { + public void buildShouldReturnRestTemplate() { RestTemplate template = this.builder.build(); assertThat(template.getClass()).isEqualTo(RestTemplate.class); } @Test - public void buildClassShouldReturnClassInstance() throws Exception { + public void buildClassShouldReturnClassInstance() { RestTemplateSubclass template = this.builder.build(RestTemplateSubclass.class); assertThat(template.getClass()).isEqualTo(RestTemplateSubclass.class); } @Test - public void configureShouldApply() throws Exception { + public void configureShouldApply() { RestTemplate template = new RestTemplate(); this.builder.configure(template); assertThat(template.getRequestFactory()) diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/RootUriTemplateHandlerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/RootUriTemplateHandlerTests.java index 2b73ebaa01..d3b4ab91f2 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/RootUriTemplateHandlerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/RootUriTemplateHandlerTests.java @@ -65,21 +65,21 @@ public class RootUriTemplateHandlerTests { } @Test - public void createWithNullRootUriShouldThrowException() throws Exception { + public void createWithNullRootUriShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("RootUri must not be null"); new RootUriTemplateHandler((String) null); } @Test - public void createWithNullHandlerShouldThrowException() throws Exception { + public void createWithNullHandlerShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Handler must not be null"); new RootUriTemplateHandler("http://example.com", null); } @Test - public void expandMapVariablesShouldPrefixRoot() throws Exception { + public void expandMapVariablesShouldPrefixRoot() { HashMap uriVariables = new HashMap<>(); URI expanded = this.handler.expand("/hello", uriVariables); verify(this.delegate).expand("http://example.com/hello", uriVariables); @@ -87,8 +87,7 @@ public class RootUriTemplateHandlerTests { } @Test - public void expandMapVariablesWhenPathDoesNotStartWithSlashShouldNotPrefixRoot() - throws Exception { + public void expandMapVariablesWhenPathDoesNotStartWithSlashShouldNotPrefixRoot() { HashMap uriVariables = new HashMap<>(); URI expanded = this.handler.expand("http://spring.io/hello", uriVariables); verify(this.delegate).expand("http://spring.io/hello", uriVariables); @@ -96,7 +95,7 @@ public class RootUriTemplateHandlerTests { } @Test - public void expandArrayVariablesShouldPrefixRoot() throws Exception { + public void expandArrayVariablesShouldPrefixRoot() { Object[] uriVariables = new Object[0]; URI expanded = this.handler.expand("/hello", uriVariables); verify(this.delegate).expand("http://example.com/hello", uriVariables); @@ -104,8 +103,7 @@ public class RootUriTemplateHandlerTests { } @Test - public void expandArrayVariablesWhenPathDoesNotStartWithSlashShouldNotPrefixRoot() - throws Exception { + public void expandArrayVariablesWhenPathDoesNotStartWithSlashShouldNotPrefixRoot() { Object[] uriVariables = new Object[0]; URI expanded = this.handler.expand("http://spring.io/hello", uriVariables); verify(this.delegate).expand("http://spring.io/hello", uriVariables); @@ -113,7 +111,7 @@ public class RootUriTemplateHandlerTests { } @Test - public void applyShouldWrapExistingTemplate() throws Exception { + public void applyShouldWrapExistingTemplate() { RestTemplate restTemplate = new RestTemplate(); restTemplate.setUriTemplateHandler(this.delegate); this.handler = RootUriTemplateHandler.addTo(restTemplate, "http://example.com"); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/jetty/JettyReactiveWebServerFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/jetty/JettyReactiveWebServerFactoryTests.java index 6588f41f1d..e2eb9caf4d 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/jetty/JettyReactiveWebServerFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/jetty/JettyReactiveWebServerFactoryTests.java @@ -60,7 +60,7 @@ public class JettyReactiveWebServerFactoryTests } @Test - public void jettyCustomizersShouldBeInvoked() throws Exception { + public void jettyCustomizersShouldBeInvoked() { HttpHandler handler = mock(HttpHandler.class); JettyReactiveWebServerFactory factory = getFactory(); JettyServerCustomizer[] configurations = new JettyServerCustomizer[4]; diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/jetty/JettyServletWebServerFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/jetty/JettyServletWebServerFactoryTests.java index 1e4482d8b8..f9edda729f 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/jetty/JettyServletWebServerFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/jetty/JettyServletWebServerFactoryTests.java @@ -81,7 +81,7 @@ public class JettyServletWebServerFactoryTests } @Test - public void jettyCustomizations() throws Exception { + public void jettyCustomizations() { JettyServletWebServerFactory factory = getFactory(); JettyServerCustomizer[] configurations = new JettyServerCustomizer[4]; for (int i = 0; i < configurations.length; i++) { @@ -97,21 +97,21 @@ public class JettyServletWebServerFactoryTests } @Test - public void sessionTimeout() throws Exception { + public void sessionTimeout() { JettyServletWebServerFactory factory = getFactory(); factory.setSessionTimeout(Duration.ofSeconds(10)); assertTimeout(factory, 10); } @Test - public void sessionTimeoutInMins() throws Exception { + public void sessionTimeoutInMins() { JettyServletWebServerFactory factory = getFactory(); factory.setSessionTimeout(Duration.ofMinutes(1)); assertTimeout(factory, 60); } @Test - public void sslCiphersConfiguration() throws Exception { + public void sslCiphersConfiguration() { Ssl ssl = new Ssl(); ssl.setKeyStore("src/test/resources/test.jks"); ssl.setKeyStorePassword("secret"); @@ -136,7 +136,7 @@ public class JettyServletWebServerFactoryTests } @Test - public void stopCalledWithoutStart() throws Exception { + public void stopCalledWithoutStart() { JettyServletWebServerFactory factory = getFactory(); this.webServer = factory.getWebServer(exampleServletRegistration()); this.webServer.stop(); @@ -154,7 +154,7 @@ public class JettyServletWebServerFactoryTests } @Test - public void sslEnabledMultiProtocolsConfiguration() throws Exception { + public void sslEnabledMultiProtocolsConfiguration() { Ssl ssl = new Ssl(); ssl.setKeyStore("src/test/resources/test.jks"); ssl.setKeyStorePassword("secret"); @@ -179,7 +179,7 @@ public class JettyServletWebServerFactoryTests } @Test - public void sslEnabledProtocolsConfiguration() throws Exception { + public void sslEnabledProtocolsConfiguration() { Ssl ssl = new Ssl(); ssl.setKeyStore("src/test/resources/test.jks"); ssl.setKeyStorePassword("secret"); @@ -242,7 +242,7 @@ public class JettyServletWebServerFactoryTests } @Test - public void defaultThreadPool() throws Exception { + public void defaultThreadPool() { JettyServletWebServerFactory factory = getFactory(); factory.setThreadPool(null); assertThat(factory.getThreadPool()).isNull(); @@ -252,7 +252,7 @@ public class JettyServletWebServerFactoryTests } @Test - public void customThreadPool() throws Exception { + public void customThreadPool() { JettyServletWebServerFactory factory = getFactory(); ThreadPool threadPool = mock(ThreadPool.class); factory.setThreadPool(threadPool); @@ -262,7 +262,7 @@ public class JettyServletWebServerFactoryTests } @Test - public void startFailsWhenThreadPoolIsTooSmall() throws Exception { + public void startFailsWhenThreadPoolIsTooSmall() { JettyServletWebServerFactory factory = getFactory(); factory.addServerCustomizers((server) -> { QueuedThreadPool threadPool = server.getBean(QueuedThreadPool.class); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/netty/NettyReactiveWebServerFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/netty/NettyReactiveWebServerFactoryTests.java index 93e97a1155..1ba33ec06f 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/netty/NettyReactiveWebServerFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/netty/NettyReactiveWebServerFactoryTests.java @@ -45,7 +45,7 @@ public class NettyReactiveWebServerFactoryTests } @Test - public void portInUseExceptionIsThrownWhenPortIsAlreadyInUse() throws Exception { + public void portInUseExceptionIsThrownWhenPortIsAlreadyInUse() { AbstractReactiveWebServerFactory factory = getFactory(); factory.setPort(0); this.webServer = factory.getWebServer(new EchoHandler()); @@ -58,7 +58,7 @@ public class NettyReactiveWebServerFactoryTests } @Test - public void nettyCustomizers() throws Exception { + public void nettyCustomizers() { NettyReactiveWebServerFactory factory = getFactory(); NettyServerCustomizer[] customizers = new NettyServerCustomizer[2]; for (int i = 0; i < customizers.length; i++) { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/SslConnectorCustomizerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/SslConnectorCustomizerTests.java index fb31a9a28d..744cacba44 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/SslConnectorCustomizerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/SslConnectorCustomizerTests.java @@ -39,7 +39,7 @@ public class SslConnectorCustomizerTests { private Connector connector; @Before - public void setup() throws Exception { + public void setup() { this.tomcat = new Tomcat(); this.connector = new Connector("org.apache.coyote.http11.Http11NioProtocol"); this.connector.setPort(0); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatReactiveWebServerFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatReactiveWebServerFactoryTests.java index 2d03f690b0..be7cdb4c80 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatReactiveWebServerFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatReactiveWebServerFactoryTests.java @@ -49,7 +49,7 @@ public class TomcatReactiveWebServerFactoryTests } @Test - public void tomcatCustomizers() throws Exception { + public void tomcatCustomizers() { TomcatReactiveWebServerFactory factory = getFactory(); TomcatContextCustomizer[] listeners = new TomcatContextCustomizer[4]; for (int i = 0; i < listeners.length; i++) { @@ -65,14 +65,14 @@ public class TomcatReactiveWebServerFactoryTests } @Test - public void defaultTomcatListeners() throws Exception { + public void defaultTomcatListeners() { TomcatReactiveWebServerFactory factory = getFactory(); assertThat(factory.getContextLifecycleListeners()).hasSize(1).first() .isInstanceOf(AprLifecycleListener.class); } @Test - public void tomcatListeners() throws Exception { + public void tomcatListeners() { TomcatReactiveWebServerFactory factory = getFactory(); LifecycleListener[] listeners = new LifecycleListener[4]; for (int i = 0; i < listeners.length; i++) { @@ -104,7 +104,7 @@ public class TomcatReactiveWebServerFactoryTests } @Test - public void tomcatConnectorCustomizersShouldBeInvoked() throws Exception { + public void tomcatConnectorCustomizersShouldBeInvoked() { TomcatReactiveWebServerFactory factory = getFactory(); HttpHandler handler = mock(HttpHandler.class); TomcatConnectorCustomizer[] listeners = new TomcatConnectorCustomizer[4]; diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactoryTests.java index 9ca94bbd2a..25219d0c13 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactoryTests.java @@ -90,7 +90,7 @@ public class TomcatServletWebServerFactoryTests // JMX MBean names clash if you get more than one Engine with the same name... @Test - public void tomcatEngineNames() throws Exception { + public void tomcatEngineNames() { TomcatServletWebServerFactory factory = getFactory(); this.webServer = factory.getWebServer(); factory.setPort(0); @@ -105,14 +105,14 @@ public class TomcatServletWebServerFactoryTests } @Test - public void defaultTomcatListeners() throws Exception { + public void defaultTomcatListeners() { TomcatServletWebServerFactory factory = getFactory(); assertThat(factory.getContextLifecycleListeners()).hasSize(1).first() .isInstanceOf(AprLifecycleListener.class); } @Test - public void tomcatListeners() throws Exception { + public void tomcatListeners() { TomcatServletWebServerFactory factory = getFactory(); LifecycleListener[] listeners = new LifecycleListener[4]; for (int i = 0; i < listeners.length; i++) { @@ -128,7 +128,7 @@ public class TomcatServletWebServerFactoryTests } @Test - public void tomcatCustomizers() throws Exception { + public void tomcatCustomizers() { TomcatServletWebServerFactory factory = getFactory(); TomcatContextCustomizer[] listeners = new TomcatContextCustomizer[4]; for (int i = 0; i < listeners.length; i++) { @@ -144,7 +144,7 @@ public class TomcatServletWebServerFactoryTests } @Test - public void tomcatConnectorCustomizers() throws Exception { + public void tomcatConnectorCustomizers() { TomcatServletWebServerFactory factory = getFactory(); TomcatConnectorCustomizer[] listeners = new TomcatConnectorCustomizer[4]; for (int i = 0; i < listeners.length; i++) { @@ -160,7 +160,7 @@ public class TomcatServletWebServerFactoryTests } @Test - public void tomcatAdditionalConnectors() throws Exception { + public void tomcatAdditionalConnectors() { TomcatServletWebServerFactory factory = getFactory(); Connector[] listeners = new Connector[4]; for (int i = 0; i < listeners.length; i++) { @@ -185,28 +185,28 @@ public class TomcatServletWebServerFactoryTests } @Test - public void sessionTimeout() throws Exception { + public void sessionTimeout() { TomcatServletWebServerFactory factory = getFactory(); factory.setSessionTimeout(Duration.ofSeconds(10)); assertTimeout(factory, 1); } @Test - public void sessionTimeoutInMins() throws Exception { + public void sessionTimeoutInMins() { TomcatServletWebServerFactory factory = getFactory(); factory.setSessionTimeout(Duration.ofMinutes(1)); assertTimeout(factory, 1); } @Test - public void noSessionTimeout() throws Exception { + public void noSessionTimeout() { TomcatServletWebServerFactory factory = getFactory(); factory.setSessionTimeout(null); assertTimeout(factory, -1); } @Test - public void valve() throws Exception { + public void valve() { TomcatServletWebServerFactory factory = getFactory(); Valve valve = mock(Valve.class); factory.addContextValves(valve); @@ -247,7 +247,7 @@ public class TomcatServletWebServerFactoryTests } @Test - public void uriEncoding() throws Exception { + public void uriEncoding() { TomcatServletWebServerFactory factory = getFactory(); factory.setUriEncoding(StandardCharsets.US_ASCII); Tomcat tomcat = getTomcat(factory); @@ -257,7 +257,7 @@ public class TomcatServletWebServerFactoryTests } @Test - public void defaultUriEncoding() throws Exception { + public void defaultUriEncoding() { TomcatServletWebServerFactory factory = getFactory(); Tomcat tomcat = getTomcat(factory); Connector connector = ((TomcatWebServer) this.webServer).getServiceConnectors() @@ -267,7 +267,7 @@ public class TomcatServletWebServerFactoryTests @Test public void primaryConnectorPortClashThrowsIllegalStateException() - throws InterruptedException, IOException { + throws IOException { doWithBlockedPort((port) -> { TomcatServletWebServerFactory factory = getFactory(); factory.setPort(port); @@ -292,7 +292,7 @@ public class TomcatServletWebServerFactoryTests } @Test - public void stopCalledWithoutStart() throws Exception { + public void stopCalledWithoutStart() { TomcatServletWebServerFactory factory = getFactory(); this.webServer = factory.getWebServer(exampleServletRegistration()); this.webServer.stop(); @@ -361,7 +361,7 @@ public class TomcatServletWebServerFactoryTests } @Test - public void defaultLocaleCharsetMappingsAreOverriden() throws Exception { + public void defaultLocaleCharsetMappingsAreOverriden() { TomcatServletWebServerFactory factory = getFactory(); this.webServer = factory.getWebServer(); // override defaults, see org.apache.catalina.util.CharsetMapperDefault.properties @@ -390,7 +390,7 @@ public class TomcatServletWebServerFactoryTests @Test @SuppressWarnings("unchecked") - public void tldSkipPatternsShouldBeAppliedToContextJarScanner() throws Exception { + public void tldSkipPatternsShouldBeAppliedToContextJarScanner() { TomcatServletWebServerFactory factory = getFactory(); factory.addTldSkipPatterns("foo.jar", "bar.jar"); this.webServer = factory.getWebServer(); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/undertow/FileSessionPersistenceTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/undertow/FileSessionPersistenceTests.java index 0ceecf3be2..98cb7c649e 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/undertow/FileSessionPersistenceTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/undertow/FileSessionPersistenceTests.java @@ -55,14 +55,14 @@ public class FileSessionPersistenceTests { } @Test - public void loadsNullForMissingFile() throws Exception { + public void loadsNullForMissingFile() { Map attributes = this.persistence .loadSessionAttributes("test", this.classLoader); assertThat(attributes).isNull(); } @Test - public void persistAndLoad() throws Exception { + public void persistAndLoad() { Map sessionData = new LinkedHashMap<>(); Map data = new LinkedHashMap<>(); data.put("spring", "boot"); @@ -77,7 +77,7 @@ public class FileSessionPersistenceTests { } @Test - public void dontRestoreExpired() throws Exception { + public void dontRestoreExpired() { Date expired = new Date(System.currentTimeMillis() - 1000); Map sessionData = new LinkedHashMap<>(); Map data = new LinkedHashMap<>(); @@ -92,7 +92,7 @@ public class FileSessionPersistenceTests { } @Test - public void deleteFileOnClear() throws Exception { + public void deleteFileOnClear() { File sessionFile = new File(this.dir, "test.session"); Map sessionData = new LinkedHashMap<>(); this.persistence.persistSessions("test", sessionData); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/undertow/UndertowReactiveWebServerFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/undertow/UndertowReactiveWebServerFactoryTests.java index 200e5839dc..873c2d1357 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/undertow/UndertowReactiveWebServerFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/undertow/UndertowReactiveWebServerFactoryTests.java @@ -60,7 +60,7 @@ public class UndertowReactiveWebServerFactoryTests } @Test - public void builderCustomizersShouldBeInvoked() throws Exception { + public void builderCustomizersShouldBeInvoked() { UndertowReactiveWebServerFactory factory = getFactory(); HttpHandler handler = mock(HttpHandler.class); UndertowBuilderCustomizer[] customizers = new UndertowBuilderCustomizer[4]; diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServerFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServerFactoryTests.java index d1c1c59322..2f59a6fa82 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServerFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServerFactoryTests.java @@ -95,7 +95,7 @@ public class UndertowServletWebServerFactoryTests } @Test - public void builderCustomizers() throws Exception { + public void builderCustomizers() { UndertowServletWebServerFactory factory = getFactory(); UndertowBuilderCustomizer[] customizers = new UndertowBuilderCustomizer[4]; for (int i = 0; i < customizers.length; i++) { @@ -127,7 +127,7 @@ public class UndertowServletWebServerFactoryTests } @Test - public void deploymentInfo() throws Exception { + public void deploymentInfo() { UndertowServletWebServerFactory factory = getFactory(); UndertowDeploymentInfoCustomizer[] customizers = new UndertowDeploymentInfoCustomizer[4]; for (int i = 0; i < customizers.length; i++) { @@ -149,7 +149,7 @@ public class UndertowServletWebServerFactoryTests } @Test - public void defaultContextPath() throws Exception { + public void defaultContextPath() { UndertowServletWebServerFactory factory = getFactory(); final AtomicReference contextPath = new AtomicReference<>(); factory.addDeploymentInfoCustomizers( diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/context/AnnotationConfigReactiveWebServerApplicationContextTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/context/AnnotationConfigReactiveWebServerApplicationContextTests.java index 861cab0ee3..a03fa76192 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/context/AnnotationConfigReactiveWebServerApplicationContextTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/context/AnnotationConfigReactiveWebServerApplicationContextTests.java @@ -37,7 +37,7 @@ public class AnnotationConfigReactiveWebServerApplicationContextTests { private AnnotationConfigReactiveWebServerApplicationContext context; @Test - public void createFromScan() throws Exception { + public void createFromScan() { this.context = new AnnotationConfigReactiveWebServerApplicationContext( ExampleReactiveWebServerApplicationConfiguration.class.getPackage() .getName()); @@ -45,14 +45,14 @@ public class AnnotationConfigReactiveWebServerApplicationContextTests { } @Test - public void createFromConfigClass() throws Exception { + public void createFromConfigClass() { this.context = new AnnotationConfigReactiveWebServerApplicationContext( ExampleReactiveWebServerApplicationConfiguration.class); verifyContext(); } @Test - public void registerAndRefresh() throws Exception { + public void registerAndRefresh() { this.context = new AnnotationConfigReactiveWebServerApplicationContext(); this.context.register(ExampleReactiveWebServerApplicationConfiguration.class); this.context.refresh(); @@ -60,7 +60,7 @@ public class AnnotationConfigReactiveWebServerApplicationContextTests { } @Test - public void scanAndRefresh() throws Exception { + public void scanAndRefresh() { this.context = new AnnotationConfigReactiveWebServerApplicationContext(); this.context.scan(ExampleReactiveWebServerApplicationConfiguration.class .getPackage().getName()); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/result/view/MustacheViewResolverTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/result/view/MustacheViewResolverTests.java index 4875c5ac19..62db939bfd 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/result/view/MustacheViewResolverTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/result/view/MustacheViewResolverTests.java @@ -45,12 +45,12 @@ public class MustacheViewResolverTests { } @Test - public void resolveNonExistent() throws Exception { + public void resolveNonExistent() { assertThat(this.resolver.resolveViewName("bar", null).block()).isNull(); } @Test - public void resolveExisting() throws Exception { + public void resolveExisting() { assertThat(this.resolver.resolveViewName("template", null).block()).isNotNull(); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/result/view/MustacheViewTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/result/view/MustacheViewTests.java index 744d40b280..93ceb0a9fe 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/result/view/MustacheViewTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/result/view/MustacheViewTests.java @@ -50,7 +50,7 @@ public class MustacheViewTests { } @Test - public void viewResolvesHandlebars() throws Exception { + public void viewResolvesHandlebars() { this.exchange = MockServerWebExchange .from(MockServerHttpRequest.get("/test").build()); MustacheView view = new MustacheView(); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/server/AbstractReactiveWebServerFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/server/AbstractReactiveWebServerFactoryTests.java index f62a2075f6..b9d4cb5766 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/server/AbstractReactiveWebServerFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/server/AbstractReactiveWebServerFactoryTests.java @@ -73,7 +73,7 @@ public abstract class AbstractReactiveWebServerFactoryTests { protected abstract AbstractReactiveWebServerFactory getFactory(); @Test - public void specificPort() throws Exception { + public void specificPort() { AbstractReactiveWebServerFactory factory = getFactory(); int specificPort = SocketUtils.findAvailableTcpPort(41000); factory.setPort(specificPort); @@ -97,7 +97,7 @@ public abstract class AbstractReactiveWebServerFactoryTests { testBasicSslWithKeyStore("src/test/resources/test.jks"); } - protected final void testBasicSslWithKeyStore(String keyStore) throws Exception { + protected final void testBasicSslWithKeyStore(String keyStore) { AbstractReactiveWebServerFactory factory = getFactory(); Ssl ssl = new Ssl(); ssl.setKeyStore(keyStore); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/server/MimeMappingsTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/server/MimeMappingsTests.java index cc60cf85e1..8e5e6f2dd9 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/server/MimeMappingsTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/server/MimeMappingsTests.java @@ -33,12 +33,12 @@ import static org.assertj.core.api.Assertions.assertThat; public class MimeMappingsTests { @Test(expected = UnsupportedOperationException.class) - public void defaultsCannotBeModified() throws Exception { + public void defaultsCannotBeModified() { MimeMappings.DEFAULT.add("foo", "foo/bar"); } @Test - public void createFromExisting() throws Exception { + public void createFromExisting() { MimeMappings mappings = new MimeMappings(); mappings.add("foo", "bar"); MimeMappings clone = new MimeMappings(mappings); @@ -48,7 +48,7 @@ public class MimeMappingsTests { } @Test - public void createFromMap() throws Exception { + public void createFromMap() { Map mappings = new HashMap<>(); mappings.put("foo", "bar"); MimeMappings clone = new MimeMappings(mappings); @@ -58,7 +58,7 @@ public class MimeMappingsTests { } @Test - public void iterate() throws Exception { + public void iterate() { MimeMappings mappings = new MimeMappings(); mappings.add("foo", "bar"); mappings.add("baz", "boo"); @@ -73,7 +73,7 @@ public class MimeMappingsTests { } @Test - public void getAll() throws Exception { + public void getAll() { MimeMappings mappings = new MimeMappings(); mappings.add("foo", "bar"); mappings.add("baz", "boo"); @@ -86,20 +86,20 @@ public class MimeMappingsTests { } @Test - public void addNew() throws Exception { + public void addNew() { MimeMappings mappings = new MimeMappings(); assertThat(mappings.add("foo", "bar")).isNull(); } @Test - public void addReplacesExisting() throws Exception { + public void addReplacesExisting() { MimeMappings mappings = new MimeMappings(); mappings.add("foo", "bar"); assertThat(mappings.add("foo", "baz")).isEqualTo("bar"); } @Test - public void remove() throws Exception { + public void remove() { MimeMappings mappings = new MimeMappings(); mappings.add("foo", "bar"); assertThat(mappings.remove("foo")).isEqualTo("bar"); @@ -107,20 +107,20 @@ public class MimeMappingsTests { } @Test - public void get() throws Exception { + public void get() { MimeMappings mappings = new MimeMappings(); mappings.add("foo", "bar"); assertThat(mappings.get("foo")).isEqualTo("bar"); } @Test - public void getMissing() throws Exception { + public void getMissing() { MimeMappings mappings = new MimeMappings(); assertThat(mappings.get("foo")).isNull(); } @Test - public void makeUnmodifiable() throws Exception { + public void makeUnmodifiable() { MimeMappings mappings = new MimeMappings(); mappings.add("foo", "bar"); MimeMappings unmodifiable = MimeMappings.unmodifiableMappings(mappings); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/server/WebServerFactoryCustomizerBeanPostProcessorTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/server/WebServerFactoryCustomizerBeanPostProcessorTests.java index 94a3908015..71739ab40c 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/server/WebServerFactoryCustomizerBeanPostProcessorTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/server/WebServerFactoryCustomizerBeanPostProcessorTests.java @@ -58,7 +58,7 @@ public class WebServerFactoryCustomizerBeanPostProcessorTests { } @Test - public void setBeanFactoryWhenNotListableShouldThrowException() throws Exception { + public void setBeanFactoryWhenNotListableShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("WebServerCustomizerBeanPostProcessor can only " + "be used with a ListableBeanFactory"); @@ -66,7 +66,7 @@ public class WebServerFactoryCustomizerBeanPostProcessorTests { } @Test - public void postProcessBeforeShouldReturnBean() throws Exception { + public void postProcessBeforeShouldReturnBean() { addMockBeans(Collections.emptyMap()); Object bean = new Object(); Object result = this.processor.postProcessBeforeInitialization(bean, "foo"); @@ -74,7 +74,7 @@ public class WebServerFactoryCustomizerBeanPostProcessorTests { } @Test - public void postProcessAfterShouldReturnBean() throws Exception { + public void postProcessAfterShouldReturnBean() { addMockBeans(Collections.emptyMap()); Object bean = new Object(); Object result = this.processor.postProcessAfterInitialization(bean, "foo"); @@ -82,7 +82,7 @@ public class WebServerFactoryCustomizerBeanPostProcessorTests { } @Test - public void postProcessAfterShouldCallInterfaceCustomizers() throws Exception { + public void postProcessAfterShouldCallInterfaceCustomizers() { Map beans = addInterfaceBeans(); addMockBeans(beans); postProcessBeforeInitialization(WebServerFactory.class); @@ -92,8 +92,7 @@ public class WebServerFactoryCustomizerBeanPostProcessorTests { } @Test - public void postProcessAfterWhenWebServerFactoryOneShouldCallInterfaceCustomizers() - throws Exception { + public void postProcessAfterWhenWebServerFactoryOneShouldCallInterfaceCustomizers() { Map beans = addInterfaceBeans(); addMockBeans(beans); postProcessBeforeInitialization(WebServerFactoryOne.class); @@ -103,8 +102,7 @@ public class WebServerFactoryCustomizerBeanPostProcessorTests { } @Test - public void postProcessAfterWhenWebServerFactoryTwoShouldCallInterfaceCustomizers() - throws Exception { + public void postProcessAfterWhenWebServerFactoryTwoShouldCallInterfaceCustomizers() { Map beans = addInterfaceBeans(); addMockBeans(beans); postProcessBeforeInitialization(WebServerFactoryTwo.class); @@ -125,7 +123,7 @@ public class WebServerFactoryCustomizerBeanPostProcessorTests { } @Test - public void postProcessAfterShouldCallLambdaCustomizers() throws Exception { + public void postProcessAfterShouldCallLambdaCustomizers() { List called = new ArrayList<>(); addLambdaBeans(called); postProcessBeforeInitialization(WebServerFactory.class); @@ -133,8 +131,7 @@ public class WebServerFactoryCustomizerBeanPostProcessorTests { } @Test - public void postProcessAfterWhenWebServerFactoryOneShouldCallLambdaCustomizers() - throws Exception { + public void postProcessAfterWhenWebServerFactoryOneShouldCallLambdaCustomizers() { List called = new ArrayList<>(); addLambdaBeans(called); postProcessBeforeInitialization(WebServerFactoryOne.class); @@ -142,8 +139,7 @@ public class WebServerFactoryCustomizerBeanPostProcessorTests { } @Test - public void postProcessAfterWhenWebServerFactoryTwoShouldCallLambdaCustomizers() - throws Exception { + public void postProcessAfterWhenWebServerFactoryTwoShouldCallLambdaCustomizers() { List called = new ArrayList<>(); addLambdaBeans(called); postProcessBeforeInitialization(WebServerFactoryTwo.class); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/AbstractFilterRegistrationBeanTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/AbstractFilterRegistrationBeanTests.java index bde8b57f96..aed11f71a5 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/AbstractFilterRegistrationBeanTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/AbstractFilterRegistrationBeanTests.java @@ -128,7 +128,7 @@ public abstract class AbstractFilterRegistrationBeanTests { } @Test - public void setServletRegistrationBeanMustNotBeNull() throws Exception { + public void setServletRegistrationBeanMustNotBeNull() { AbstractFilterRegistrationBean bean = createFilterRegistrationBean(); this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("ServletRegistrationBeans must not be null"); @@ -136,7 +136,7 @@ public abstract class AbstractFilterRegistrationBeanTests { } @Test - public void addServletRegistrationBeanMustNotBeNull() throws Exception { + public void addServletRegistrationBeanMustNotBeNull() { AbstractFilterRegistrationBean bean = createFilterRegistrationBean(); this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("ServletRegistrationBeans must not be null"); @@ -164,7 +164,7 @@ public abstract class AbstractFilterRegistrationBeanTests { } @Test - public void setUrlPatternMustNotBeNull() throws Exception { + public void setUrlPatternMustNotBeNull() { AbstractFilterRegistrationBean bean = createFilterRegistrationBean(); this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("UrlPatterns must not be null"); @@ -172,7 +172,7 @@ public abstract class AbstractFilterRegistrationBeanTests { } @Test - public void addUrlPatternMustNotBeNull() throws Exception { + public void addUrlPatternMustNotBeNull() { AbstractFilterRegistrationBean bean = createFilterRegistrationBean(); this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("UrlPatterns must not be null"); @@ -180,7 +180,7 @@ public abstract class AbstractFilterRegistrationBeanTests { } @Test - public void setServletNameMustNotBeNull() throws Exception { + public void setServletNameMustNotBeNull() { AbstractFilterRegistrationBean bean = createFilterRegistrationBean(); this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("ServletNames must not be null"); @@ -188,7 +188,7 @@ public abstract class AbstractFilterRegistrationBeanTests { } @Test - public void addServletNameMustNotBeNull() throws Exception { + public void addServletNameMustNotBeNull() { AbstractFilterRegistrationBean bean = createFilterRegistrationBean(); this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("ServletNames must not be null"); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/DelegatingFilterProxyRegistrationBeanTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/DelegatingFilterProxyRegistrationBeanTests.java index 5b8bc310d3..cb190697be 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/DelegatingFilterProxyRegistrationBeanTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/DelegatingFilterProxyRegistrationBeanTests.java @@ -16,11 +16,8 @@ package org.springframework.boot.web.servlet; -import java.io.IOException; - import javax.servlet.Filter; import javax.servlet.FilterChain; -import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; @@ -54,27 +51,27 @@ public class DelegatingFilterProxyRegistrationBeanTests new MockServletContext()); @Test - public void targetBeanNameMustNotBeNull() throws Exception { + public void targetBeanNameMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("TargetBeanName must not be null or empty"); new DelegatingFilterProxyRegistrationBean(null); } @Test - public void targetBeanNameMustNotBeEmpty() throws Exception { + public void targetBeanNameMustNotBeEmpty() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("TargetBeanName must not be null or empty"); new DelegatingFilterProxyRegistrationBean(""); } @Test - public void nameDefaultsToTargetBeanName() throws Exception { + public void nameDefaultsToTargetBeanName() { assertThat(new DelegatingFilterProxyRegistrationBean("myFilter") .getOrDeduceName(null)).isEqualTo("myFilter"); } @Test - public void getFilterUsesDelegatingFilterProxy() throws Exception { + public void getFilterUsesDelegatingFilterProxy() { DelegatingFilterProxyRegistrationBean registrationBean = createFilterRegistrationBean(); Filter filter = registrationBean.getFilter(); assertThat(filter).isInstanceOf(DelegatingFilterProxy.class); @@ -98,7 +95,7 @@ public class DelegatingFilterProxyRegistrationBeanTests } @Test - public void createServletRegistrationBeanMustNotBeNull() throws Exception { + public void createServletRegistrationBeanMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("ServletRegistrationBeans must not be null"); new DelegatingFilterProxyRegistrationBean("mockFilter", @@ -127,7 +124,7 @@ public class DelegatingFilterProxyRegistrationBeanTests @Override public void doFilter(ServletRequest request, ServletResponse response, - FilterChain chain) throws IOException, ServletException { + FilterChain chain) { } } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/FilterRegistrationBeanTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/FilterRegistrationBeanTests.java index 46357aebd0..93494e5088 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/FilterRegistrationBeanTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/FilterRegistrationBeanTests.java @@ -51,14 +51,14 @@ public class FilterRegistrationBeanTests extends AbstractFilterRegistrationBeanT } @Test - public void constructFilterMustNotBeNull() throws Exception { + public void constructFilterMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Filter must not be null"); new FilterRegistrationBean<>(null); } @Test - public void createServletRegistrationBeanMustNotBeNull() throws Exception { + public void createServletRegistrationBeanMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("ServletRegistrationBeans must not be null"); new FilterRegistrationBean<>(this.filter, (ServletRegistrationBean[]) null); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/MultipartConfigFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/MultipartConfigFactoryTests.java index b4bcf38eb7..4b1c07bed4 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/MultipartConfigFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/MultipartConfigFactoryTests.java @@ -40,7 +40,7 @@ public class MultipartConfigFactoryTests { } @Test - public void create() throws Exception { + public void create() { MultipartConfigFactory factory = new MultipartConfigFactory(); factory.setLocation("loc"); factory.setMaxFileSize(1); @@ -54,7 +54,7 @@ public class MultipartConfigFactoryTests { } @Test - public void createWithStringSizes() throws Exception { + public void createWithStringSizes() { MultipartConfigFactory factory = new MultipartConfigFactory(); factory.setMaxFileSize("1"); factory.setMaxRequestSize("2kB"); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/ServletContextInitializerBeansTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/ServletContextInitializerBeansTests.java index 86446b3565..9447150633 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/ServletContextInitializerBeansTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/ServletContextInitializerBeansTests.java @@ -16,13 +16,10 @@ package org.springframework.boot.web.servlet; -import java.io.IOException; - import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletContext; -import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServlet; @@ -87,7 +84,7 @@ public class ServletContextInitializerBeansTests { static class TestServlet extends HttpServlet implements ServletContextInitializer { @Override - public void onStartup(ServletContext servletContext) throws ServletException { + public void onStartup(ServletContext servletContext) { } @@ -96,18 +93,18 @@ public class ServletContextInitializerBeansTests { static class TestFilter implements Filter, ServletContextInitializer { @Override - public void onStartup(ServletContext servletContext) throws ServletException { + public void onStartup(ServletContext servletContext) { } @Override - public void init(FilterConfig filterConfig) throws ServletException { + public void init(FilterConfig filterConfig) { } @Override public void doFilter(ServletRequest request, ServletResponse response, - FilterChain chain) throws IOException, ServletException { + FilterChain chain) { } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/ServletListenerRegistrationBeanTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/ServletListenerRegistrationBeanTests.java index 65643fa313..b02816d893 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/ServletListenerRegistrationBeanTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/ServletListenerRegistrationBeanTests.java @@ -72,7 +72,7 @@ public class ServletListenerRegistrationBeanTests { } @Test - public void cannotRegisterUnsupportedType() throws Exception { + public void cannotRegisterUnsupportedType() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Listener is not of a supported type"); new ServletListenerRegistrationBean(new EventListener() { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/ServletRegistrationBeanTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/ServletRegistrationBeanTests.java index 9e3de86b7f..3b3934e355 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/ServletRegistrationBeanTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/ServletRegistrationBeanTests.java @@ -152,14 +152,14 @@ public class ServletRegistrationBeanTests { } @Test - public void createServletMustNotBeNull() throws Exception { + public void createServletMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Servlet must not be null"); new ServletRegistrationBean(null); } @Test - public void setMappingMustNotBeNull() throws Exception { + public void setMappingMustNotBeNull() { ServletRegistrationBean bean = new ServletRegistrationBean<>( this.servlet); this.thrown.expect(IllegalArgumentException.class); @@ -168,14 +168,14 @@ public class ServletRegistrationBeanTests { } @Test - public void createMappingMustNotBeNull() throws Exception { + public void createMappingMustNotBeNull() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("UrlMappings must not be null"); new ServletRegistrationBean<>(this.servlet, (String[]) null); } @Test - public void addMappingMustNotBeNull() throws Exception { + public void addMappingMustNotBeNull() { ServletRegistrationBean bean = new ServletRegistrationBean<>( this.servlet); this.thrown.expect(IllegalArgumentException.class); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/WebFilterHandlerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/WebFilterHandlerTests.java index 095ebf9b12..6623817942 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/WebFilterHandlerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/WebFilterHandlerTests.java @@ -25,7 +25,6 @@ import javax.servlet.DispatcherType; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; -import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.annotation.WebFilter; @@ -212,13 +211,13 @@ public class WebFilterHandlerTests { class BaseFilter implements Filter { @Override - public void init(FilterConfig filterConfig) throws ServletException { + public void init(FilterConfig filterConfig) { } @Override public void doFilter(ServletRequest request, ServletResponse response, - FilterChain chain) throws IOException, ServletException { + FilterChain chain) { } @Override diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/context/AnnotationConfigServletWebServerApplicationContextTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/context/AnnotationConfigServletWebServerApplicationContextTests.java index ad7e359681..56e95b841f 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/context/AnnotationConfigServletWebServerApplicationContextTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/context/AnnotationConfigServletWebServerApplicationContextTests.java @@ -16,12 +16,9 @@ package org.springframework.boot.web.servlet.context; -import java.io.IOException; - import javax.servlet.GenericServlet; import javax.servlet.Servlet; import javax.servlet.ServletContext; -import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; @@ -53,7 +50,7 @@ public class AnnotationConfigServletWebServerApplicationContextTests { private AnnotationConfigServletWebServerApplicationContext context; @Test - public void createFromScan() throws Exception { + public void createFromScan() { this.context = new AnnotationConfigServletWebServerApplicationContext( ExampleServletWebServerApplicationConfiguration.class.getPackage() .getName()); @@ -61,7 +58,7 @@ public class AnnotationConfigServletWebServerApplicationContextTests { } @Test - public void sessionScopeAvailable() throws Exception { + public void sessionScopeAvailable() { this.context = new AnnotationConfigServletWebServerApplicationContext( ExampleServletWebServerApplicationConfiguration.class, SessionScopedComponent.class); @@ -69,7 +66,7 @@ public class AnnotationConfigServletWebServerApplicationContextTests { } @Test - public void sessionScopeAvailableToServlet() throws Exception { + public void sessionScopeAvailableToServlet() { this.context = new AnnotationConfigServletWebServerApplicationContext( ExampleServletWebServerApplicationConfiguration.class, ExampleServletWithAutowired.class, SessionScopedComponent.class); @@ -78,14 +75,14 @@ public class AnnotationConfigServletWebServerApplicationContextTests { } @Test - public void createFromConfigClass() throws Exception { + public void createFromConfigClass() { this.context = new AnnotationConfigServletWebServerApplicationContext( ExampleServletWebServerApplicationConfiguration.class); verifyContext(); } @Test - public void registerAndRefresh() throws Exception { + public void registerAndRefresh() { this.context = new AnnotationConfigServletWebServerApplicationContext(); this.context.register(ExampleServletWebServerApplicationConfiguration.class); this.context.refresh(); @@ -93,7 +90,7 @@ public class AnnotationConfigServletWebServerApplicationContextTests { } @Test - public void scanAndRefresh() throws Exception { + public void scanAndRefresh() { this.context = new AnnotationConfigServletWebServerApplicationContext(); this.context.scan(ExampleServletWebServerApplicationConfiguration.class .getPackage().getName()); @@ -102,7 +99,7 @@ public class AnnotationConfigServletWebServerApplicationContextTests { } @Test - public void createAndInitializeCyclic() throws Exception { + public void createAndInitializeCyclic() { this.context = new AnnotationConfigServletWebServerApplicationContext( ServletContextAwareEmbeddedConfiguration.class); verifyContext(); @@ -113,7 +110,7 @@ public class AnnotationConfigServletWebServerApplicationContextTests { } @Test - public void createAndInitializeWithParent() throws Exception { + public void createAndInitializeWithParent() { AnnotationConfigServletWebServerApplicationContext parent = new AnnotationConfigServletWebServerApplicationContext( WebServerConfiguration.class); this.context = new AnnotationConfigServletWebServerApplicationContext(); @@ -141,8 +138,7 @@ public class AnnotationConfigServletWebServerApplicationContextTests { private SessionScopedComponent component; @Override - public void service(ServletRequest req, ServletResponse res) - throws ServletException, IOException { + public void service(ServletRequest req, ServletResponse res) { assertThat(this.component).isNotNull(); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/context/ServletWebServerApplicationContextTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/context/ServletWebServerApplicationContextTests.java index e4320681e8..0bdfdead68 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/context/ServletWebServerApplicationContextTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/context/ServletWebServerApplicationContextTests.java @@ -16,7 +16,6 @@ package org.springframework.boot.web.servlet.context; -import java.io.IOException; import java.lang.reflect.Field; import java.util.EnumSet; import java.util.Properties; @@ -27,7 +26,6 @@ import javax.servlet.FilterChain; import javax.servlet.Servlet; import javax.servlet.ServletContext; import javax.servlet.ServletContextListener; -import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; @@ -108,7 +106,7 @@ public class ServletWebServerApplicationContextTests { } @Test - public void startRegistrations() throws Exception { + public void startRegistrations() { addWebServerFactoryBean(); this.context.refresh(); MockServletWebServerFactory factory = getWebServerFactory(); @@ -142,7 +140,7 @@ public class ServletWebServerApplicationContextTests { } @Test - public void ServletWebServerInitializedEventPublished() throws Exception { + public void ServletWebServerInitializedEventPublished() { addWebServerFactoryBean(); this.context.registerBeanDefinition("listener", new RootBeanDefinition(MockListener.class)); @@ -155,7 +153,7 @@ public class ServletWebServerApplicationContextTests { } @Test - public void localPortIsAvailable() throws Exception { + public void localPortIsAvailable() { addWebServerFactoryBean(); new ServerPortInfoApplicationContextInitializer().initialize(this.context); this.context.refresh(); @@ -165,7 +163,7 @@ public class ServletWebServerApplicationContextTests { } @Test - public void stopOnClose() throws Exception { + public void stopOnClose() { addWebServerFactoryBean(); this.context.refresh(); MockServletWebServerFactory factory = getWebServerFactory(); @@ -174,7 +172,7 @@ public class ServletWebServerApplicationContextTests { } @Test - public void cannotSecondRefresh() throws Exception { + public void cannotSecondRefresh() { addWebServerFactoryBean(); this.context.refresh(); this.thrown.expect(IllegalStateException.class); @@ -182,7 +180,7 @@ public class ServletWebServerApplicationContextTests { } @Test - public void servletContextAwareBeansAreInjected() throws Exception { + public void servletContextAwareBeansAreInjected() { addWebServerFactoryBean(); ServletContextAware bean = mock(ServletContextAware.class); this.context.registerBeanDefinition("bean", beanDefinition(bean)); @@ -191,7 +189,7 @@ public class ServletWebServerApplicationContextTests { } @Test - public void missingServletWebServerFactory() throws Exception { + public void missingServletWebServerFactory() { this.thrown.expect(ApplicationContextException.class); this.thrown.expectMessage( "Unable to start ServletWebServerApplicationContext due to missing " @@ -200,7 +198,7 @@ public class ServletWebServerApplicationContextTests { } @Test - public void tooManyWebServerFactories() throws Exception { + public void tooManyWebServerFactories() { addWebServerFactoryBean(); this.context.registerBeanDefinition("webServerFactory2", new RootBeanDefinition(MockServletWebServerFactory.class)); @@ -213,7 +211,7 @@ public class ServletWebServerApplicationContextTests { } @Test - public void singleServletBean() throws Exception { + public void singleServletBean() { addWebServerFactoryBean(); Servlet servlet = mock(Servlet.class); this.context.registerBeanDefinition("servletBean", beanDefinition(servlet)); @@ -224,7 +222,7 @@ public class ServletWebServerApplicationContextTests { } @Test - public void orderedBeanInsertedCorrectly() throws Exception { + public void orderedBeanInsertedCorrectly() { addWebServerFactoryBean(); OrderedFilter filter = new OrderedFilter(); this.context.registerBeanDefinition("filterBean", beanDefinition(filter)); @@ -241,7 +239,7 @@ public class ServletWebServerApplicationContextTests { } @Test - public void multipleServletBeans() throws Exception { + public void multipleServletBeans() { addWebServerFactoryBean(); Servlet servlet1 = mock(Servlet.class, withSettings().extraInterfaces(Ordered.class)); @@ -264,7 +262,7 @@ public class ServletWebServerApplicationContextTests { } @Test - public void multipleServletBeansWithMainDispatcher() throws Exception { + public void multipleServletBeansWithMainDispatcher() { addWebServerFactoryBean(); Servlet servlet1 = mock(Servlet.class, withSettings().extraInterfaces(Ordered.class)); @@ -287,7 +285,7 @@ public class ServletWebServerApplicationContextTests { } @Test - public void servletAndFilterBeans() throws Exception { + public void servletAndFilterBeans() { addWebServerFactoryBean(); Servlet servlet = mock(Servlet.class); Filter filter1 = mock(Filter.class, @@ -334,7 +332,7 @@ public class ServletWebServerApplicationContextTests { } @Test - public void servletContextListenerBeans() throws Exception { + public void servletContextListenerBeans() { addWebServerFactoryBean(); ServletContextListener initializer = mock(ServletContextListener.class); this.context.registerBeanDefinition("initializerBean", @@ -378,8 +376,7 @@ public class ServletWebServerApplicationContextTests { } @Test - public void servletContextInitializerBeansSkipsRegisteredServletsAndFilters() - throws Exception { + public void servletContextInitializerBeansSkipsRegisteredServletsAndFilters() { addWebServerFactoryBean(); Servlet servlet = mock(Servlet.class); Filter filter = mock(Filter.class); @@ -396,7 +393,7 @@ public class ServletWebServerApplicationContextTests { } @Test - public void filterRegistrationBeansSkipsRegisteredFilters() throws Exception { + public void filterRegistrationBeansSkipsRegisteredFilters() { addWebServerFactoryBean(); Filter filter = mock(Filter.class); FilterRegistrationBean initializer = new FilterRegistrationBean<>(filter); @@ -434,7 +431,7 @@ public class ServletWebServerApplicationContextTests { } @Test - public void postProcessWebServerFactory() throws Exception { + public void postProcessWebServerFactory() { RootBeanDefinition beanDefinition = new RootBeanDefinition( MockServletWebServerFactory.class); MutablePropertyValues pv = new MutablePropertyValues(); @@ -452,7 +449,7 @@ public class ServletWebServerApplicationContextTests { } @Test - public void doesNotReplaceExistingScopes() throws Exception { // gh-2082 + public void doesNotReplaceExistingScopes() { // gh-2082 Scope scope = mock(Scope.class); ConfigurableListableBeanFactory factory = this.context.getBeanFactory(); factory.registerScope(WebApplicationContext.SCOPE_REQUEST, scope); @@ -512,7 +509,7 @@ public class ServletWebServerApplicationContextTests { @Override public void doFilter(ServletRequest request, ServletResponse response, - FilterChain chain) throws IOException, ServletException { + FilterChain chain) { } } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/context/XmlServletWebServerApplicationContextTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/context/XmlServletWebServerApplicationContextTests.java index 5ab35dea67..238bf45fd3 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/context/XmlServletWebServerApplicationContextTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/context/XmlServletWebServerApplicationContextTests.java @@ -40,26 +40,26 @@ public class XmlServletWebServerApplicationContextTests { private XmlServletWebServerApplicationContext context; @Test - public void createFromResource() throws Exception { + public void createFromResource() { this.context = new XmlServletWebServerApplicationContext( new ClassPathResource(FILE, getClass())); verifyContext(); } @Test - public void createFromResourceLocation() throws Exception { + public void createFromResourceLocation() { this.context = new XmlServletWebServerApplicationContext(PATH + FILE); verifyContext(); } @Test - public void createFromRelativeResourceLocation() throws Exception { + public void createFromRelativeResourceLocation() { this.context = new XmlServletWebServerApplicationContext(getClass(), FILE); verifyContext(); } @Test - public void loadAndRefreshFromResource() throws Exception { + public void loadAndRefreshFromResource() { this.context = new XmlServletWebServerApplicationContext(); this.context.load(new ClassPathResource(FILE, getClass())); this.context.refresh(); @@ -67,7 +67,7 @@ public class XmlServletWebServerApplicationContextTests { } @Test - public void loadAndRefreshFromResourceLocation() throws Exception { + public void loadAndRefreshFromResourceLocation() { this.context = new XmlServletWebServerApplicationContext(); this.context.load(PATH + FILE); this.context.refresh(); @@ -75,7 +75,7 @@ public class XmlServletWebServerApplicationContextTests { } @Test - public void loadAndRefreshFromRelativeResourceLocation() throws Exception { + public void loadAndRefreshFromRelativeResourceLocation() { this.context = new XmlServletWebServerApplicationContext(); this.context.load(getClass(), FILE); this.context.refresh(); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/error/DefaultErrorAttributesTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/error/DefaultErrorAttributesTests.java index 91eda18a01..2f56c4c7c4 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/error/DefaultErrorAttributesTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/error/DefaultErrorAttributesTests.java @@ -52,14 +52,14 @@ public class DefaultErrorAttributesTests { private WebRequest webRequest = new ServletWebRequest(this.request); @Test - public void includeTimeStamp() throws Exception { + public void includeTimeStamp() { Map attributes = this.errorAttributes .getErrorAttributes(this.webRequest, false); assertThat(attributes.get("timestamp")).isInstanceOf(Date.class); } @Test - public void specificStatusCode() throws Exception { + public void specificStatusCode() { this.request.setAttribute("javax.servlet.error.status_code", 404); Map attributes = this.errorAttributes .getErrorAttributes(this.webRequest, false); @@ -69,7 +69,7 @@ public class DefaultErrorAttributesTests { } @Test - public void missingStatusCode() throws Exception { + public void missingStatusCode() { Map attributes = this.errorAttributes .getErrorAttributes(this.webRequest, false); assertThat(attributes.get("error")).isEqualTo("None"); @@ -77,7 +77,7 @@ public class DefaultErrorAttributesTests { } @Test - public void mvcError() throws Exception { + public void mvcError() { RuntimeException ex = new RuntimeException("Test"); ModelAndView modelAndView = this.errorAttributes.resolveException(this.request, null, null, ex); @@ -92,7 +92,7 @@ public class DefaultErrorAttributesTests { } @Test - public void servletError() throws Exception { + public void servletError() { RuntimeException ex = new RuntimeException("Test"); this.request.setAttribute("javax.servlet.error.exception", ex); Map attributes = this.errorAttributes @@ -103,7 +103,7 @@ public class DefaultErrorAttributesTests { } @Test - public void servletMessage() throws Exception { + public void servletMessage() { this.request.setAttribute("javax.servlet.error.message", "Test"); Map attributes = this.errorAttributes .getErrorAttributes(this.webRequest, false); @@ -112,7 +112,7 @@ public class DefaultErrorAttributesTests { } @Test - public void nullMessage() throws Exception { + public void nullMessage() { this.request.setAttribute("javax.servlet.error.exception", new RuntimeException()); this.request.setAttribute("javax.servlet.error.message", "Test"); @@ -123,7 +123,7 @@ public class DefaultErrorAttributesTests { } @Test - public void unwrapServletException() throws Exception { + public void unwrapServletException() { RuntimeException ex = new RuntimeException("Test"); ServletException wrapped = new ServletException(new ServletException(ex)); this.request.setAttribute("javax.servlet.error.exception", wrapped); @@ -135,7 +135,7 @@ public class DefaultErrorAttributesTests { } @Test - public void getError() throws Exception { + public void getError() { Error error = new OutOfMemoryError("Test error"); this.request.setAttribute("javax.servlet.error.exception", error); Map attributes = this.errorAttributes @@ -146,7 +146,7 @@ public class DefaultErrorAttributesTests { } @Test - public void extractBindingResultErrors() throws Exception { + public void extractBindingResultErrors() { BindingResult bindingResult = new MapBindingResult( Collections.singletonMap("a", "b"), "objectName"); bindingResult.addError(new ObjectError("c", "d")); @@ -155,8 +155,7 @@ public class DefaultErrorAttributesTests { } @Test - public void extractMethodArgumentNotValidExceptionBindingResultErrors() - throws Exception { + public void extractMethodArgumentNotValidExceptionBindingResultErrors() { BindingResult bindingResult = new MapBindingResult( Collections.singletonMap("a", "b"), "objectName"); bindingResult.addError(new ObjectError("c", "d")); @@ -174,7 +173,7 @@ public class DefaultErrorAttributesTests { } @Test - public void withExceptionAttribute() throws Exception { + public void withExceptionAttribute() { DefaultErrorAttributes errorAttributes = new DefaultErrorAttributes(true); RuntimeException ex = new RuntimeException("Test"); this.request.setAttribute("javax.servlet.error.exception", ex); @@ -186,7 +185,7 @@ public class DefaultErrorAttributesTests { } @Test - public void trace() throws Exception { + public void trace() { RuntimeException ex = new RuntimeException("Test"); this.request.setAttribute("javax.servlet.error.exception", ex); Map attributes = this.errorAttributes @@ -195,7 +194,7 @@ public class DefaultErrorAttributesTests { } @Test - public void noTrace() throws Exception { + public void noTrace() { RuntimeException ex = new RuntimeException("Test"); this.request.setAttribute("javax.servlet.error.exception", ex); Map attributes = this.errorAttributes @@ -204,7 +203,7 @@ public class DefaultErrorAttributesTests { } @Test - public void path() throws Exception { + public void path() { this.request.setAttribute("javax.servlet.error.request_uri", "path"); Map attributes = this.errorAttributes .getErrorAttributes(this.webRequest, false); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactoryTests.java index 6a9a9519c4..2aa9c695b1 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactoryTests.java @@ -177,7 +177,7 @@ public abstract class AbstractServletWebServerFactoryTests { } @Test - public void stopCalledTwice() throws Exception { + public void stopCalledTwice() { AbstractServletWebServerFactory factory = getFactory(); this.webServer = factory.getWebServer(exampleServletRegistration()); this.webServer.start(); @@ -186,7 +186,7 @@ public abstract class AbstractServletWebServerFactoryTests { } @Test - public void emptyServerWhenPortIsMinusOne() throws Exception { + public void emptyServerWhenPortIsMinusOne() { AbstractServletWebServerFactory factory = getFactory(); factory.setPort(-1); this.webServer = factory.getWebServer(exampleServletRegistration()); @@ -217,7 +217,7 @@ public abstract class AbstractServletWebServerFactoryTests { } @Test - public void startBlocksUntilReadyToServe() throws Exception { + public void startBlocksUntilReadyToServe() { AbstractServletWebServerFactory factory = getFactory(); final Date[] date = new Date[1]; this.webServer = factory.getWebServer((servletContext) -> { @@ -234,7 +234,7 @@ public abstract class AbstractServletWebServerFactoryTests { } @Test - public void loadOnStartAfterContextIsInitialized() throws Exception { + public void loadOnStartAfterContextIsInitialized() { AbstractServletWebServerFactory factory = getFactory(); final InitCountingServlet servlet = new InitCountingServlet(); this.webServer = factory.getWebServer((servletContext) -> servletContext @@ -276,21 +276,21 @@ public abstract class AbstractServletWebServerFactoryTests { } @Test - public void contextPathMustStartWithSlash() throws Exception { + public void contextPathMustStartWithSlash() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("ContextPath must start with '/' and not end with '/'"); getFactory().setContextPath("missingslash"); } @Test - public void contextPathMustNotEndWithSlash() throws Exception { + public void contextPathMustNotEndWithSlash() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("ContextPath must start with '/' and not end with '/'"); getFactory().setContextPath("extraslash/"); } @Test - public void contextRootPathMustNotBeSlash() throws Exception { + public void contextRootPathMustNotBeSlash() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage( "Root ContextPath must be specified using an empty string"); @@ -712,7 +712,7 @@ public abstract class AbstractServletWebServerFactoryTests { } @Test - public void defaultSessionTimeout() throws Exception { + public void defaultSessionTimeout() { assertThat(getFactory().getSessionTimeout()).isEqualTo(Duration.ofMinutes(30)); } @@ -749,7 +749,7 @@ public abstract class AbstractServletWebServerFactoryTests { } @Test - public void getValidSessionStoreWhenSessionStoreNotSet() throws Exception { + public void getValidSessionStoreWhenSessionStoreNotSet() { AbstractServletWebServerFactory factory = getFactory(); File dir = factory.getValidSessionStoreDir(false); assertThat(dir.getName()).isEqualTo("servlet-sessions"); @@ -757,7 +757,7 @@ public abstract class AbstractServletWebServerFactoryTests { } @Test - public void getValidSessionStoreWhenSessionStoreIsRelative() throws Exception { + public void getValidSessionStoreWhenSessionStoreIsRelative() { AbstractServletWebServerFactory factory = getFactory(); factory.setSessionStoreDir(new File("sessions")); File dir = factory.getValidSessionStoreDir(false); @@ -820,7 +820,7 @@ public abstract class AbstractServletWebServerFactoryTests { } @Test - public void mimeMappingsAreCorrectlyConfigured() throws Exception { + public void mimeMappingsAreCorrectlyConfigured() { AbstractServletWebServerFactory factory = getFactory(); this.webServer = factory.getWebServer(); Map configuredMimeMappings = getActualMimeMappings(); @@ -838,7 +838,7 @@ public abstract class AbstractServletWebServerFactoryTests { } @Test - public void rootServletContextResource() throws Exception { + public void rootServletContextResource() { AbstractServletWebServerFactory factory = getFactory(); final AtomicReference rootResource = new AtomicReference<>(); this.webServer = factory.getWebServer((servletContext) -> { @@ -910,7 +910,7 @@ public abstract class AbstractServletWebServerFactoryTests { } @Test - public void localeCharsetMappingsAreConfigured() throws Exception { + public void localeCharsetMappingsAreConfigured() { AbstractServletWebServerFactory factory = getFactory(); Map mappings = new HashMap<>(); mappings.put(Locale.GERMAN, StandardCharsets.UTF_8); @@ -944,7 +944,7 @@ public abstract class AbstractServletWebServerFactoryTests { } @Test - public void faultyFilterCausesStartFailure() throws Exception { + public void faultyFilterCausesStartFailure() { AbstractServletWebServerFactory factory = getFactory(); factory.addInitializers( (servletContext) -> servletContext.addFilter("faulty", new Filter() { @@ -997,7 +997,7 @@ public abstract class AbstractServletWebServerFactoryTests { } private String setUpFactoryForCompression(int contentSize, String[] mimeTypes, - String[] excludedUserAgents) throws Exception { + String[] excludedUserAgents) { char[] chars = new char[contentSize]; Arrays.fill(chars, 'F'); String testContent = new String(chars); @@ -1017,7 +1017,7 @@ public abstract class AbstractServletWebServerFactoryTests { @Override protected void service(HttpServletRequest req, HttpServletResponse resp) - throws ServletException, IOException { + throws IOException { resp.setContentType("text/plain"); resp.setContentLength(testContent.length()); resp.getWriter().write(testContent); @@ -1140,8 +1140,7 @@ public abstract class AbstractServletWebServerFactoryTests { new ExampleServlet() { @Override - public void service(ServletRequest request, ServletResponse response) - throws ServletException, IOException { + public void service(ServletRequest request, ServletResponse response) { throw new RuntimeException("Planned"); } @@ -1156,7 +1155,7 @@ public abstract class AbstractServletWebServerFactoryTests { @Override public void service(ServletRequest request, ServletResponse response) - throws ServletException, IOException { + throws IOException { HttpSession session = ((HttpServletRequest) request) .getSession(true); long value = System.currentTimeMillis(); @@ -1226,13 +1225,12 @@ public abstract class AbstractServletWebServerFactoryTests { private int initCount; @Override - public void init() throws ServletException { + public void init() { this.initCount++; } @Override - public void service(ServletRequest req, ServletResponse res) - throws ServletException, IOException { + public void service(ServletRequest req, ServletResponse res) { } public int getInitCount() { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/support/ErrorPageFilterIntegrationTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/support/ErrorPageFilterIntegrationTests.java index 142966d1c7..0b0ff7c7f0 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/support/ErrorPageFilterIntegrationTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/support/ErrorPageFilterIntegrationTests.java @@ -155,7 +155,7 @@ public class ErrorPageFilterIntegrationTests { @Override public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, - ModelAndView modelAndView) throws Exception { + ModelAndView modelAndView) { HelloWorldController.this.setStatus(response.getStatus()); HelloWorldController.this.latch.countDown(); } @@ -182,8 +182,7 @@ public class ErrorPageFilterIntegrationTests { private static final String[] EMPTY_RESOURCE_SUFFIXES = {}; @Override - public ApplicationContext loadContext(MergedContextConfiguration config) - throws Exception { + public ApplicationContext loadContext(MergedContextConfiguration config) { AnnotationConfigServletWebServerApplicationContext context = new AnnotationConfigServletWebServerApplicationContext( config.getClasses()); context.registerShutdownHook(); @@ -191,7 +190,7 @@ public class ErrorPageFilterIntegrationTests { } @Override - public ApplicationContext loadContext(String... locations) throws Exception { + public ApplicationContext loadContext(String... locations) { throw new UnsupportedOptionException(); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/support/SpringBootServletInitializerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/support/SpringBootServletInitializerTests.java index b340fa4e97..1543ff0074 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/support/SpringBootServletInitializerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/support/SpringBootServletInitializerTests.java @@ -20,7 +20,6 @@ import java.util.Arrays; import java.util.Collections; import javax.servlet.ServletContext; -import javax.servlet.ServletException; import org.junit.Rule; import org.junit.Test; @@ -63,7 +62,7 @@ public class SpringBootServletInitializerTests { private SpringApplication application; @Test - public void failsWithoutConfigure() throws Exception { + public void failsWithoutConfigure() { this.thrown.expect(IllegalStateException.class); this.thrown.expectMessage("No SpringApplication sources have been defined"); new MockSpringBootServletInitializer() @@ -71,7 +70,7 @@ public class SpringBootServletInitializerTests { } @Test - public void withConfigurationAnnotation() throws Exception { + public void withConfigurationAnnotation() { new WithConfigurationAnnotation() .createRootApplicationContext(this.servletContext); assertThat(this.application.getAllSources()).containsOnly( @@ -79,14 +78,14 @@ public class SpringBootServletInitializerTests { } @Test - public void withConfiguredSource() throws Exception { + public void withConfiguredSource() { new WithConfiguredSource().createRootApplicationContext(this.servletContext); assertThat(this.application.getAllSources()).containsOnly(Config.class, ErrorPageFilterConfiguration.class); } @Test - public void applicationBuilderCanBeCustomized() throws Exception { + public void applicationBuilderCanBeCustomized() { CustomSpringBootServletInitializer servletInitializer = new CustomSpringBootServletInitializer(); servletInitializer.createRootApplicationContext(this.servletContext); assertThat(servletInitializer.applicationBuilder.built).isTrue(); @@ -94,7 +93,7 @@ public class SpringBootServletInitializerTests { @Test @SuppressWarnings("rawtypes") - public void mainClassHasSensibleDefault() throws Exception { + public void mainClassHasSensibleDefault() { new WithConfigurationAnnotation() .createRootApplicationContext(this.servletContext); Class mainApplicationClass = (Class) new DirectFieldAccessor(this.application) @@ -103,7 +102,7 @@ public class SpringBootServletInitializerTests { } @Test - public void errorPageFilterRegistrationCanBeDisabled() throws Exception { + public void errorPageFilterRegistrationCanBeDisabled() { WebServer webServer = new UndertowServletWebServerFactory(0) .getWebServer((servletContext) -> { try (AbstractApplicationContext context = (AbstractApplicationContext) new WithErrorPageFilterNotRegistered() @@ -121,8 +120,7 @@ public class SpringBootServletInitializerTests { } @Test - public void executableWarThatUsesServletInitializerDoesNotHaveErrorPageFilterConfigured() - throws Exception { + public void executableWarThatUsesServletInitializerDoesNotHaveErrorPageFilterConfigured() { try (ConfigurableApplicationContext context = new SpringApplication( ExecutableWar.class).run()) { assertThat(context.getBeansOfType(ErrorPageFilter.class)).hasSize(0); @@ -130,8 +128,7 @@ public class SpringBootServletInitializerTests { } @Test - public void servletContextPropertySourceIsAvailablePriorToRefresh() - throws ServletException { + public void servletContextPropertySourceIsAvailablePriorToRefresh() { ServletContext servletContext = mock(ServletContext.class); given(servletContext.getInitParameterNames()).willReturn( Collections.enumeration(Arrays.asList("spring.profiles.active"))); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/yaml/SpringProfileDocumentMatcherTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/yaml/SpringProfileDocumentMatcherTests.java index 7ceaeff8d3..b284927d93 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/yaml/SpringProfileDocumentMatcherTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/yaml/SpringProfileDocumentMatcherTests.java @@ -121,7 +121,7 @@ public class SpringProfileDocumentMatcherTests { assertThat(matcher.matches(properties)).isEqualTo(MatchStatus.NOT_FOUND); } - private Properties getProperties(String values) throws IOException { + private Properties getProperties(String values) { YamlPropertiesFactoryBean yamlPropertiesFactoryBean = new YamlPropertiesFactoryBean(); ByteArrayResource resource = new ByteArrayResource(values.getBytes()); yamlPropertiesFactoryBean.setResources(resource); diff --git a/spring-boot-samples/spring-boot-sample-activemq/src/test/java/sample/activemq/SampleActiveMqTests.java b/spring-boot-samples/spring-boot-sample-activemq/src/test/java/sample/activemq/SampleActiveMqTests.java index 9d437b5510..a5da3b1743 100644 --- a/spring-boot-samples/spring-boot-sample-activemq/src/test/java/sample/activemq/SampleActiveMqTests.java +++ b/spring-boot-samples/spring-boot-sample-activemq/src/test/java/sample/activemq/SampleActiveMqTests.java @@ -16,8 +16,6 @@ package sample.activemq; -import javax.jms.JMSException; - import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -45,7 +43,7 @@ public class SampleActiveMqTests { private Producer producer; @Test - public void sendSimpleMessage() throws InterruptedException, JMSException { + public void sendSimpleMessage() throws InterruptedException { this.producer.send("Test message"); Thread.sleep(1000L); assertThat(this.outputCapture.toString().contains("Test message")).isTrue(); diff --git a/spring-boot-samples/spring-boot-sample-actuator-custom-security/src/test/java/sample/actuator/customsecurity/CorsSampleActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator-custom-security/src/test/java/sample/actuator/customsecurity/CorsSampleActuatorApplicationTests.java index 574289f025..dd70c468a8 100644 --- a/spring-boot-samples/spring-boot-sample-actuator-custom-security/src/test/java/sample/actuator/customsecurity/CorsSampleActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator-custom-security/src/test/java/sample/actuator/customsecurity/CorsSampleActuatorApplicationTests.java @@ -54,7 +54,7 @@ public class CorsSampleActuatorApplicationTests { private ApplicationContext applicationContext; @Before - public void setUp() throws Exception { + public void setUp() { RestTemplate restTemplate = new RestTemplate(); LocalHostUriTemplateHandler handler = new LocalHostUriTemplateHandler( this.applicationContext.getEnvironment(), "http"); @@ -64,7 +64,7 @@ public class CorsSampleActuatorApplicationTests { } @Test - public void endpointShouldReturnUnauthorized() throws Exception { + public void endpointShouldReturnUnauthorized() { ResponseEntity entity = this.testRestTemplate.getForEntity("/actuator/env", Map.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.UNAUTHORIZED); diff --git a/spring-boot-samples/spring-boot-sample-actuator-custom-security/src/test/java/sample/actuator/customsecurity/ManagementPortAndPathSampleActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator-custom-security/src/test/java/sample/actuator/customsecurity/ManagementPortAndPathSampleActuatorApplicationTests.java index d561c3c69a..7005c84da2 100644 --- a/spring-boot-samples/spring-boot-sample-actuator-custom-security/src/test/java/sample/actuator/customsecurity/ManagementPortAndPathSampleActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator-custom-security/src/test/java/sample/actuator/customsecurity/ManagementPortAndPathSampleActuatorApplicationTests.java @@ -48,7 +48,7 @@ public class ManagementPortAndPathSampleActuatorApplicationTests { private int managementPort = 9011; @Test - public void testHome() throws Exception { + public void testHome() { ResponseEntity entity = new TestRestTemplate("user", "password") .getForEntity("http://localhost:" + this.port, String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); @@ -56,7 +56,7 @@ public class ManagementPortAndPathSampleActuatorApplicationTests { } @Test - public void testSecureActuator() throws Exception { + public void testSecureActuator() { ResponseEntity entity = new TestRestTemplate().getForEntity( "http://localhost:" + this.managementPort + "/management/actuator/env", String.class); @@ -64,7 +64,7 @@ public class ManagementPortAndPathSampleActuatorApplicationTests { } @Test - public void testInsecureActuator() throws Exception { + public void testInsecureActuator() { ResponseEntity entity = new TestRestTemplate().getForEntity( "http://localhost:" + this.managementPort + "/management/actuator/health", String.class); @@ -73,7 +73,7 @@ public class ManagementPortAndPathSampleActuatorApplicationTests { } @Test - public void testMissing() throws Exception { + public void testMissing() { ResponseEntity entity = new TestRestTemplate("admin", "admin") .getForEntity("http://localhost:" + this.managementPort + "/management/actuator/missing", String.class); diff --git a/spring-boot-samples/spring-boot-sample-actuator-custom-security/src/test/java/sample/actuator/customsecurity/SampleActuatorCustomSecurityApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator-custom-security/src/test/java/sample/actuator/customsecurity/SampleActuatorCustomSecurityApplicationTests.java index 8d9272349e..9e6b827892 100644 --- a/spring-boot-samples/spring-boot-sample-actuator-custom-security/src/test/java/sample/actuator/customsecurity/SampleActuatorCustomSecurityApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator-custom-security/src/test/java/sample/actuator/customsecurity/SampleActuatorCustomSecurityApplicationTests.java @@ -41,7 +41,7 @@ public class SampleActuatorCustomSecurityApplicationTests { private TestRestTemplate restTemplate; @Test - public void homeIsSecure() throws Exception { + public void homeIsSecure() { @SuppressWarnings("rawtypes") ResponseEntity entity = this.restTemplate.getForEntity("/", Map.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.UNAUTHORIZED); @@ -52,7 +52,7 @@ public class SampleActuatorCustomSecurityApplicationTests { } @Test - public void testInsecureApplicationPath() throws Exception { + public void testInsecureApplicationPath() { @SuppressWarnings("rawtypes") ResponseEntity entity = this.restTemplate.getForEntity("/foo", Map.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR); @@ -63,7 +63,7 @@ public class SampleActuatorCustomSecurityApplicationTests { } @Test - public void testInsecureStaticResources() throws Exception { + public void testInsecureStaticResources() { ResponseEntity entity = this.restTemplate .getForEntity("/css/bootstrap.min.css", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); @@ -71,7 +71,7 @@ public class SampleActuatorCustomSecurityApplicationTests { } @Test - public void insecureActuator() throws Exception { + public void insecureActuator() { ResponseEntity entity = this.restTemplate.getForEntity("/actuator/health", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); @@ -79,7 +79,7 @@ public class SampleActuatorCustomSecurityApplicationTests { } @Test - public void secureActuator() throws Exception { + public void secureActuator() { @SuppressWarnings("rawtypes") ResponseEntity entity = this.restTemplate.getForEntity("/actuator/env", Map.class); diff --git a/spring-boot-samples/spring-boot-sample-actuator-ui/src/test/java/sample/actuator/ui/SampleActuatorUiApplicationPortTests.java b/spring-boot-samples/spring-boot-sample-actuator-ui/src/test/java/sample/actuator/ui/SampleActuatorUiApplicationPortTests.java index 8b18a87087..6e2437c2fd 100644 --- a/spring-boot-samples/spring-boot-sample-actuator-ui/src/test/java/sample/actuator/ui/SampleActuatorUiApplicationPortTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator-ui/src/test/java/sample/actuator/ui/SampleActuatorUiApplicationPortTests.java @@ -49,14 +49,14 @@ public class SampleActuatorUiApplicationPortTests { private int managementPort = 9011; @Test - public void testHome() throws Exception { + public void testHome() { ResponseEntity entity = new TestRestTemplate() .getForEntity("http://localhost:" + this.port, String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); } @Test - public void testMetrics() throws Exception { + public void testMetrics() { @SuppressWarnings("rawtypes") ResponseEntity entity = new TestRestTemplate().getForEntity( "http://localhost:" + this.managementPort + "/actuator/metrics", @@ -65,7 +65,7 @@ public class SampleActuatorUiApplicationPortTests { } @Test - public void testHealth() throws Exception { + public void testHealth() { ResponseEntity entity = new TestRestTemplate() .withBasicAuth("user", getPassword()).getForEntity( "http://localhost:" + this.managementPort + "/actuator/health", diff --git a/spring-boot-samples/spring-boot-sample-actuator-ui/src/test/java/sample/actuator/ui/SampleActuatorUiApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator-ui/src/test/java/sample/actuator/ui/SampleActuatorUiApplicationTests.java index 2a66fd0196..de9313da95 100644 --- a/spring-boot-samples/spring-boot-sample-actuator-ui/src/test/java/sample/actuator/ui/SampleActuatorUiApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator-ui/src/test/java/sample/actuator/ui/SampleActuatorUiApplicationTests.java @@ -49,7 +49,7 @@ public class SampleActuatorUiApplicationTests { private TestRestTemplate restTemplate; @Test - public void testHome() throws Exception { + public void testHome() { HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.TEXT_HTML)); ResponseEntity entity = this.restTemplate @@ -60,7 +60,7 @@ public class SampleActuatorUiApplicationTests { } @Test - public void testCss() throws Exception { + public void testCss() { ResponseEntity entity = this.restTemplate .getForEntity("/css/bootstrap.min.css", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); @@ -68,7 +68,7 @@ public class SampleActuatorUiApplicationTests { } @Test - public void testMetrics() throws Exception { + public void testMetrics() { @SuppressWarnings("rawtypes") ResponseEntity entity = this.restTemplate.getForEntity("/actuator/metrics", Map.class); @@ -76,7 +76,7 @@ public class SampleActuatorUiApplicationTests { } @Test - public void testError() throws Exception { + public void testError() { HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.TEXT_HTML)); ResponseEntity entity = this.restTemplate diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/EndpointsPropertiesSampleActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/EndpointsPropertiesSampleActuatorApplicationTests.java index 8fc1182d55..f65defbf6d 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/EndpointsPropertiesSampleActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/EndpointsPropertiesSampleActuatorApplicationTests.java @@ -46,7 +46,7 @@ public class EndpointsPropertiesSampleActuatorApplicationTests { private TestRestTemplate restTemplate; @Test - public void testCustomErrorPath() throws Exception { + public void testCustomErrorPath() { @SuppressWarnings("rawtypes") ResponseEntity entity = this.restTemplate .withBasicAuth("user", getPassword()).getForEntity("/oops", Map.class); @@ -58,7 +58,7 @@ public class EndpointsPropertiesSampleActuatorApplicationTests { } @Test - public void testCustomContextPath() throws Exception { + public void testCustomContextPath() { ResponseEntity entity = this.restTemplate .withBasicAuth("user", getPassword()) .getForEntity("/admin/health", String.class); diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementAddressActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementAddressActuatorApplicationTests.java index 4a9dfa0426..14fb33a922 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementAddressActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementAddressActuatorApplicationTests.java @@ -50,7 +50,7 @@ public class ManagementAddressActuatorApplicationTests { private int managementPort = 9011; @Test - public void testHome() throws Exception { + public void testHome() { @SuppressWarnings("rawtypes") ResponseEntity entity = new TestRestTemplate() .getForEntity("http://localhost:" + this.port, Map.class); @@ -58,7 +58,7 @@ public class ManagementAddressActuatorApplicationTests { } @Test - public void testHealth() throws Exception { + public void testHealth() { ResponseEntity entity = new TestRestTemplate() .withBasicAuth("user", getPassword()).getForEntity("http://localhost:" + this.managementPort + "/admin/actuator/health", String.class); diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementPathSampleActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementPathSampleActuatorApplicationTests.java index 19ddabc038..f22e17ed92 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementPathSampleActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementPathSampleActuatorApplicationTests.java @@ -45,7 +45,7 @@ public class ManagementPathSampleActuatorApplicationTests { private TestRestTemplate restTemplate; @Test - public void testHealth() throws Exception { + public void testHealth() { ResponseEntity entity = this.restTemplate .withBasicAuth("user", getPassword()) .getForEntity("/admin/health", String.class); @@ -54,7 +54,7 @@ public class ManagementPathSampleActuatorApplicationTests { } @Test - public void testHomeIsSecure() throws Exception { + public void testHomeIsSecure() { @SuppressWarnings("rawtypes") ResponseEntity entity = this.restTemplate.getForEntity("/", Map.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.UNAUTHORIZED); diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementPortAndPathSampleActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementPortAndPathSampleActuatorApplicationTests.java index 0aabe48b4a..c101e1e8de 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementPortAndPathSampleActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementPortAndPathSampleActuatorApplicationTests.java @@ -49,7 +49,7 @@ public class ManagementPortAndPathSampleActuatorApplicationTests { private int managementPort = 9011; @Test - public void testHome() throws Exception { + public void testHome() { @SuppressWarnings("rawtypes") ResponseEntity entity = new TestRestTemplate("user", getPassword()) .getForEntity("http://localhost:" + this.port, Map.class); @@ -69,7 +69,7 @@ public class ManagementPortAndPathSampleActuatorApplicationTests { } @Test - public void testHealth() throws Exception { + public void testHealth() { ResponseEntity entity = new TestRestTemplate() .withBasicAuth("user", getPassword()) .getForEntity("http://localhost:" + this.managementPort + "/admin/health", @@ -79,7 +79,7 @@ public class ManagementPortAndPathSampleActuatorApplicationTests { } @Test - public void testMissing() throws Exception { + public void testMissing() { ResponseEntity entity = new TestRestTemplate("user", getPassword()) .getForEntity( "http://localhost:" + this.managementPort + "/admin/missing", @@ -89,7 +89,7 @@ public class ManagementPortAndPathSampleActuatorApplicationTests { } @Test - public void testErrorPage() throws Exception { + public void testErrorPage() { @SuppressWarnings("rawtypes") ResponseEntity entity = new TestRestTemplate("user", getPassword()) .getForEntity("http://localhost:" + this.port + "/error", Map.class); @@ -100,7 +100,7 @@ public class ManagementPortAndPathSampleActuatorApplicationTests { } @Test - public void testManagementErrorPage() throws Exception { + public void testManagementErrorPage() { @SuppressWarnings("rawtypes") ResponseEntity entity = new TestRestTemplate("user", getPassword()) .getForEntity("http://localhost:" + this.managementPort + "/error", diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementPortSampleActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementPortSampleActuatorApplicationTests.java index 9fa396589a..4a988d683c 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementPortSampleActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementPortSampleActuatorApplicationTests.java @@ -49,7 +49,7 @@ public class ManagementPortSampleActuatorApplicationTests { private int managementPort = 9011; @Test - public void testHome() throws Exception { + public void testHome() { @SuppressWarnings("rawtypes") ResponseEntity entity = new TestRestTemplate("user", getPassword()) .getForEntity("http://localhost:" + this.port, Map.class); @@ -70,7 +70,7 @@ public class ManagementPortSampleActuatorApplicationTests { } @Test - public void testHealth() throws Exception { + public void testHealth() { ResponseEntity entity = new TestRestTemplate() .withBasicAuth("user", getPassword()).getForEntity( "http://localhost:" + this.managementPort + "/actuator/health", @@ -80,7 +80,7 @@ public class ManagementPortSampleActuatorApplicationTests { } @Test - public void testErrorPage() throws Exception { + public void testErrorPage() { @SuppressWarnings("rawtypes") ResponseEntity entity = new TestRestTemplate("user", getPassword()) .getForEntity("http://localhost:" + this.managementPort + "/error", diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/NoManagementSampleActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/NoManagementSampleActuatorApplicationTests.java index 761f2ef71e..29ecfb1a1f 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/NoManagementSampleActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/NoManagementSampleActuatorApplicationTests.java @@ -45,7 +45,7 @@ public class NoManagementSampleActuatorApplicationTests { private TestRestTemplate restTemplate; @Test - public void testHome() throws Exception { + public void testHome() { @SuppressWarnings("rawtypes") ResponseEntity entity = this.restTemplate .withBasicAuth("user", getPassword()).getForEntity("/", Map.class); diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/SampleActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/SampleActuatorApplicationTests.java index e082c11277..0c1372cd6f 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/SampleActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/SampleActuatorApplicationTests.java @@ -52,7 +52,7 @@ public class SampleActuatorApplicationTests { private TestRestTemplate restTemplate; @Test - public void testHomeIsSecure() throws Exception { + public void testHomeIsSecure() { @SuppressWarnings("rawtypes") ResponseEntity entity = this.restTemplate.getForEntity("/", Map.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.UNAUTHORIZED); @@ -63,7 +63,7 @@ public class SampleActuatorApplicationTests { } @Test - public void testMetricsIsSecure() throws Exception { + public void testMetricsIsSecure() { @SuppressWarnings("rawtypes") ResponseEntity entity = this.restTemplate.getForEntity("/metrics", Map.class); @@ -77,7 +77,7 @@ public class SampleActuatorApplicationTests { } @Test - public void testHome() throws Exception { + public void testHome() { @SuppressWarnings("rawtypes") ResponseEntity entity = this.restTemplate .withBasicAuth("user", getPassword()).getForEntity("/", Map.class); @@ -103,7 +103,7 @@ public class SampleActuatorApplicationTests { } @Test - public void testEnv() throws Exception { + public void testEnv() { @SuppressWarnings("rawtypes") ResponseEntity entity = this.restTemplate .withBasicAuth("user", getPassword()) @@ -115,7 +115,7 @@ public class SampleActuatorApplicationTests { } @Test - public void testHealth() throws Exception { + public void testHealth() { ResponseEntity entity = this.restTemplate .withBasicAuth("user", getPassword()) .getForEntity("/actuator/health", String.class); @@ -125,7 +125,7 @@ public class SampleActuatorApplicationTests { } @Test - public void testInfo() throws Exception { + public void testInfo() { ResponseEntity entity = this.restTemplate .withBasicAuth("user", getPassword()) .getForEntity("/actuator/info", String.class); @@ -140,7 +140,7 @@ public class SampleActuatorApplicationTests { } @Test - public void testErrorPage() throws Exception { + public void testErrorPage() { ResponseEntity entity = this.restTemplate .withBasicAuth("user", getPassword()).getForEntity("/foo", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR); @@ -149,7 +149,7 @@ public class SampleActuatorApplicationTests { } @Test - public void testHtmlErrorPage() throws Exception { + public void testHtmlErrorPage() { HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.TEXT_HTML)); HttpEntity request = new HttpEntity(headers); @@ -164,7 +164,7 @@ public class SampleActuatorApplicationTests { @Test @SuppressWarnings("unchecked") - public void testTrace() throws Exception { + public void testTrace() { this.restTemplate.getForEntity("/health", String.class); @SuppressWarnings("rawtypes") ResponseEntity entity = this.restTemplate @@ -181,7 +181,7 @@ public class SampleActuatorApplicationTests { @Test @SuppressWarnings("unchecked") - public void traceWithParameterMap() throws Exception { + public void traceWithParameterMap() { this.restTemplate.withBasicAuth("user", getPassword()) .getForEntity("/actuator/health?param1=value1", String.class); @SuppressWarnings("rawtypes") @@ -198,7 +198,7 @@ public class SampleActuatorApplicationTests { } @Test - public void testErrorPageDirectAccess() throws Exception { + public void testErrorPageDirectAccess() { @SuppressWarnings("rawtypes") ResponseEntity entity = this.restTemplate .withBasicAuth("user", getPassword()).getForEntity("/error", Map.class); @@ -211,7 +211,7 @@ public class SampleActuatorApplicationTests { @Test @SuppressWarnings("unchecked") - public void testBeans() throws Exception { + public void testBeans() { @SuppressWarnings("rawtypes") ResponseEntity entity = this.restTemplate .withBasicAuth("user", getPassword()) @@ -224,7 +224,7 @@ public class SampleActuatorApplicationTests { @SuppressWarnings("unchecked") @Test - public void testConfigProps() throws Exception { + public void testConfigProps() { @SuppressWarnings("rawtypes") ResponseEntity entity = this.restTemplate .withBasicAuth("user", getPassword()) diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ServletPathSampleActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ServletPathSampleActuatorApplicationTests.java index 5be3affe8a..eb21250ea9 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ServletPathSampleActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ServletPathSampleActuatorApplicationTests.java @@ -45,7 +45,7 @@ public class ServletPathSampleActuatorApplicationTests { private TestRestTemplate restTemplate; @Test - public void testErrorPath() throws Exception { + public void testErrorPath() { @SuppressWarnings("rawtypes") ResponseEntity entity = this.restTemplate .withBasicAuth("user", getPassword()) @@ -58,7 +58,7 @@ public class ServletPathSampleActuatorApplicationTests { } @Test - public void testHealth() throws Exception { + public void testHealth() { ResponseEntity entity = this.restTemplate .withBasicAuth("user", getPassword()) .getForEntity("/spring/actuator/health", String.class); @@ -67,7 +67,7 @@ public class ServletPathSampleActuatorApplicationTests { } @Test - public void testHomeIsSecure() throws Exception { + public void testHomeIsSecure() { @SuppressWarnings("rawtypes") ResponseEntity entity = this.restTemplate.getForEntity("/spring/", Map.class); diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ShutdownSampleActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ShutdownSampleActuatorApplicationTests.java index 3f2a1d26c4..66808f6c12 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ShutdownSampleActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ShutdownSampleActuatorApplicationTests.java @@ -45,7 +45,7 @@ public class ShutdownSampleActuatorApplicationTests { private TestRestTemplate restTemplate; @Test - public void testHome() throws Exception { + public void testHome() { @SuppressWarnings("rawtypes") ResponseEntity entity = this.restTemplate .withBasicAuth("user", getPassword()).getForEntity("/", Map.class); @@ -57,7 +57,7 @@ public class ShutdownSampleActuatorApplicationTests { @Test @DirtiesContext - public void testShutdown() throws Exception { + public void testShutdown() { @SuppressWarnings("rawtypes") ResponseEntity entity = this.restTemplate .withBasicAuth("user", getPassword()) diff --git a/spring-boot-samples/spring-boot-sample-atmosphere/src/test/java/sample/atmosphere/SampleAtmosphereApplicationTests.java b/spring-boot-samples/spring-boot-sample-atmosphere/src/test/java/sample/atmosphere/SampleAtmosphereApplicationTests.java index 28533a69a4..6dec510844 100644 --- a/spring-boot-samples/spring-boot-sample-atmosphere/src/test/java/sample/atmosphere/SampleAtmosphereApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-atmosphere/src/test/java/sample/atmosphere/SampleAtmosphereApplicationTests.java @@ -54,7 +54,7 @@ public class SampleAtmosphereApplicationTests { private int port = 1234; @Test - public void chatEndpoint() throws Exception { + public void chatEndpoint() { ConfigurableApplicationContext context = new SpringApplicationBuilder( ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) .properties("websocket.uri:ws://localhost:" + this.port diff --git a/spring-boot-samples/spring-boot-sample-batch/src/test/java/sample/batch/SampleBatchApplicationTests.java b/spring-boot-samples/spring-boot-sample-batch/src/test/java/sample/batch/SampleBatchApplicationTests.java index fb76088abb..df9b2c572b 100644 --- a/spring-boot-samples/spring-boot-sample-batch/src/test/java/sample/batch/SampleBatchApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-batch/src/test/java/sample/batch/SampleBatchApplicationTests.java @@ -30,7 +30,7 @@ public class SampleBatchApplicationTests { public OutputCapture outputCapture = new OutputCapture(); @Test - public void testDefaultSettings() throws Exception { + public void testDefaultSettings() { assertThat(SpringApplication .exit(SpringApplication.run(SampleBatchApplication.class))).isEqualTo(0); String output = this.outputCapture.toString(); diff --git a/spring-boot-samples/spring-boot-sample-data-cassandra/src/test/java/sample/data/cassandra/SampleCassandraApplicationTests.java b/spring-boot-samples/spring-boot-sample-data-cassandra/src/test/java/sample/data/cassandra/SampleCassandraApplicationTests.java index 54770002ba..f5b847d1cb 100644 --- a/spring-boot-samples/spring-boot-sample-data-cassandra/src/test/java/sample/data/cassandra/SampleCassandraApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-data-cassandra/src/test/java/sample/data/cassandra/SampleCassandraApplicationTests.java @@ -53,7 +53,7 @@ public class SampleCassandraApplicationTests { public static SkipOnWindows skipOnWindows = new SkipOnWindows(); @Test - public void testDefaultSettings() throws Exception { + public void testDefaultSettings() { String output = SampleCassandraApplicationTests.outputCapture.toString(); assertThat(output).contains("firstName='Alice', lastName='Smith'"); } diff --git a/spring-boot-samples/spring-boot-sample-data-couchbase/src/test/java/sample/data/couchbase/SampleCouchbaseApplicationTests.java b/spring-boot-samples/spring-boot-sample-data-couchbase/src/test/java/sample/data/couchbase/SampleCouchbaseApplicationTests.java index 2c4f2168e0..c8373e2c21 100644 --- a/spring-boot-samples/spring-boot-sample-data-couchbase/src/test/java/sample/data/couchbase/SampleCouchbaseApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-data-couchbase/src/test/java/sample/data/couchbase/SampleCouchbaseApplicationTests.java @@ -32,7 +32,7 @@ public class SampleCouchbaseApplicationTests { public OutputCapture outputCapture = new OutputCapture(); @Test - public void testDefaultSettings() throws Exception { + public void testDefaultSettings() { try { new SpringApplicationBuilder(SampleCouchbaseApplication.class) .run("--server.port=0"); diff --git a/spring-boot-samples/spring-boot-sample-data-elasticsearch/src/test/java/sample/data/elasticsearch/SampleElasticsearchApplicationTests.java b/spring-boot-samples/spring-boot-sample-data-elasticsearch/src/test/java/sample/data/elasticsearch/SampleElasticsearchApplicationTests.java index 6f362e0b54..1ec379a8b6 100644 --- a/spring-boot-samples/spring-boot-sample-data-elasticsearch/src/test/java/sample/data/elasticsearch/SampleElasticsearchApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-data-elasticsearch/src/test/java/sample/data/elasticsearch/SampleElasticsearchApplicationTests.java @@ -45,7 +45,7 @@ public class SampleElasticsearchApplicationTests { public static SkipOnWindows skipOnWindows = new SkipOnWindows(); @Test - public void testDefaultSettings() throws Exception { + public void testDefaultSettings() { try { new SpringApplicationBuilder(SampleElasticsearchApplication.class).run(); } diff --git a/spring-boot-samples/spring-boot-sample-data-ldap/src/test/java/sample/data/ldap/SampleLdapApplicationTests.java b/spring-boot-samples/spring-boot-sample-data-ldap/src/test/java/sample/data/ldap/SampleLdapApplicationTests.java index 4ab05c0670..be5253f056 100644 --- a/spring-boot-samples/spring-boot-sample-data-ldap/src/test/java/sample/data/ldap/SampleLdapApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-data-ldap/src/test/java/sample/data/ldap/SampleLdapApplicationTests.java @@ -39,7 +39,7 @@ public class SampleLdapApplicationTests { public static OutputCapture outputCapture = new OutputCapture(); @Test - public void testDefaultSettings() throws Exception { + public void testDefaultSettings() { String output = outputCapture.toString(); assertThat(output).contains("cn=Alice Smith"); } diff --git a/spring-boot-samples/spring-boot-sample-data-mongodb/src/test/java/sample/data/mongo/SampleMongoApplicationTests.java b/spring-boot-samples/spring-boot-sample-data-mongodb/src/test/java/sample/data/mongo/SampleMongoApplicationTests.java index f090004612..44ad7740b8 100644 --- a/spring-boot-samples/spring-boot-sample-data-mongodb/src/test/java/sample/data/mongo/SampleMongoApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-data-mongodb/src/test/java/sample/data/mongo/SampleMongoApplicationTests.java @@ -40,7 +40,7 @@ public class SampleMongoApplicationTests { public static OutputCapture outputCapture = new OutputCapture(); @Test - public void testDefaultSettings() throws Exception { + public void testDefaultSettings() { String output = SampleMongoApplicationTests.outputCapture.toString(); assertThat(output).contains("firstName='Alice', lastName='Smith'"); } diff --git a/spring-boot-samples/spring-boot-sample-data-neo4j/src/test/java/sample/data/neo4j/SampleNeo4jApplicationTests.java b/spring-boot-samples/spring-boot-sample-data-neo4j/src/test/java/sample/data/neo4j/SampleNeo4jApplicationTests.java index 9b06667357..852ee2b928 100644 --- a/spring-boot-samples/spring-boot-sample-data-neo4j/src/test/java/sample/data/neo4j/SampleNeo4jApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-data-neo4j/src/test/java/sample/data/neo4j/SampleNeo4jApplicationTests.java @@ -35,7 +35,7 @@ public class SampleNeo4jApplicationTests { public OutputCapture outputCapture = new OutputCapture(); @Test - public void testDefaultSettings() throws Exception { + public void testDefaultSettings() { try { SampleNeo4jApplication.main(new String[0]); } diff --git a/spring-boot-samples/spring-boot-sample-data-redis/src/test/java/sample/data/redis/SampleRedisApplicationTests.java b/spring-boot-samples/spring-boot-sample-data-redis/src/test/java/sample/data/redis/SampleRedisApplicationTests.java index 1904fb7a74..aa58126643 100644 --- a/spring-boot-samples/spring-boot-sample-data-redis/src/test/java/sample/data/redis/SampleRedisApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-data-redis/src/test/java/sample/data/redis/SampleRedisApplicationTests.java @@ -35,7 +35,7 @@ public class SampleRedisApplicationTests { public OutputCapture outputCapture = new OutputCapture(); @Test - public void testDefaultSettings() throws Exception { + public void testDefaultSettings() { try { SampleRedisApplication.main(new String[0]); } diff --git a/spring-boot-samples/spring-boot-sample-devtools/src/test/java/sample/devtools/SampleDevToolsApplicationIntegrationTests.java b/spring-boot-samples/spring-boot-sample-devtools/src/test/java/sample/devtools/SampleDevToolsApplicationIntegrationTests.java index 6aa50cb5ec..8b20b95523 100644 --- a/spring-boot-samples/spring-boot-sample-devtools/src/test/java/sample/devtools/SampleDevToolsApplicationIntegrationTests.java +++ b/spring-boot-samples/spring-boot-sample-devtools/src/test/java/sample/devtools/SampleDevToolsApplicationIntegrationTests.java @@ -43,7 +43,7 @@ public class SampleDevToolsApplicationIntegrationTests { private TestRestTemplate restTemplate; @Test - public void testStaticResource() throws Exception { + public void testStaticResource() { ResponseEntity entity = this.restTemplate .getForEntity("/css/application.css", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); @@ -51,7 +51,7 @@ public class SampleDevToolsApplicationIntegrationTests { } @Test - public void testPublicResource() throws Exception { + public void testPublicResource() { ResponseEntity entity = this.restTemplate.getForEntity("/public.txt", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); @@ -59,7 +59,7 @@ public class SampleDevToolsApplicationIntegrationTests { } @Test - public void testClassResource() throws Exception { + public void testClassResource() { ResponseEntity entity = this.restTemplate .getForEntity("/application.properties", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND); diff --git a/spring-boot-samples/spring-boot-sample-flyway/src/test/java/sample/flyway/SampleFlywayApplicationTests.java b/spring-boot-samples/spring-boot-sample-flyway/src/test/java/sample/flyway/SampleFlywayApplicationTests.java index cb96e82c3c..53584de32e 100644 --- a/spring-boot-samples/spring-boot-sample-flyway/src/test/java/sample/flyway/SampleFlywayApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-flyway/src/test/java/sample/flyway/SampleFlywayApplicationTests.java @@ -34,7 +34,7 @@ public class SampleFlywayApplicationTests { private JdbcTemplate template; @Test - public void testDefaultSettings() throws Exception { + public void testDefaultSettings() { assertThat(this.template.queryForObject("SELECT COUNT(*) from PERSON", Integer.class)).isEqualTo(1); } diff --git a/spring-boot-samples/spring-boot-sample-hateoas/src/test/java/sample/hateoas/SampleHateoasApplicationTests.java b/spring-boot-samples/spring-boot-sample-hateoas/src/test/java/sample/hateoas/SampleHateoasApplicationTests.java index 1b0df644c2..adf8b79c08 100644 --- a/spring-boot-samples/spring-boot-sample-hateoas/src/test/java/sample/hateoas/SampleHateoasApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-hateoas/src/test/java/sample/hateoas/SampleHateoasApplicationTests.java @@ -41,7 +41,7 @@ public class SampleHateoasApplicationTests { private TestRestTemplate restTemplate; @Test - public void hasHalLinks() throws Exception { + public void hasHalLinks() { ResponseEntity entity = this.restTemplate.getForEntity("/customers/1", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); @@ -51,7 +51,7 @@ public class SampleHateoasApplicationTests { } @Test - public void producesJsonWhenXmlIsPreferred() throws Exception { + public void producesJsonWhenXmlIsPreferred() { HttpHeaders headers = new HttpHeaders(); headers.set(HttpHeaders.ACCEPT, "application/xml;q=0.9,application/json;q=0.8"); HttpEntity request = new HttpEntity<>(headers); diff --git a/spring-boot-samples/spring-boot-sample-integration/src/test/java/sample/integration/consumer/SampleIntegrationApplicationTests.java b/spring-boot-samples/spring-boot-sample-integration/src/test/java/sample/integration/consumer/SampleIntegrationApplicationTests.java index b9ff96f52d..96227b48af 100644 --- a/spring-boot-samples/spring-boot-sample-integration/src/test/java/sample/integration/consumer/SampleIntegrationApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-integration/src/test/java/sample/integration/consumer/SampleIntegrationApplicationTests.java @@ -56,7 +56,7 @@ public class SampleIntegrationApplicationTests { deleteIfExists(new File("target/output")); } - private void deleteIfExists(File directory) throws InterruptedException { + private void deleteIfExists(File directory) { if (directory.exists()) { assertThat(FileSystemUtils.deleteRecursively(directory)).isTrue(); } diff --git a/spring-boot-samples/spring-boot-sample-jetty-jsp/src/test/java/sample/jetty/jsp/SampleWebJspApplicationTests.java b/spring-boot-samples/spring-boot-sample-jetty-jsp/src/test/java/sample/jetty/jsp/SampleWebJspApplicationTests.java index 7cac0ad5ea..4841058476 100644 --- a/spring-boot-samples/spring-boot-sample-jetty-jsp/src/test/java/sample/jetty/jsp/SampleWebJspApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-jetty-jsp/src/test/java/sample/jetty/jsp/SampleWebJspApplicationTests.java @@ -42,7 +42,7 @@ public class SampleWebJspApplicationTests { private TestRestTemplate restTemplate; @Test - public void testJspWithEl() throws Exception { + public void testJspWithEl() { ResponseEntity entity = this.restTemplate.getForEntity("/", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); assertThat(entity.getBody()).contains("/resources/text.txt"); diff --git a/spring-boot-samples/spring-boot-sample-jetty-ssl/src/test/java/sample/jetty/ssl/SampleJettySslApplicationTests.java b/spring-boot-samples/spring-boot-sample-jetty-ssl/src/test/java/sample/jetty/ssl/SampleJettySslApplicationTests.java index 0f31c21fad..490967ca14 100644 --- a/spring-boot-samples/spring-boot-sample-jetty-ssl/src/test/java/sample/jetty/ssl/SampleJettySslApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-jetty-ssl/src/test/java/sample/jetty/ssl/SampleJettySslApplicationTests.java @@ -51,7 +51,7 @@ public class SampleJettySslApplicationTests { } @Test - public void testHome() throws Exception { + public void testHome() { ResponseEntity entity = this.restTemplate.getForEntity("/", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); assertThat(entity.getBody()).isEqualTo("Hello World"); diff --git a/spring-boot-samples/spring-boot-sample-jetty/src/test/java/sample/jetty/SampleJettyApplicationTests.java b/spring-boot-samples/spring-boot-sample-jetty/src/test/java/sample/jetty/SampleJettyApplicationTests.java index c51179f6fc..0c04c0ea37 100644 --- a/spring-boot-samples/spring-boot-sample-jetty/src/test/java/sample/jetty/SampleJettyApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-jetty/src/test/java/sample/jetty/SampleJettyApplicationTests.java @@ -51,7 +51,7 @@ public class SampleJettyApplicationTests { private TestRestTemplate restTemplate; @Test - public void testHome() throws Exception { + public void testHome() { ResponseEntity entity = this.restTemplate.getForEntity("/", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); assertThat(entity.getBody()).isEqualTo("Hello World"); diff --git a/spring-boot-samples/spring-boot-sample-jooq/src/test/java/sample/jooq/SampleJooqApplicationTests.java b/spring-boot-samples/spring-boot-sample-jooq/src/test/java/sample/jooq/SampleJooqApplicationTests.java index fa56e71a06..a106cea499 100644 --- a/spring-boot-samples/spring-boot-sample-jooq/src/test/java/sample/jooq/SampleJooqApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-jooq/src/test/java/sample/jooq/SampleJooqApplicationTests.java @@ -34,7 +34,7 @@ public class SampleJooqApplicationTests { public OutputCapture out = new OutputCapture(); @Test - public void outputResults() throws Exception { + public void outputResults() { SampleJooqApplication.main(NO_ARGS); assertThat(this.out.toString()).contains("jOOQ Fetch 1 Greg Turnquest"); assertThat(this.out.toString()).contains("jOOQ Fetch 2 Craig Walls"); diff --git a/spring-boot-samples/spring-boot-sample-jta-bitronix/src/test/java/sample/bitronix/SampleBitronixApplicationTests.java b/spring-boot-samples/spring-boot-sample-jta-bitronix/src/test/java/sample/bitronix/SampleBitronixApplicationTests.java index f98719f0d3..3acb2cd1a4 100644 --- a/spring-boot-samples/spring-boot-sample-jta-bitronix/src/test/java/sample/bitronix/SampleBitronixApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-jta-bitronix/src/test/java/sample/bitronix/SampleBitronixApplicationTests.java @@ -48,7 +48,7 @@ public class SampleBitronixApplicationTests { } @Test - public void testExposesXaAndNonXa() throws Exception { + public void testExposesXaAndNonXa() { ApplicationContext context = SpringApplication .run(SampleBitronixApplication.class); Object jmsConnectionFactory = context.getBean("jmsConnectionFactory"); diff --git a/spring-boot-samples/spring-boot-sample-oauth2-client/src/test/java/sample/oauth2/client/SampleOAuth2ClientApplicationTests.java b/spring-boot-samples/spring-boot-sample-oauth2-client/src/test/java/sample/oauth2/client/SampleOAuth2ClientApplicationTests.java index b68288b7ec..3091408f24 100644 --- a/spring-boot-samples/spring-boot-sample-oauth2-client/src/test/java/sample/oauth2/client/SampleOAuth2ClientApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-oauth2-client/src/test/java/sample/oauth2/client/SampleOAuth2ClientApplicationTests.java @@ -43,7 +43,7 @@ public class SampleOAuth2ClientApplicationTests { private TestRestTemplate restTemplate; @Test - public void everythingShouldRedirectToLogin() throws Exception { + public void everythingShouldRedirectToLogin() { ResponseEntity entity = this.restTemplate.getForEntity("/", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.FOUND); assertThat(entity.getHeaders().getLocation()) @@ -51,7 +51,7 @@ public class SampleOAuth2ClientApplicationTests { } @Test - public void loginShouldHaveBothOAuthClientsToChooseFrom() throws Exception { + public void loginShouldHaveBothOAuthClientsToChooseFrom() { ResponseEntity entity = this.restTemplate.getForEntity("/login", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); diff --git a/spring-boot-samples/spring-boot-sample-parent-context/src/test/java/sample/parent/consumer/SampleIntegrationParentApplicationTests.java b/spring-boot-samples/spring-boot-sample-parent-context/src/test/java/sample/parent/consumer/SampleIntegrationParentApplicationTests.java index 9ab748690b..3e9865d578 100644 --- a/spring-boot-samples/spring-boot-sample-parent-context/src/test/java/sample/parent/consumer/SampleIntegrationParentApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-parent-context/src/test/java/sample/parent/consumer/SampleIntegrationParentApplicationTests.java @@ -44,7 +44,7 @@ public class SampleIntegrationParentApplicationTests { private static ConfigurableApplicationContext context; @BeforeClass - public static void start() throws Exception { + public static void start() { context = SpringApplication.run(SampleParentContextApplication.class); } diff --git a/spring-boot-samples/spring-boot-sample-secure/src/test/java/sample/secure/SampleSecureApplicationTests.java b/spring-boot-samples/spring-boot-sample-secure/src/test/java/sample/secure/SampleSecureApplicationTests.java index 98adaba99c..17ad27d59b 100644 --- a/spring-boot-samples/spring-boot-sample-secure/src/test/java/sample/secure/SampleSecureApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-secure/src/test/java/sample/secure/SampleSecureApplicationTests.java @@ -57,24 +57,24 @@ public class SampleSecureApplicationTests { } @Test(expected = AuthenticationException.class) - public void secure() throws Exception { + public void secure() { assertThat("Hello Security").isEqualTo(this.service.secure()); } @Test - public void authenticated() throws Exception { + public void authenticated() { SecurityContextHolder.getContext().setAuthentication(this.authentication); assertThat("Hello Security").isEqualTo(this.service.secure()); } @Test - public void preauth() throws Exception { + public void preauth() { SecurityContextHolder.getContext().setAuthentication(this.authentication); assertThat("Hello World").isEqualTo(this.service.authorized()); } @Test(expected = AccessDeniedException.class) - public void denied() throws Exception { + public void denied() { SecurityContextHolder.getContext().setAuthentication(this.authentication); assertThat("Goodbye World").isEqualTo(this.service.denied()); } diff --git a/spring-boot-samples/spring-boot-sample-servlet/src/test/java/sample/servlet/SampleServletApplicationTests.java b/spring-boot-samples/spring-boot-sample-servlet/src/test/java/sample/servlet/SampleServletApplicationTests.java index 602bf1da82..c87af750ea 100644 --- a/spring-boot-samples/spring-boot-sample-servlet/src/test/java/sample/servlet/SampleServletApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-servlet/src/test/java/sample/servlet/SampleServletApplicationTests.java @@ -48,7 +48,7 @@ public class SampleServletApplicationTests { private TestRestTemplate restTemplate; @Test - public void testHomeIsSecure() throws Exception { + public void testHomeIsSecure() { HttpHeaders headers = new HttpHeaders(); headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON)); ResponseEntity entity = this.restTemplate.exchange("/", HttpMethod.GET, @@ -57,7 +57,7 @@ public class SampleServletApplicationTests { } @Test - public void testHome() throws Exception { + public void testHome() { ResponseEntity entity = this.restTemplate .withBasicAuth("user", getPassword()).getForEntity("/", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); diff --git a/spring-boot-samples/spring-boot-sample-simple/src/test/java/sample/simple/SpringTestSampleSimpleApplicationTests.java b/spring-boot-samples/spring-boot-sample-simple/src/test/java/sample/simple/SpringTestSampleSimpleApplicationTests.java index cd41c4f52f..b83e0947a5 100644 --- a/spring-boot-samples/spring-boot-sample-simple/src/test/java/sample/simple/SpringTestSampleSimpleApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-simple/src/test/java/sample/simple/SpringTestSampleSimpleApplicationTests.java @@ -39,7 +39,7 @@ public class SpringTestSampleSimpleApplicationTests { ApplicationContext ctx; @Test - public void testContextLoads() throws Exception { + public void testContextLoads() { assertThat(this.ctx).isNotNull(); assertThat(this.ctx.containsBean("helloWorldService")).isTrue(); assertThat(this.ctx.containsBean("sampleSimpleApplication")).isTrue(); diff --git a/spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/domain/UserEntityTests.java b/spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/domain/UserEntityTests.java index 9f1d5ecddc..c472353a61 100644 --- a/spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/domain/UserEntityTests.java +++ b/spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/domain/UserEntityTests.java @@ -47,28 +47,28 @@ public class UserEntityTests { private TestEntityManager entityManager; @Test - public void createWhenUsernameIsNullShouldThrowException() throws Exception { + public void createWhenUsernameIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Username must not be empty"); new User(null, VIN); } @Test - public void createWhenUsernameIsEmptyShouldThrowException() throws Exception { + public void createWhenUsernameIsEmptyShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Username must not be empty"); new User("", VIN); } @Test - public void createWhenVinIsNullShouldThrowException() throws Exception { + public void createWhenVinIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("VIN must not be null"); new User("sboot", null); } @Test - public void saveShouldPersistData() throws Exception { + public void saveShouldPersistData() { User user = this.entityManager.persistFlushFind(new User("sboot", VIN)); assertThat(user.getUsername()).isEqualTo("sboot"); assertThat(user.getVin()).isEqualTo(VIN); diff --git a/spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/domain/UserRepositoryTests.java b/spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/domain/UserRepositoryTests.java index b61f2d0bbc..4c607ddb32 100644 --- a/spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/domain/UserRepositoryTests.java +++ b/spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/domain/UserRepositoryTests.java @@ -45,7 +45,7 @@ public class UserRepositoryTests { private UserRepository repository; @Test - public void findByUsernameShouldReturnUser() throws Exception { + public void findByUsernameShouldReturnUser() { this.entityManager.persist(new User("sboot", VIN)); User user = this.repository.findByUsername("sboot"); assertThat(user.getUsername()).isEqualTo("sboot"); @@ -53,7 +53,7 @@ public class UserRepositoryTests { } @Test - public void findByUsernameWhenNoUserShouldReturnNull() throws Exception { + public void findByUsernameWhenNoUserShouldReturnNull() { this.entityManager.persist(new User("sboot", VIN)); User user = this.repository.findByUsername("mmouse"); assertThat(user).isNull(); diff --git a/spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/domain/VehicleIdentificationNumberTests.java b/spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/domain/VehicleIdentificationNumberTests.java index 8018f6fac1..f9aef4deb0 100644 --- a/spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/domain/VehicleIdentificationNumberTests.java +++ b/spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/domain/VehicleIdentificationNumberTests.java @@ -38,34 +38,34 @@ public class VehicleIdentificationNumberTests { public ExpectedException thrown = ExpectedException.none(); @Test - public void createWhenVinIsNullShouldThrowException() throws Exception { + public void createWhenVinIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("VIN must not be null"); new VehicleIdentificationNumber(null); } @Test - public void createWhenVinIsMoreThan17CharsShouldThrowException() throws Exception { + public void createWhenVinIsMoreThan17CharsShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("VIN must be exactly 17 characters"); new VehicleIdentificationNumber("012345678901234567"); } @Test - public void createWhenVinIsLessThan17CharsShouldThrowException() throws Exception { + public void createWhenVinIsLessThan17CharsShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("VIN must be exactly 17 characters"); new VehicleIdentificationNumber("0123456789012345"); } @Test - public void toStringShouldReturnVin() throws Exception { + public void toStringShouldReturnVin() { VehicleIdentificationNumber vin = new VehicleIdentificationNumber(SAMPLE_VIN); assertThat(vin.toString()).isEqualTo(SAMPLE_VIN); } @Test - public void equalsAndHashCodeShouldBeBasedOnVin() throws Exception { + public void equalsAndHashCodeShouldBeBasedOnVin() { VehicleIdentificationNumber vin1 = new VehicleIdentificationNumber(SAMPLE_VIN); VehicleIdentificationNumber vin2 = new VehicleIdentificationNumber(SAMPLE_VIN); VehicleIdentificationNumber vin3 = new VehicleIdentificationNumber( diff --git a/spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/service/RemoteVehicleDetailsServiceTests.java b/spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/service/RemoteVehicleDetailsServiceTests.java index 40f600dfe9..9acf27f058 100644 --- a/spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/service/RemoteVehicleDetailsServiceTests.java +++ b/spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/service/RemoteVehicleDetailsServiceTests.java @@ -58,15 +58,14 @@ public class RemoteVehicleDetailsServiceTests { private MockRestServiceServer server; @Test - public void getVehicleDetailsWhenVinIsNullShouldThrowException() throws Exception { + public void getVehicleDetailsWhenVinIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("VIN must not be null"); this.service.getVehicleDetails(null); } @Test - public void getVehicleDetailsWhenResultIsSuccessShouldReturnDetails() - throws Exception { + public void getVehicleDetailsWhenResultIsSuccessShouldReturnDetails() { this.server.expect(requestTo("/vehicle/" + VIN + "/details")) .andRespond(withSuccess(getClassPathResource("vehicledetails.json"), MediaType.APPLICATION_JSON)); @@ -77,8 +76,7 @@ public class RemoteVehicleDetailsServiceTests { } @Test - public void getVehicleDetailsWhenResultIsNotFoundShouldThrowException() - throws Exception { + public void getVehicleDetailsWhenResultIsNotFoundShouldThrowException() { this.server.expect(requestTo("/vehicle/" + VIN + "/details")) .andRespond(withStatus(HttpStatus.NOT_FOUND)); this.thrown.expect(VehicleIdentificationNumberNotFoundException.class); @@ -86,8 +84,7 @@ public class RemoteVehicleDetailsServiceTests { } @Test - public void getVehicleDetailsWhenResultIServerErrorShouldThrowException() - throws Exception { + public void getVehicleDetailsWhenResultIServerErrorShouldThrowException() { this.server.expect(requestTo("/vehicle/" + VIN + "/details")) .andRespond(withServerError()); this.thrown.expect(HttpServerErrorException.class); diff --git a/spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/web/UserVehicleControllerApplicationTests.java b/spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/web/UserVehicleControllerApplicationTests.java index 6be22763d8..ce65c968a7 100644 --- a/spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/web/UserVehicleControllerApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/web/UserVehicleControllerApplicationTests.java @@ -66,7 +66,7 @@ public class UserVehicleControllerApplicationTests { } @Test - public void welcomeCommandLineRunnerShouldBeAvailable() throws Exception { + public void welcomeCommandLineRunnerShouldBeAvailable() { // Since we're a @SpringBootTest all beans should be available. assertThat(this.applicationContext.getBean(WelcomeCommandLineRunner.class)) .isNotNull(); diff --git a/spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/web/UserVehicleControllerSeleniumTests.java b/spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/web/UserVehicleControllerSeleniumTests.java index ca54240f75..7d7663cf53 100644 --- a/spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/web/UserVehicleControllerSeleniumTests.java +++ b/spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/web/UserVehicleControllerSeleniumTests.java @@ -47,7 +47,7 @@ public class UserVehicleControllerSeleniumTests { private UserVehicleService userVehicleService; @Test - public void getVehicleWhenRequestingTextShouldReturnMakeAndModel() throws Exception { + public void getVehicleWhenRequestingTextShouldReturnMakeAndModel() { given(this.userVehicleService.getVehicleDetails("sboot")) .willReturn(new VehicleDetails("Honda", "Civic")); this.webDriver.get("/sboot/vehicle.html"); diff --git a/spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/web/UserVehicleControllerTests.java b/spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/web/UserVehicleControllerTests.java index a2fd06ca94..a02be487c9 100644 --- a/spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/web/UserVehicleControllerTests.java +++ b/spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/web/UserVehicleControllerTests.java @@ -101,7 +101,7 @@ public class UserVehicleControllerTests { } @Test(expected = NoSuchBeanDefinitionException.class) - public void welcomeCommandLineRunnerShouldBeAvailable() throws Exception { + public void welcomeCommandLineRunnerShouldBeAvailable() { // Since we're a @WebMvcTest WelcomeCommandLineRunner should not be available. assertThat(this.applicationContext.getBean(WelcomeCommandLineRunner.class)); } diff --git a/spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/web/UserVehicleServiceTests.java b/spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/web/UserVehicleServiceTests.java index 8f5eeff702..6198c4bf56 100644 --- a/spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/web/UserVehicleServiceTests.java +++ b/spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/web/UserVehicleServiceTests.java @@ -61,23 +61,21 @@ public class UserVehicleServiceTests { } @Test - public void getVehicleDetailsWhenUsernameIsNullShouldThrowException() - throws Exception { + public void getVehicleDetailsWhenUsernameIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Username must not be null"); this.service.getVehicleDetails(null); } @Test - public void getVehicleDetailsWhenUsernameNotFoundShouldThrowException() - throws Exception { + public void getVehicleDetailsWhenUsernameNotFoundShouldThrowException() { given(this.userRepository.findByUsername(anyString())).willReturn(null); this.thrown.expect(UserNameNotFoundException.class); this.service.getVehicleDetails("sboot"); } @Test - public void getVehicleDetailsShouldReturnMakeAndModel() throws Exception { + public void getVehicleDetailsShouldReturnMakeAndModel() { given(this.userRepository.findByUsername(anyString())) .willReturn(new User("sboot", VIN)); VehicleDetails details = new VehicleDetails("Honda", "Civic"); diff --git a/spring-boot-samples/spring-boot-sample-testng/src/test/java/sample/testng/SampleTestNGApplicationTests.java b/spring-boot-samples/spring-boot-sample-testng/src/test/java/sample/testng/SampleTestNGApplicationTests.java index 5217fcdbf8..83e2a40cdf 100644 --- a/spring-boot-samples/spring-boot-sample-testng/src/test/java/sample/testng/SampleTestNGApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-testng/src/test/java/sample/testng/SampleTestNGApplicationTests.java @@ -40,7 +40,7 @@ public class SampleTestNGApplicationTests extends AbstractTestNGSpringContextTes private TestRestTemplate restTemplate; @Test - public void testHome() throws Exception { + public void testHome() { ResponseEntity entity = this.restTemplate.getForEntity("/", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); assertThat(entity.getBody()).isEqualTo("Hello World"); diff --git a/spring-boot-samples/spring-boot-sample-tomcat-jsp/src/test/java/sample/tomcat/jsp/SampleWebJspApplicationTests.java b/spring-boot-samples/spring-boot-sample-tomcat-jsp/src/test/java/sample/tomcat/jsp/SampleWebJspApplicationTests.java index 7c4740f1f7..138ef15fc2 100644 --- a/spring-boot-samples/spring-boot-sample-tomcat-jsp/src/test/java/sample/tomcat/jsp/SampleWebJspApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-tomcat-jsp/src/test/java/sample/tomcat/jsp/SampleWebJspApplicationTests.java @@ -42,7 +42,7 @@ public class SampleWebJspApplicationTests { private TestRestTemplate restTemplate; @Test - public void testJspWithEl() throws Exception { + public void testJspWithEl() { ResponseEntity entity = this.restTemplate.getForEntity("/", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); assertThat(entity.getBody()).contains("/resources/text.txt"); diff --git a/spring-boot-samples/spring-boot-sample-tomcat-multi-connectors/src/test/java/sample/tomcat/multiconnector/SampleTomcatTwoConnectorsApplicationTests.java b/spring-boot-samples/spring-boot-sample-tomcat-multi-connectors/src/test/java/sample/tomcat/multiconnector/SampleTomcatTwoConnectorsApplicationTests.java index d516a0aef8..c206dc79cd 100644 --- a/spring-boot-samples/spring-boot-sample-tomcat-multi-connectors/src/test/java/sample/tomcat/multiconnector/SampleTomcatTwoConnectorsApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-tomcat-multi-connectors/src/test/java/sample/tomcat/multiconnector/SampleTomcatTwoConnectorsApplicationTests.java @@ -68,7 +68,7 @@ public class SampleTomcatTwoConnectorsApplicationTests { } @Test - public void testHello() throws Exception { + public void testHello() { assertThat(this.ports.getHttpsPort()).isEqualTo(this.port); assertThat(this.ports.getHttpPort()).isNotEqualTo(this.port); ResponseEntity entity = this.restTemplate.getForEntity( diff --git a/spring-boot-samples/spring-boot-sample-tomcat-ssl/src/test/java/sample/tomcat/ssl/SampleTomcatSslApplicationTests.java b/spring-boot-samples/spring-boot-sample-tomcat-ssl/src/test/java/sample/tomcat/ssl/SampleTomcatSslApplicationTests.java index 46372570f8..9eb76c8085 100644 --- a/spring-boot-samples/spring-boot-sample-tomcat-ssl/src/test/java/sample/tomcat/ssl/SampleTomcatSslApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-tomcat-ssl/src/test/java/sample/tomcat/ssl/SampleTomcatSslApplicationTests.java @@ -46,7 +46,7 @@ public class SampleTomcatSslApplicationTests { } @Test - public void testHome() throws Exception { + public void testHome() { ResponseEntity entity = this.restTemplate.getForEntity("/", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); assertThat(entity.getBody()).isEqualTo("Hello, world"); diff --git a/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/NonAutoConfigurationSampleTomcatApplicationTests.java b/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/NonAutoConfigurationSampleTomcatApplicationTests.java index d159def175..4447bf3ffc 100644 --- a/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/NonAutoConfigurationSampleTomcatApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/NonAutoConfigurationSampleTomcatApplicationTests.java @@ -61,14 +61,14 @@ public class NonAutoConfigurationSampleTomcatApplicationTests { HelloWorldService.class }) public static class NonAutoConfigurationSampleTomcatApplication { - public static void main(String[] args) throws Exception { + public static void main(String[] args) { SpringApplication.run(SampleTomcatApplication.class, args); } } @Test - public void testHome() throws Exception { + public void testHome() { ResponseEntity entity = this.restTemplate.getForEntity("/", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); assertThat(entity.getBody()).isEqualTo("Hello World"); diff --git a/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/SampleTomcatApplicationTests.java b/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/SampleTomcatApplicationTests.java index e36081e2a9..6bd2f0c769 100644 --- a/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/SampleTomcatApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/SampleTomcatApplicationTests.java @@ -59,7 +59,7 @@ public class SampleTomcatApplicationTests { private ApplicationContext applicationContext; @Test - public void testHome() throws Exception { + public void testHome() { ResponseEntity entity = this.restTemplate.getForEntity("/", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); assertThat(entity.getBody()).isEqualTo("Hello World"); @@ -81,7 +81,7 @@ public class SampleTomcatApplicationTests { } @Test - public void testTimeout() throws Exception { + public void testTimeout() { ServletWebServerApplicationContext context = (ServletWebServerApplicationContext) this.applicationContext; TomcatWebServer embeddedServletContainer = (TomcatWebServer) context .getWebServer(); diff --git a/spring-boot-samples/spring-boot-sample-traditional/src/test/java/sample/traditional/SampleTraditionalApplicationTests.java b/spring-boot-samples/spring-boot-sample-traditional/src/test/java/sample/traditional/SampleTraditionalApplicationTests.java index 6f51f1500a..ac6dd0f32f 100644 --- a/spring-boot-samples/spring-boot-sample-traditional/src/test/java/sample/traditional/SampleTraditionalApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-traditional/src/test/java/sample/traditional/SampleTraditionalApplicationTests.java @@ -42,7 +42,7 @@ public class SampleTraditionalApplicationTests { private TestRestTemplate restTemplate; @Test - public void testHomeJsp() throws Exception { + public void testHomeJsp() { ResponseEntity entity = this.restTemplate.getForEntity("/", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); String body = entity.getBody(); @@ -50,7 +50,7 @@ public class SampleTraditionalApplicationTests { } @Test - public void testStaticPage() throws Exception { + public void testStaticPage() { ResponseEntity entity = this.restTemplate.getForEntity("/index.html", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); diff --git a/spring-boot-samples/spring-boot-sample-undertow/src/test/java/sample/undertow/SampleUndertowApplicationTests.java b/spring-boot-samples/spring-boot-sample-undertow/src/test/java/sample/undertow/SampleUndertowApplicationTests.java index 47c20b207d..786e00c82e 100644 --- a/spring-boot-samples/spring-boot-sample-undertow/src/test/java/sample/undertow/SampleUndertowApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-undertow/src/test/java/sample/undertow/SampleUndertowApplicationTests.java @@ -51,12 +51,12 @@ public class SampleUndertowApplicationTests { private TestRestTemplate restTemplate; @Test - public void testHome() throws Exception { + public void testHome() { assertOkResponse("/", "Hello World"); } @Test - public void testAsync() throws Exception { + public void testAsync() { assertOkResponse("/async", "async: Hello World"); } diff --git a/spring-boot-samples/spring-boot-sample-web-freemarker/src/test/java/sample/freemarker/SampleWebFreeMarkerApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-freemarker/src/test/java/sample/freemarker/SampleWebFreeMarkerApplicationTests.java index 4fcd7b3b2c..d08913c6e3 100644 --- a/spring-boot-samples/spring-boot-sample-web-freemarker/src/test/java/sample/freemarker/SampleWebFreeMarkerApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-freemarker/src/test/java/sample/freemarker/SampleWebFreeMarkerApplicationTests.java @@ -49,7 +49,7 @@ public class SampleWebFreeMarkerApplicationTests { private TestRestTemplate testRestTemplate; @Test - public void testFreeMarkerTemplate() throws Exception { + public void testFreeMarkerTemplate() { ResponseEntity entity = this.testRestTemplate.getForEntity("/", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); @@ -57,7 +57,7 @@ public class SampleWebFreeMarkerApplicationTests { } @Test - public void testFreeMarkerErrorTemplate() throws Exception { + public void testFreeMarkerErrorTemplate() { HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.TEXT_HTML)); HttpEntity requestEntity = new HttpEntity<>(headers); diff --git a/spring-boot-samples/spring-boot-sample-web-groovy-templates/src/test/java/sample/groovytemplates/SampleGroovyTemplateApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-groovy-templates/src/test/java/sample/groovytemplates/SampleGroovyTemplateApplicationTests.java index 267848f207..3748c9ab2f 100644 --- a/spring-boot-samples/spring-boot-sample-web-groovy-templates/src/test/java/sample/groovytemplates/SampleGroovyTemplateApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-groovy-templates/src/test/java/sample/groovytemplates/SampleGroovyTemplateApplicationTests.java @@ -50,7 +50,7 @@ public class SampleGroovyTemplateApplicationTests { private TestRestTemplate restTemplate; @Test - public void testHome() throws Exception { + public void testHome() { ResponseEntity entity = this.restTemplate.getForEntity("/", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); assertThat(entity.getBody()).contains("Messages"); @@ -58,7 +58,7 @@ public class SampleGroovyTemplateApplicationTests { } @Test - public void testCreate() throws Exception { + public void testCreate() { MultiValueMap<String, String> map = new LinkedMultiValueMap<>(); map.set("text", "FOO text"); map.set("summary", "FOO"); @@ -67,7 +67,7 @@ public class SampleGroovyTemplateApplicationTests { } @Test - public void testCss() throws Exception { + public void testCss() { ResponseEntity<String> entity = this.restTemplate .getForEntity("/css/bootstrap.min.css", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); diff --git a/spring-boot-samples/spring-boot-sample-web-jsp/src/test/java/sample/jsp/SampleWebJspApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-jsp/src/test/java/sample/jsp/SampleWebJspApplicationTests.java index b99a96bea5..5e4df33f13 100644 --- a/spring-boot-samples/spring-boot-sample-web-jsp/src/test/java/sample/jsp/SampleWebJspApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-jsp/src/test/java/sample/jsp/SampleWebJspApplicationTests.java @@ -42,7 +42,7 @@ public class SampleWebJspApplicationTests { private TestRestTemplate restTemplate; @Test - public void testJspWithEl() throws Exception { + public void testJspWithEl() { ResponseEntity<String> entity = this.restTemplate.getForEntity("/", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); assertThat(entity.getBody()).contains("/resources/text.txt"); diff --git a/spring-boot-samples/spring-boot-sample-web-method-security/src/test/java/sample/security/method/SampleMethodSecurityApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-method-security/src/test/java/sample/security/method/SampleMethodSecurityApplicationTests.java index be7cdc66fb..249780c0c8 100644 --- a/spring-boot-samples/spring-boot-sample-web-method-security/src/test/java/sample/security/method/SampleMethodSecurityApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-method-security/src/test/java/sample/security/method/SampleMethodSecurityApplicationTests.java @@ -57,7 +57,7 @@ public class SampleMethodSecurityApplicationTests { private TestRestTemplate restTemplate; @Test - public void testHome() throws Exception { + public void testHome() { HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.TEXT_HTML)); ResponseEntity<String> entity = this.restTemplate.exchange("/", HttpMethod.GET, @@ -67,7 +67,7 @@ public class SampleMethodSecurityApplicationTests { } @Test - public void testLogin() throws Exception { + public void testLogin() { HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.TEXT_HTML)); MultiValueMap<String, String> form = new LinkedMultiValueMap<>(); @@ -82,7 +82,7 @@ public class SampleMethodSecurityApplicationTests { } @Test - public void testDenied() throws Exception { + public void testDenied() { HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.TEXT_HTML)); MultiValueMap<String, String> form = new LinkedMultiValueMap<>(); @@ -102,7 +102,7 @@ public class SampleMethodSecurityApplicationTests { } @Test - public void testManagementProtected() throws Exception { + public void testManagementProtected() { HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON)); ResponseEntity<String> entity = this.restTemplate.exchange("/actuator/beans", @@ -111,7 +111,7 @@ public class SampleMethodSecurityApplicationTests { } @Test - public void testManagementAuthorizedAccess() throws Exception { + public void testManagementAuthorizedAccess() { BasicAuthorizationInterceptor basicAuthInterceptor = new BasicAuthorizationInterceptor( "admin", "admin"); this.restTemplate.getRestTemplate().getInterceptors().add(basicAuthInterceptor); diff --git a/spring-boot-samples/spring-boot-sample-web-mustache/src/test/java/sample/mustache/SampleWebMustacheApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-mustache/src/test/java/sample/mustache/SampleWebMustacheApplicationTests.java index 7158d966ac..86ac83243d 100644 --- a/spring-boot-samples/spring-boot-sample-web-mustache/src/test/java/sample/mustache/SampleWebMustacheApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-mustache/src/test/java/sample/mustache/SampleWebMustacheApplicationTests.java @@ -49,14 +49,14 @@ public class SampleWebMustacheApplicationTests { private TestRestTemplate restTemplate; @Test - public void testMustacheTemplate() throws Exception { + public void testMustacheTemplate() { ResponseEntity<String> entity = this.restTemplate.getForEntity("/", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); assertThat(entity.getBody()).contains("Hello, Andy"); } @Test - public void testMustacheErrorTemplate() throws Exception { + public void testMustacheErrorTemplate() { HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.TEXT_HTML)); HttpEntity<String> requestEntity = new HttpEntity<>(headers); @@ -68,7 +68,7 @@ public class SampleWebMustacheApplicationTests { } @Test - public void test503HtmlResource() throws Exception { + public void test503HtmlResource() { HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.TEXT_HTML)); HttpEntity<String> requestEntity = new HttpEntity<>(headers); @@ -79,7 +79,7 @@ public class SampleWebMustacheApplicationTests { } @Test - public void test5xxHtmlResource() throws Exception { + public void test5xxHtmlResource() { HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.TEXT_HTML)); HttpEntity<String> requestEntity = new HttpEntity<>(headers); @@ -90,7 +90,7 @@ public class SampleWebMustacheApplicationTests { } @Test - public void test507Template() throws Exception { + public void test507Template() { HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.TEXT_HTML)); HttpEntity<String> requestEntity = new HttpEntity<>(headers); diff --git a/spring-boot-samples/spring-boot-sample-web-secure-custom/src/test/java/sample/web/secure/custom/SampleWebSecureCustomApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-secure-custom/src/test/java/sample/web/secure/custom/SampleWebSecureCustomApplicationTests.java index 614a1550d6..b99abf428f 100644 --- a/spring-boot-samples/spring-boot-sample-web-secure-custom/src/test/java/sample/web/secure/custom/SampleWebSecureCustomApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-secure-custom/src/test/java/sample/web/secure/custom/SampleWebSecureCustomApplicationTests.java @@ -56,7 +56,7 @@ public class SampleWebSecureCustomApplicationTests { private int port; @Test - public void testHome() throws Exception { + public void testHome() { HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.TEXT_HTML)); ResponseEntity<String> entity = this.restTemplate.exchange("/", HttpMethod.GET, @@ -67,7 +67,7 @@ public class SampleWebSecureCustomApplicationTests { } @Test - public void testLoginPage() throws Exception { + public void testLoginPage() { HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.TEXT_HTML)); ResponseEntity<String> entity = this.restTemplate.exchange("/login", @@ -77,7 +77,7 @@ public class SampleWebSecureCustomApplicationTests { } @Test - public void testLogin() throws Exception { + public void testLogin() { HttpHeaders headers = getHeaders(); headers.setAccept(Arrays.asList(MediaType.TEXT_HTML)); headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); @@ -107,7 +107,7 @@ public class SampleWebSecureCustomApplicationTests { } @Test - public void testCss() throws Exception { + public void testCss() { ResponseEntity<String> entity = this.restTemplate .getForEntity("/css/bootstrap.min.css", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); diff --git a/spring-boot-samples/spring-boot-sample-web-secure-jdbc/src/test/java/sample/web/secure/jdbc/SampleWebSecureJdbcApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-secure-jdbc/src/test/java/sample/web/secure/jdbc/SampleWebSecureJdbcApplicationTests.java index ac0216598f..1b9680cd4e 100644 --- a/spring-boot-samples/spring-boot-sample-web-secure-jdbc/src/test/java/sample/web/secure/jdbc/SampleWebSecureJdbcApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-secure-jdbc/src/test/java/sample/web/secure/jdbc/SampleWebSecureJdbcApplicationTests.java @@ -56,7 +56,7 @@ public class SampleWebSecureJdbcApplicationTests { private int port; @Test - public void testHome() throws Exception { + public void testHome() { HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.TEXT_HTML)); ResponseEntity<String> entity = this.restTemplate.exchange("/", HttpMethod.GET, @@ -67,7 +67,7 @@ public class SampleWebSecureJdbcApplicationTests { } @Test - public void testLoginPage() throws Exception { + public void testLoginPage() { HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.TEXT_HTML)); ResponseEntity<String> entity = this.restTemplate.exchange("/login", @@ -77,7 +77,7 @@ public class SampleWebSecureJdbcApplicationTests { } @Test - public void testLogin() throws Exception { + public void testLogin() { HttpHeaders headers = getHeaders(); headers.setAccept(Arrays.asList(MediaType.TEXT_HTML)); headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); @@ -107,7 +107,7 @@ public class SampleWebSecureJdbcApplicationTests { } @Test - public void testCss() throws Exception { + public void testCss() { ResponseEntity<String> entity = this.restTemplate .getForEntity("/css/bootstrap.min.css", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); diff --git a/spring-boot-samples/spring-boot-sample-web-secure/src/test/java/sample/web/secure/SampleSecureApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-secure/src/test/java/sample/web/secure/SampleSecureApplicationTests.java index ac9df77260..db6eb2efef 100644 --- a/spring-boot-samples/spring-boot-sample-web-secure/src/test/java/sample/web/secure/SampleSecureApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-secure/src/test/java/sample/web/secure/SampleSecureApplicationTests.java @@ -56,7 +56,7 @@ public class SampleSecureApplicationTests { private int port; @Test - public void testHome() throws Exception { + public void testHome() { HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.TEXT_HTML)); ResponseEntity<String> entity = this.restTemplate.exchange("/", HttpMethod.GET, @@ -67,7 +67,7 @@ public class SampleSecureApplicationTests { } @Test - public void testLoginPage() throws Exception { + public void testLoginPage() { HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.TEXT_HTML)); ResponseEntity<String> entity = this.restTemplate.exchange("/login", @@ -77,7 +77,7 @@ public class SampleSecureApplicationTests { } @Test - public void testLogin() throws Exception { + public void testLogin() { HttpHeaders headers = getHeaders(); headers.setAccept(Arrays.asList(MediaType.TEXT_HTML)); headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); @@ -107,7 +107,7 @@ public class SampleSecureApplicationTests { } @Test - public void testCss() throws Exception { + public void testCss() { ResponseEntity<String> entity = this.restTemplate .getForEntity("/css/bootstrap.min.css", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); diff --git a/spring-boot-samples/spring-boot-sample-web-static/src/test/java/sample/web/staticcontent/SampleWebStaticApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-static/src/test/java/sample/web/staticcontent/SampleWebStaticApplicationTests.java index 6da4aeb388..cc6469b92a 100644 --- a/spring-boot-samples/spring-boot-sample-web-static/src/test/java/sample/web/staticcontent/SampleWebStaticApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-static/src/test/java/sample/web/staticcontent/SampleWebStaticApplicationTests.java @@ -43,14 +43,14 @@ public class SampleWebStaticApplicationTests { private TestRestTemplate restTemplate; @Test - public void testHome() throws Exception { + public void testHome() { ResponseEntity<String> entity = this.restTemplate.getForEntity("/", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); assertThat(entity.getBody()).contains("<title>Static"); } @Test - public void testCss() throws Exception { + public void testCss() { ResponseEntity<String> entity = this.restTemplate.getForEntity( "/webjars/bootstrap/3.0.3/css/bootstrap.min.css", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); diff --git a/spring-boot-samples/spring-boot-sample-web-ui/src/test/java/sample/web/ui/SampleWebUiApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-ui/src/test/java/sample/web/ui/SampleWebUiApplicationTests.java index 6c06a1e6c2..6e36783f4b 100644 --- a/spring-boot-samples/spring-boot-sample-web-ui/src/test/java/sample/web/ui/SampleWebUiApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-ui/src/test/java/sample/web/ui/SampleWebUiApplicationTests.java @@ -50,7 +50,7 @@ public class SampleWebUiApplicationTests { private int port; @Test - public void testHome() throws Exception { + public void testHome() { ResponseEntity<String> entity = this.restTemplate.getForEntity("/", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); assertThat(entity.getBody()).contains("<title>Messages"); @@ -58,7 +58,7 @@ public class SampleWebUiApplicationTests { } @Test - public void testCreate() throws Exception { + public void testCreate() { MultiValueMap<String, String> map = new LinkedMultiValueMap<>(); map.set("text", "FOO text"); map.set("summary", "FOO"); @@ -67,7 +67,7 @@ public class SampleWebUiApplicationTests { } @Test - public void testCss() throws Exception { + public void testCss() { ResponseEntity<String> entity = this.restTemplate.getForEntity( "http://localhost:" + this.port + "/css/bootstrap.min.css", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/test/java/samples/websocket/jetty/SampleWebSocketsApplicationTests.java b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/test/java/samples/websocket/jetty/SampleWebSocketsApplicationTests.java index 4402e9f015..f52937d929 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/test/java/samples/websocket/jetty/SampleWebSocketsApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/test/java/samples/websocket/jetty/SampleWebSocketsApplicationTests.java @@ -54,7 +54,7 @@ public class SampleWebSocketsApplicationTests { private int port = 1234; @Test - public void echoEndpoint() throws Exception { + public void echoEndpoint() { ConfigurableApplicationContext context = new SpringApplicationBuilder( ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) .properties("websocket.uri:ws://localhost:" + this.port @@ -70,7 +70,7 @@ public class SampleWebSocketsApplicationTests { } @Test - public void reverseEndpoint() throws Exception { + public void reverseEndpoint() { ConfigurableApplicationContext context = new SpringApplicationBuilder( ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) .properties( diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/test/java/samples/websocket/jetty/echo/CustomContainerWebSocketsApplicationTests.java b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/test/java/samples/websocket/jetty/echo/CustomContainerWebSocketsApplicationTests.java index 5e475b7dbc..d7b65e4304 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/test/java/samples/websocket/jetty/echo/CustomContainerWebSocketsApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/test/java/samples/websocket/jetty/echo/CustomContainerWebSocketsApplicationTests.java @@ -60,7 +60,7 @@ public class CustomContainerWebSocketsApplicationTests { private int port; @Test - public void echoEndpoint() throws Exception { + public void echoEndpoint() { ConfigurableApplicationContext context = new SpringApplicationBuilder( ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) .properties("websocket.uri:ws://localhost:" + this.port @@ -76,7 +76,7 @@ public class CustomContainerWebSocketsApplicationTests { } @Test - public void reverseEndpoint() throws Exception { + public void reverseEndpoint() { ConfigurableApplicationContext context = new SpringApplicationBuilder( ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) .properties("websocket.uri:ws://localhost:" + this.port diff --git a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/test/java/samples/websocket/tomcat/SampleWebSocketsApplicationTests.java b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/test/java/samples/websocket/tomcat/SampleWebSocketsApplicationTests.java index 7b8ca7cd04..86e6d8bf75 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/test/java/samples/websocket/tomcat/SampleWebSocketsApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/test/java/samples/websocket/tomcat/SampleWebSocketsApplicationTests.java @@ -54,7 +54,7 @@ public class SampleWebSocketsApplicationTests { private int port = 1234; @Test - public void echoEndpoint() throws Exception { + public void echoEndpoint() { ConfigurableApplicationContext context = new SpringApplicationBuilder( ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) .properties("websocket.uri:ws://localhost:" + this.port @@ -70,7 +70,7 @@ public class SampleWebSocketsApplicationTests { } @Test - public void reverseEndpoint() throws Exception { + public void reverseEndpoint() { ConfigurableApplicationContext context = new SpringApplicationBuilder( ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) .properties( diff --git a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/test/java/samples/websocket/tomcat/echo/CustomContainerWebSocketsApplicationTests.java b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/test/java/samples/websocket/tomcat/echo/CustomContainerWebSocketsApplicationTests.java index 279f3c14a8..ca0e454699 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/test/java/samples/websocket/tomcat/echo/CustomContainerWebSocketsApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/test/java/samples/websocket/tomcat/echo/CustomContainerWebSocketsApplicationTests.java @@ -60,7 +60,7 @@ public class CustomContainerWebSocketsApplicationTests { private int port; @Test - public void echoEndpoint() throws Exception { + public void echoEndpoint() { ConfigurableApplicationContext context = new SpringApplicationBuilder( ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) .properties("websocket.uri:ws://localhost:" + this.port @@ -76,7 +76,7 @@ public class CustomContainerWebSocketsApplicationTests { } @Test - public void reverseEndpoint() throws Exception { + public void reverseEndpoint() { ConfigurableApplicationContext context = new SpringApplicationBuilder( ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) .properties("websocket.uri:ws://localhost:" + this.port diff --git a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/test/java/samples/websocket/undertow/SampleWebSocketsApplicationTests.java b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/test/java/samples/websocket/undertow/SampleWebSocketsApplicationTests.java index 07dc640107..2c85806ce6 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/test/java/samples/websocket/undertow/SampleWebSocketsApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/test/java/samples/websocket/undertow/SampleWebSocketsApplicationTests.java @@ -54,7 +54,7 @@ public class SampleWebSocketsApplicationTests { private int port = 1234; @Test - public void echoEndpoint() throws Exception { + public void echoEndpoint() { ConfigurableApplicationContext context = new SpringApplicationBuilder( ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) .properties("websocket.uri:ws://localhost:" + this.port @@ -70,7 +70,7 @@ public class SampleWebSocketsApplicationTests { } @Test - public void reverseEndpoint() throws Exception { + public void reverseEndpoint() { ConfigurableApplicationContext context = new SpringApplicationBuilder( ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) .properties( diff --git a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/test/java/samples/websocket/undertow/echo/CustomContainerWebSocketsApplicationTests.java b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/test/java/samples/websocket/undertow/echo/CustomContainerWebSocketsApplicationTests.java index f358f7a30f..4f7254259f 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/test/java/samples/websocket/undertow/echo/CustomContainerWebSocketsApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/test/java/samples/websocket/undertow/echo/CustomContainerWebSocketsApplicationTests.java @@ -60,7 +60,7 @@ public class CustomContainerWebSocketsApplicationTests { private int port; @Test - public void echoEndpoint() throws Exception { + public void echoEndpoint() { ConfigurableApplicationContext context = new SpringApplicationBuilder( ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) .properties("websocket.uri:ws://localhost:" + this.port @@ -76,7 +76,7 @@ public class CustomContainerWebSocketsApplicationTests { } @Test - public void reverseEndpoint() throws Exception { + public void reverseEndpoint() { ConfigurableApplicationContext context = new SpringApplicationBuilder( ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) .properties("websocket.uri:ws://localhost:" + this.port