From d62d06e3076b0036ed27f0a469cbb6565e08879b Mon Sep 17 00:00:00 2001 From: Burke Davison <40617934+burkedavison@users.noreply.github.com> Date: Thu, 29 Aug 2024 11:54:31 -0400 Subject: [PATCH] chore: use assertEquals to improve test error message (#1470) * chore: use assertEquals to improve test error message * chore: lint --------- Co-authored-by: Min Zhu Co-authored-by: Lawrence Qiu --- .../com/google/auth/oauth2/ExecutableResponseTest.java | 8 ++++---- .../com/google/auth/oauth2/PluggableAuthHandlerTest.java | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/oauth2_http/javatests/com/google/auth/oauth2/ExecutableResponseTest.java b/oauth2_http/javatests/com/google/auth/oauth2/ExecutableResponseTest.java index 6020ad51e..e6991776d 100644 --- a/oauth2_http/javatests/com/google/auth/oauth2/ExecutableResponseTest.java +++ b/oauth2_http/javatests/com/google/auth/oauth2/ExecutableResponseTest.java @@ -63,8 +63,8 @@ public void constructor_successOidcResponse() throws IOException { assertEquals(EXECUTABLE_SUPPORTED_MAX_VERSION, response.getVersion()); assertEquals(TOKEN_TYPE_OIDC, response.getTokenType()); assertEquals(ID_TOKEN, response.getSubjectToken()); - assertTrue( - Instant.now().getEpochSecond() + EXPIRATION_DURATION == response.getExpirationTime()); + assertEquals( + Instant.now().getEpochSecond() + EXPIRATION_DURATION, (long) response.getExpirationTime()); } @Test @@ -93,8 +93,8 @@ public void constructor_successSamlResponse() throws IOException { assertEquals(EXECUTABLE_SUPPORTED_MAX_VERSION, response.getVersion()); assertEquals(TOKEN_TYPE_SAML, response.getTokenType()); assertEquals(SAML_RESPONSE, response.getSubjectToken()); - assertTrue( - Instant.now().getEpochSecond() + EXPIRATION_DURATION == response.getExpirationTime()); + assertEquals( + Instant.now().getEpochSecond() + EXPIRATION_DURATION, (long) response.getExpirationTime()); } @Test diff --git a/oauth2_http/javatests/com/google/auth/oauth2/PluggableAuthHandlerTest.java b/oauth2_http/javatests/com/google/auth/oauth2/PluggableAuthHandlerTest.java index 121a1186a..9211af7d5 100644 --- a/oauth2_http/javatests/com/google/auth/oauth2/PluggableAuthHandlerTest.java +++ b/oauth2_http/javatests/com/google/auth/oauth2/PluggableAuthHandlerTest.java @@ -741,8 +741,8 @@ public void getExecutableResponse_oidcResponse() throws IOException, Interrupted assertTrue(response.isSuccessful()); assertEquals(TOKEN_TYPE_OIDC, response.getTokenType()); assertEquals(ID_TOKEN, response.getSubjectToken()); - assertTrue( - Instant.now().getEpochSecond() + EXPIRATION_DURATION == response.getExpirationTime()); + assertEquals( + Instant.now().getEpochSecond() + EXPIRATION_DURATION, (long) response.getExpirationTime()); // Current env map should include the mappings from options. assertEquals(4, currentEnv.size()); assertEquals(expectedMap, currentEnv); @@ -788,8 +788,8 @@ public void getExecutableResponse_samlResponse() throws IOException, Interrupted assertTrue(response.isSuccessful()); assertEquals(TOKEN_TYPE_SAML, response.getTokenType()); assertEquals(SAML_RESPONSE, response.getSubjectToken()); - assertTrue( - Instant.now().getEpochSecond() + EXPIRATION_DURATION == response.getExpirationTime()); + assertEquals( + Instant.now().getEpochSecond() + EXPIRATION_DURATION, (long) response.getExpirationTime()); // Current env map should include the mappings from options. assertEquals(4, currentEnv.size());