Skip to content

Commit d62d06e

Browse files
burkedavisonzhumin8lqiu96
authored
chore: use assertEquals to improve test error message (#1470)
* chore: use assertEquals to improve test error message * chore: lint --------- Co-authored-by: Min Zhu <zhumin@google.com> Co-authored-by: Lawrence Qiu <lawrenceqiu@google.com>
1 parent e1b1a33 commit d62d06e

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

oauth2_http/javatests/com/google/auth/oauth2/ExecutableResponseTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ public void constructor_successOidcResponse() throws IOException {
6363
assertEquals(EXECUTABLE_SUPPORTED_MAX_VERSION, response.getVersion());
6464
assertEquals(TOKEN_TYPE_OIDC, response.getTokenType());
6565
assertEquals(ID_TOKEN, response.getSubjectToken());
66-
assertTrue(
67-
Instant.now().getEpochSecond() + EXPIRATION_DURATION == response.getExpirationTime());
66+
assertEquals(
67+
Instant.now().getEpochSecond() + EXPIRATION_DURATION, (long) response.getExpirationTime());
6868
}
6969

7070
@Test
@@ -93,8 +93,8 @@ public void constructor_successSamlResponse() throws IOException {
9393
assertEquals(EXECUTABLE_SUPPORTED_MAX_VERSION, response.getVersion());
9494
assertEquals(TOKEN_TYPE_SAML, response.getTokenType());
9595
assertEquals(SAML_RESPONSE, response.getSubjectToken());
96-
assertTrue(
97-
Instant.now().getEpochSecond() + EXPIRATION_DURATION == response.getExpirationTime());
96+
assertEquals(
97+
Instant.now().getEpochSecond() + EXPIRATION_DURATION, (long) response.getExpirationTime());
9898
}
9999

100100
@Test

oauth2_http/javatests/com/google/auth/oauth2/PluggableAuthHandlerTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -741,8 +741,8 @@ public void getExecutableResponse_oidcResponse() throws IOException, Interrupted
741741
assertTrue(response.isSuccessful());
742742
assertEquals(TOKEN_TYPE_OIDC, response.getTokenType());
743743
assertEquals(ID_TOKEN, response.getSubjectToken());
744-
assertTrue(
745-
Instant.now().getEpochSecond() + EXPIRATION_DURATION == response.getExpirationTime());
744+
assertEquals(
745+
Instant.now().getEpochSecond() + EXPIRATION_DURATION, (long) response.getExpirationTime());
746746
// Current env map should include the mappings from options.
747747
assertEquals(4, currentEnv.size());
748748
assertEquals(expectedMap, currentEnv);
@@ -788,8 +788,8 @@ public void getExecutableResponse_samlResponse() throws IOException, Interrupted
788788
assertTrue(response.isSuccessful());
789789
assertEquals(TOKEN_TYPE_SAML, response.getTokenType());
790790
assertEquals(SAML_RESPONSE, response.getSubjectToken());
791-
assertTrue(
792-
Instant.now().getEpochSecond() + EXPIRATION_DURATION == response.getExpirationTime());
791+
assertEquals(
792+
Instant.now().getEpochSecond() + EXPIRATION_DURATION, (long) response.getExpirationTime());
793793

794794
// Current env map should include the mappings from options.
795795
assertEquals(4, currentEnv.size());

0 commit comments

Comments
 (0)