Skip to content

Commit 23218ad

Browse files
committed
Polish
1 parent 97c91ee commit 23218ad

File tree

615 files changed

+2832
-3224
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

615 files changed

+2832
-3224
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/amqp/RabbitHealthIndicatorAutoConfigurationTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ public class RabbitHealthIndicatorAutoConfigurationTests {
4040
HealthIndicatorAutoConfiguration.class));
4141

4242
@Test
43-
public void runShouldCreateIndicator() throws Exception {
43+
public void runShouldCreateIndicator() {
4444
this.contextRunner.run((context) -> assertThat(context)
4545
.hasSingleBean(RabbitHealthIndicator.class)
4646
.doesNotHaveBean(ApplicationHealthIndicator.class));
4747
}
4848

4949
@Test
50-
public void runWhenDisabledShouldNotCreateIndicator() throws Exception {
50+
public void runWhenDisabledShouldNotCreateIndicator() {
5151
this.contextRunner.withPropertyValues("management.health.rabbit.enabled:false")
5252
.run((context) -> assertThat(context)
5353
.doesNotHaveBean(RabbitHealthIndicator.class)

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/audit/AuditAutoConfigurationTests.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -46,39 +46,39 @@ public class AuditAutoConfigurationTests {
4646
private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
4747

4848
@Test
49-
public void defaultConfiguration() throws Exception {
49+
public void defaultConfiguration() {
5050
registerAndRefresh(AuditAutoConfiguration.class);
5151
assertThat(this.context.getBean(AuditEventRepository.class)).isNotNull();
5252
assertThat(this.context.getBean(AuthenticationAuditListener.class)).isNotNull();
5353
assertThat(this.context.getBean(AuthorizationAuditListener.class)).isNotNull();
5454
}
5555

5656
@Test
57-
public void ownAuditEventRepository() throws Exception {
57+
public void ownAuditEventRepository() {
5858
registerAndRefresh(CustomAuditEventRepositoryConfiguration.class,
5959
AuditAutoConfiguration.class);
6060
assertThat(this.context.getBean(AuditEventRepository.class))
6161
.isInstanceOf(TestAuditEventRepository.class);
6262
}
6363

6464
@Test
65-
public void ownAuthenticationAuditListener() throws Exception {
65+
public void ownAuthenticationAuditListener() {
6666
registerAndRefresh(CustomAuthenticationAuditListenerConfiguration.class,
6767
AuditAutoConfiguration.class);
6868
assertThat(this.context.getBean(AbstractAuthenticationAuditListener.class))
6969
.isInstanceOf(TestAuthenticationAuditListener.class);
7070
}
7171

7272
@Test
73-
public void ownAuthorizationAuditListener() throws Exception {
73+
public void ownAuthorizationAuditListener() {
7474
registerAndRefresh(CustomAuthorizationAuditListenerConfiguration.class,
7575
AuditAutoConfiguration.class);
7676
assertThat(this.context.getBean(AbstractAuthorizationAuditListener.class))
7777
.isInstanceOf(TestAuthorizationAuditListener.class);
7878
}
7979

8080
@Test
81-
public void ownAuditListener() throws Exception {
81+
public void ownAuditListener() {
8282
registerAndRefresh(CustomAuditListenerConfiguration.class,
8383
AuditAutoConfiguration.class);
8484
assertThat(this.context.getBean(AbstractAuditListener.class))

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/audit/AuditEventsEndpointAutoConfigurationTests.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ public void runShouldHaveWebExtensionBean() {
5858
}
5959

6060
@Test
61-
public void runWhenEnabledPropertyIsFalseShouldNotHaveEndpointOrExtensionBean()
62-
throws Exception {
61+
public void runWhenEnabledPropertyIsFalseShouldNotHaveEndpointOrExtensionBean() {
6362
this.contextRunner
6463
.withPropertyValues("management.endpoint.auditevents.enabled:false")
6564
.run((context) -> assertThat(context)

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/beans/BeansEndpointAutoConfigurationTests.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ public void runShouldHaveEndpointBean() {
4242
}
4343

4444
@Test
45-
public void runWhenEnabledPropertyIsFalseShouldNotHaveEndpointBean()
46-
throws Exception {
45+
public void runWhenEnabledPropertyIsFalseShouldNotHaveEndpointBean() {
4746
this.contextRunner.withPropertyValues("management.endpoint.beans.enabled:false")
4847
.run((context) -> assertThat(context)
4948
.doesNotHaveBean(BeansEndpoint.class));

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cassandra/CassandraHealthIndicatorAutoConfigurationTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ public class CassandraHealthIndicatorAutoConfigurationTests {
4444
HealthIndicatorAutoConfiguration.class));
4545

4646
@Test
47-
public void runShouldCreateIndicator() throws Exception {
47+
public void runShouldCreateIndicator() {
4848
this.contextRunner.run((context) -> assertThat(context)
4949
.hasSingleBean(CassandraHealthIndicator.class)
5050
.doesNotHaveBean(ApplicationHealthIndicator.class));
5151
}
5252

5353
@Test
54-
public void runWhenDisabledShouldNotCreateIndicator() throws Exception {
54+
public void runWhenDisabledShouldNotCreateIndicator() {
5555
this.contextRunner.withPropertyValues("management.health.cassandra.enabled:false")
5656
.run((context) -> assertThat(context)
5757
.doesNotHaveBean(CassandraHealthIndicator.class)

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/AccessLevelTests.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,25 +28,25 @@
2828
public class AccessLevelTests {
2929

3030
@Test
31-
public void accessToHealthEndpointShouldNotBeRestricted() throws Exception {
31+
public void accessToHealthEndpointShouldNotBeRestricted() {
3232
assertThat(AccessLevel.RESTRICTED.isAccessAllowed("health")).isTrue();
3333
assertThat(AccessLevel.FULL.isAccessAllowed("health")).isTrue();
3434
}
3535

3636
@Test
37-
public void accessToInfoEndpointShouldNotBeRestricted() throws Exception {
37+
public void accessToInfoEndpointShouldNotBeRestricted() {
3838
assertThat(AccessLevel.RESTRICTED.isAccessAllowed("info")).isTrue();
3939
assertThat(AccessLevel.FULL.isAccessAllowed("info")).isTrue();
4040
}
4141

4242
@Test
43-
public void accessToDiscoveryEndpointShouldNotBeRestricted() throws Exception {
43+
public void accessToDiscoveryEndpointShouldNotBeRestricted() {
4444
assertThat(AccessLevel.RESTRICTED.isAccessAllowed("")).isTrue();
4545
assertThat(AccessLevel.FULL.isAccessAllowed("")).isTrue();
4646
}
4747

4848
@Test
49-
public void accessToAnyOtherEndpointShouldBeRestricted() throws Exception {
49+
public void accessToAnyOtherEndpointShouldBeRestricted() {
5050
assertThat(AccessLevel.RESTRICTED.isAccessAllowed("env")).isFalse();
5151
assertThat(AccessLevel.FULL.isAccessAllowed("")).isTrue();
5252
}

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/CloudFoundryAuthorizationExceptionTests.java

+9-10
Original file line numberDiff line numberDiff line change
@@ -31,56 +31,55 @@
3131
public class CloudFoundryAuthorizationExceptionTests {
3232

3333
@Test
34-
public void statusCodeForInvalidTokenReasonShouldBe401() throws Exception {
34+
public void statusCodeForInvalidTokenReasonShouldBe401() {
3535
assertThat(createException(Reason.INVALID_TOKEN).getStatusCode())
3636
.isEqualTo(HttpStatus.UNAUTHORIZED);
3737
}
3838

3939
@Test
40-
public void statusCodeForInvalidIssuerReasonShouldBe401() throws Exception {
40+
public void statusCodeForInvalidIssuerReasonShouldBe401() {
4141
assertThat(createException(Reason.INVALID_ISSUER).getStatusCode())
4242
.isEqualTo(HttpStatus.UNAUTHORIZED);
4343
}
4444

4545
@Test
46-
public void statusCodeForInvalidAudienceReasonShouldBe401() throws Exception {
46+
public void statusCodeForInvalidAudienceReasonShouldBe401() {
4747
assertThat(createException(Reason.INVALID_AUDIENCE).getStatusCode())
4848
.isEqualTo(HttpStatus.UNAUTHORIZED);
4949
}
5050

5151
@Test
52-
public void statusCodeForInvalidSignatureReasonShouldBe401() throws Exception {
52+
public void statusCodeForInvalidSignatureReasonShouldBe401() {
5353
assertThat(createException(Reason.INVALID_SIGNATURE).getStatusCode())
5454
.isEqualTo(HttpStatus.UNAUTHORIZED);
5555
}
5656

5757
@Test
58-
public void statusCodeForMissingAuthorizationReasonShouldBe401() throws Exception {
58+
public void statusCodeForMissingAuthorizationReasonShouldBe401() {
5959
assertThat(createException(Reason.MISSING_AUTHORIZATION).getStatusCode())
6060
.isEqualTo(HttpStatus.UNAUTHORIZED);
6161
}
6262

6363
@Test
64-
public void statusCodeForUnsupportedSignatureAlgorithmReasonShouldBe401()
65-
throws Exception {
64+
public void statusCodeForUnsupportedSignatureAlgorithmReasonShouldBe401() {
6665
assertThat(createException(Reason.UNSUPPORTED_TOKEN_SIGNING_ALGORITHM)
6766
.getStatusCode()).isEqualTo(HttpStatus.UNAUTHORIZED);
6867
}
6968

7069
@Test
71-
public void statusCodeForTokenExpiredReasonShouldBe401() throws Exception {
70+
public void statusCodeForTokenExpiredReasonShouldBe401() {
7271
assertThat(createException(Reason.TOKEN_EXPIRED).getStatusCode())
7372
.isEqualTo(HttpStatus.UNAUTHORIZED);
7473
}
7574

7675
@Test
77-
public void statusCodeForAccessDeniedReasonShouldBe403() throws Exception {
76+
public void statusCodeForAccessDeniedReasonShouldBe403() {
7877
assertThat(createException(Reason.ACCESS_DENIED).getStatusCode())
7978
.isEqualTo(HttpStatus.FORBIDDEN);
8079
}
8180

8281
@Test
83-
public void statusCodeForServiceUnavailableReasonShouldBe503() throws Exception {
82+
public void statusCodeForServiceUnavailableReasonShouldBe503() {
8483
assertThat(createException(Reason.SERVICE_UNAVAILABLE).getStatusCode())
8584
.isEqualTo(HttpStatus.SERVICE_UNAVAILABLE);
8685
}

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/CloudFoundryEndpointFilterTests.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,19 @@ public class CloudFoundryEndpointFilterTests {
4343
private CloudFoundryEndpointFilter filter;
4444

4545
@Before
46-
public void setUp() throws Exception {
46+
public void setUp() {
4747
this.filter = new CloudFoundryEndpointFilter();
4848
}
4949

5050
@Test
51-
public void matchIfDiscovererCloudFoundryShouldReturnFalse() throws Exception {
51+
public void matchIfDiscovererCloudFoundryShouldReturnFalse() {
5252
CloudFoundryWebAnnotationEndpointDiscoverer discoverer = Mockito
5353
.mock(CloudFoundryWebAnnotationEndpointDiscoverer.class);
5454
assertThat(this.filter.match(null, discoverer)).isTrue();
5555
}
5656

5757
@Test
58-
public void matchIfDiscovererNotCloudFoundryShouldReturnFalse() throws Exception {
58+
public void matchIfDiscovererNotCloudFoundryShouldReturnFalse() {
5959
WebAnnotationEndpointDiscoverer discoverer = Mockito
6060
.mock(WebAnnotationEndpointDiscoverer.class);
6161
assertThat(this.filter.match(null, discoverer)).isFalse();

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/CloudFoundryWebAnnotationEndpointDiscovererTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
public class CloudFoundryWebAnnotationEndpointDiscovererTests {
4949

5050
@Test
51-
public void discovererShouldAddSuppliedExtensionForHealthEndpoint() throws Exception {
51+
public void discovererShouldAddSuppliedExtensionForHealthEndpoint() {
5252
load(TestConfiguration.class, (endpointDiscoverer) -> {
5353
Collection<EndpointInfo<WebOperation>> endpoints = endpointDiscoverer
5454
.discoverEndpoints();

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/TokenTests.java

+9-10
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ public class TokenTests {
3636
public ExpectedException thrown = ExpectedException.none();
3737

3838
@Test
39-
public void invalidJwtShouldThrowException() throws Exception {
39+
public void invalidJwtShouldThrowException() {
4040
this.thrown
4141
.expect(AuthorizationExceptionMatcher.withReason(Reason.INVALID_TOKEN));
4242
new Token("invalid-token");
4343
}
4444

4545
@Test
46-
public void invalidJwtClaimsShouldThrowException() throws Exception {
46+
public void invalidJwtClaimsShouldThrowException() {
4747
String header = "{\"alg\": \"RS256\", \"kid\": \"key-id\", \"typ\": \"JWT\"}";
4848
String claims = "invalid-claims";
4949
this.thrown
@@ -53,7 +53,7 @@ public void invalidJwtClaimsShouldThrowException() throws Exception {
5353
}
5454

5555
@Test
56-
public void invalidJwtHeaderShouldThrowException() throws Exception {
56+
public void invalidJwtHeaderShouldThrowException() {
5757
String header = "invalid-header";
5858
String claims = "{\"exp\": 2147483647, \"iss\": \"http://localhost:8080/uaa/oauth/token\"}";
5959
this.thrown
@@ -63,7 +63,7 @@ public void invalidJwtHeaderShouldThrowException() throws Exception {
6363
}
6464

6565
@Test
66-
public void emptyJwtSignatureShouldThrowException() throws Exception {
66+
public void emptyJwtSignatureShouldThrowException() {
6767
String token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ0b3B0YWwu"
6868
+ "Y29tIiwiZXhwIjoxNDI2NDIwODAwLCJhd2Vzb21lIjp0cnVlfQ.";
6969
this.thrown
@@ -72,7 +72,7 @@ public void emptyJwtSignatureShouldThrowException() throws Exception {
7272
}
7373

7474
@Test
75-
public void validJwt() throws Exception {
75+
public void validJwt() {
7676
String header = "{\"alg\": \"RS256\", \"kid\": \"key-id\", \"typ\": \"JWT\"}";
7777
String claims = "{\"exp\": 2147483647, \"iss\": \"http://localhost:8080/uaa/oauth/token\"}";
7878
String content = Base64Utils.encodeToString(header.getBytes()) + "."
@@ -89,8 +89,7 @@ public void validJwt() throws Exception {
8989
}
9090

9191
@Test
92-
public void getSignatureAlgorithmWhenAlgIsNullShouldThrowException()
93-
throws Exception {
92+
public void getSignatureAlgorithmWhenAlgIsNullShouldThrowException() {
9493
String header = "{\"kid\": \"key-id\", \"typ\": \"JWT\"}";
9594
String claims = "{\"exp\": 2147483647, \"iss\": \"http://localhost:8080/uaa/oauth/token\"}";
9695
Token token = createToken(header, claims);
@@ -100,7 +99,7 @@ public void getSignatureAlgorithmWhenAlgIsNullShouldThrowException()
10099
}
101100

102101
@Test
103-
public void getIssuerWhenIssIsNullShouldThrowException() throws Exception {
102+
public void getIssuerWhenIssIsNullShouldThrowException() {
104103
String header = "{\"alg\": \"RS256\", \"kid\": \"key-id\", \"typ\": \"JWT\"}";
105104
String claims = "{\"exp\": 2147483647}";
106105
Token token = createToken(header, claims);
@@ -110,7 +109,7 @@ public void getIssuerWhenIssIsNullShouldThrowException() throws Exception {
110109
}
111110

112111
@Test
113-
public void getKidWhenKidIsNullShouldThrowException() throws Exception {
112+
public void getKidWhenKidIsNullShouldThrowException() {
114113
String header = "{\"alg\": \"RS256\", \"typ\": \"JWT\"}";
115114
String claims = "{\"exp\": 2147483647}";
116115
Token token = createToken(header, claims);
@@ -120,7 +119,7 @@ public void getKidWhenKidIsNullShouldThrowException() throws Exception {
120119
}
121120

122121
@Test
123-
public void getExpiryWhenExpIsNullShouldThrowException() throws Exception {
122+
public void getExpiryWhenExpIsNullShouldThrowException() {
124123
String header = "{\"alg\": \"RS256\", \"kid\": \"key-id\", \"typ\": \"JWT\"}";
125124
String claims = "{\"iss\": \"http://localhost:8080/uaa/oauth/token\"" + "}";
126125
Token token = createToken(header, claims);

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/CloudFoundryWebFluxEndpointIntegrationTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public class CloudFoundryWebFluxEndpointIntegrationTests {
7878
ReactiveCloudFoundrySecurityService.class);
7979

8080
@Test
81-
public void operationWithSecurityInterceptorForbidden() throws Exception {
81+
public void operationWithSecurityInterceptorForbidden() {
8282
given(tokenValidator.validate(any())).willReturn(Mono.empty());
8383
given(securityService.getAccessLevel(any(), eq("app-id")))
8484
.willReturn(Mono.just(AccessLevel.RESTRICTED));
@@ -90,7 +90,7 @@ public void operationWithSecurityInterceptorForbidden() throws Exception {
9090
}
9191

9292
@Test
93-
public void operationWithSecurityInterceptorSuccess() throws Exception {
93+
public void operationWithSecurityInterceptorSuccess() {
9494
given(tokenValidator.validate(any())).willReturn(Mono.empty());
9595
given(securityService.getAccessLevel(any(), eq("app-id")))
9696
.willReturn(Mono.just(AccessLevel.FULL));

0 commit comments

Comments
 (0)