Skip to content

Commit eaa372f

Browse files
committed
additional test cases because original test name was NeitherExpiryNorNotBeforeIsSpecified
Signed-off-by: Ferenc Kemeny <[email protected]>
1 parent 9df3a57 commit eaa372f

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/JwtTimestampValidatorTests.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,23 @@ public void validateWhenConfiguredWithFixedClockThenValidatesUsingFixedTime() {
129129

130130
@Test
131131
public void validateWhenNeitherExpiryNorNotBeforeIsSpecifiedThenReturnsSuccessfulResult() {
132+
Jwt jwt = TestJwts.jwt().claims((c) -> {
133+
c.remove(JwtClaimNames.EXP);
134+
c.remove(JwtClaimNames.NBF);
135+
}).build();
136+
JwtTimestampValidator jwtValidator = new JwtTimestampValidator();
137+
assertThat(jwtValidator.validate(jwt).hasErrors()).isFalse();
138+
}
139+
140+
@Test
141+
public void validateWhenExpiryIsSpecifiedThenReturnsSuccessfulResult() {
142+
Jwt jwt = TestJwts.jwt().claims((c) -> c.remove(JwtClaimNames.EXP)).build();
143+
JwtTimestampValidator jwtValidator = new JwtTimestampValidator();
144+
assertThat(jwtValidator.validate(jwt).hasErrors()).isFalse();
145+
}
146+
147+
@Test
148+
public void validateWhenNotBeforeIsSpecifiedThenReturnsSuccessfulResult() {
132149
Jwt jwt = TestJwts.jwt().claims((c) -> c.remove(JwtClaimNames.EXP)).build();
133150
JwtTimestampValidator jwtValidator = new JwtTimestampValidator();
134151
assertThat(jwtValidator.validate(jwt).hasErrors()).isFalse();

0 commit comments

Comments
 (0)