From 56888911b037229fddcd7e868f64af3bad612630 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Barto=C5=A1?= Date: Wed, 28 Jul 2021 14:03:18 +0200 Subject: [PATCH] KEYCLOAK-18691 CIBATest.testTokenRequestAfterIntervalButNotYetAuthenticated wrong expiration --- .../base/src/test/java/org/keycloak/testsuite/Assert.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/Assert.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/Assert.java index 5d428fe9cf..28d7dab168 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/Assert.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/Assert.java @@ -48,6 +48,8 @@ import static org.hamcrest.Matchers.lessThanOrEqualTo; */ public class Assert extends org.junit.Assert { + public static final Long DEFAULT_NUMBER_DEVIATION = 20L; + public static void assertNames(Set actual, String... expected) { Arrays.sort(expected); String[] actualNames = names(new LinkedList(actual)); @@ -150,7 +152,11 @@ public class Assert extends org.junit.Assert { } public static void assertExpiration(long actual, long expected) { - MatcherAssert.assertThat(actual, allOf(greaterThanOrEqualTo(expected - 50), lessThanOrEqualTo(expected))); + assertExpiration(actual, expected, DEFAULT_NUMBER_DEVIATION); + } + + public static void assertExpiration(long actual, long expected, long deviation) { + MatcherAssert.assertThat(actual, allOf(greaterThanOrEqualTo(expected - deviation), lessThanOrEqualTo(expected + deviation))); } public static void assertRoleAttributes(Map> expected, Map> actual) {