DefaultCryptoSdJwsTest.shouldValidateAgeSinceIssued_IfJwtIsTooOld() sometimes fails in CI

closes #44971

Signed-off-by: mposolda <mposolda@gmail.com>
This commit is contained in:
mposolda 2025-12-17 15:16:37 +01:00 committed by Marek Posolda
parent 92314bccc6
commit 08e96435c8

View File

@ -35,6 +35,7 @@ import org.junit.Test;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
public abstract class SdJwsTest { public abstract class SdJwsTest {
@ -195,12 +196,10 @@ public abstract class SdJwsTest {
VerificationException exception = assertThrows(VerificationException.class, () -> { VerificationException exception = assertThrows(VerificationException.class, () -> {
new ClaimVerifier.IatLifetimeCheck(0, maxLifetime).test(sdJws.getPayload()); new ClaimVerifier.IatLifetimeCheck(0, maxLifetime).test(sdJws.getPayload());
}); });
assertEquals(String.format("Token has expired by iat: now: '%s', expired at: '%s', "
+ "iat: '%s', maxLifetime: '%s'", assertTrue(String.format("Expected message '%s' does not match regex", exception.getMessage()),
now, exception.getMessage().matches("Token has expired by iat: now: '\\d+', expired at:"
iat + maxLifetime, + " '\\d+', iat: '\\d+', maxLifetime: '180'"));
iat,
maxLifetime), exception.getMessage());
} }
private JwsToken exampleSdJws(long iat) { private JwsToken exampleSdJws(long iat) {