1010import static com .github .tomakehurst .wiremock .client .WireMock .postRequestedFor ;
1111import static com .github .tomakehurst .wiremock .client .WireMock .urlEqualTo ;
1212import static com .github .tomakehurst .wiremock .client .WireMock .urlPathMatching ;
13+ import static org .assertj .core .api .Assertions .assertThat ;
1314import static org .awaitility .Awaitility .given ;
1415import static org .junit .jupiter .api .Assertions .assertEquals ;
1516import static org .junit .jupiter .api .Assertions .assertNotNull ;
@@ -381,7 +382,9 @@ public void testCodeFlowUserInfoCachedInIdToken() throws Exception {
381382 final long nowInSecs = nowInSecs ();
382383 final long sessionCookieLifespan = stateCookieDate .toInstant ().getEpochSecond () - nowInSecs ;
383384 // 5 mins is default
384- assertTrue (sessionCookieLifespan >= 299 && sessionCookieLifespan <= 304 );
385+ assertThat (sessionCookieLifespan ).isGreaterThanOrEqualTo (299 );
386+
387+ assertThat (sessionCookieLifespan ).isLessThanOrEqualTo (304 );
385388
386389 TextPage textPage = form .getInputByValue ("login" ).click ();
387390
@@ -399,11 +402,11 @@ public void testCodeFlowUserInfoCachedInIdToken() throws Exception {
399402
400403 Cookie sessionCookie = getSessionCookie (webClient , "code-flow-user-info-github-cached-in-idtoken" );
401404 Date date = sessionCookie .getExpires ();
402- assertTrue (date .toInstant ().getEpochSecond () - issuedAt >= 299 + 300 );
405+ assertThat (date .toInstant ().getEpochSecond () - issuedAt ). isGreaterThanOrEqualTo ( 299 + 300 );
403406 // This test enables the token refresh, in this case the cookie age is extended by additional 5 mins
404407 // to minimize the risk of the browser losing immediately after it has expired, for this cookie
405408 // be returned to Quarkus, analyzed and refreshed
406- assertTrue (date .toInstant ().getEpochSecond () - issuedAt <= 299 + 300 + 3 );
409+ assertThat (date .toInstant ().getEpochSecond () - issuedAt ). isLessThanOrEqualTo ( 299 + 300 + 3 );
407410
408411 assertEquals (299 , decryptAccessTokenExpiryTime (webClient , "code-flow-user-info-github-cached-in-idtoken" ));
409412
@@ -427,8 +430,8 @@ public void testCodeFlowUserInfoCachedInIdToken() throws Exception {
427430
428431 sessionCookie = getSessionCookie (webClient , "code-flow-user-info-github-cached-in-idtoken" );
429432 date = sessionCookie .getExpires ();
430- assertTrue (date .toInstant ().getEpochSecond () - issuedAt >= 299 + 300 );
431- assertTrue (date .toInstant ().getEpochSecond () - issuedAt <= 299 + 300 + 3 );
433+ assertThat (date .toInstant ().getEpochSecond () - issuedAt ). isGreaterThanOrEqualTo ( 299 + 300 );
434+ assertThat (date .toInstant ().getEpochSecond () - issuedAt ). isLessThanOrEqualTo ( 299 + 300 + 3 );
432435
433436 assertEquals (305 , decryptAccessTokenExpiryTime (webClient , "code-flow-user-info-github-cached-in-idtoken" ));
434437
0 commit comments