4444import static java .util .concurrent .TimeUnit .SECONDS ;
4545import static org .assertj .core .api .Assertions .assertThat ;
4646import static org .assertj .core .api .Assertions .assertThatThrownBy ;
47+ import static org .testng .Assert .assertEquals ;
4748
4849public class TestJweTokenSerializer
4950{
@@ -99,7 +100,7 @@ public void testSerializationFailsWithWrongKeySize()
99100 for (int wrongKeySize : new int [] {8 , 64 , 128 }) {
100101 String tooShortSecret = randomEncodedSecret (wrongKeySize );
101102 assertThatThrownBy (() -> assertRoundTrip (tooShortSecret , tooShortSecret ))
102- .hasStackTraceContaining ("Secret key size must be either 16, 24 or 32 bytes but was " + wrongKeySize );
103+ .hasStackTraceContaining ("The Key Encryption Key length must be 128 bits (16 bytes), 192 bits (24 bytes) or 256 bits (32 bytes)" );
103104 }
104105 }
105106
@@ -116,8 +117,10 @@ private void assertRoundTrip(Optional<String> serializerSecret, Optional<String>
116117 JweTokenSerializer deserializer = tokenSerializer (Clock .systemUTC (), succinctDuration (5 , SECONDS ), deserializerSecret );
117118 Date expiration = new Calendar .Builder ().setDate (2023 , 6 , 22 ).build ().getTime ();
118119 TokenPair tokenPair = withAccessAndRefreshTokens (randomEncodedSecret (), expiration , randomEncodedSecret ());
119- assertThat (deserializer .deserialize (serializer .serialize (tokenPair )))
120- .isEqualTo (tokenPair );
120+ TokenPair postSerPair = deserializer .deserialize (serializer .serialize (tokenPair ));
121+ assertEquals (tokenPair .getAccessToken (), postSerPair .getAccessToken ());
122+ assertEquals (tokenPair .getRefreshToken (), postSerPair .getRefreshToken ());
123+ assertEquals (tokenPair .getExpiration (), postSerPair .getExpiration ());
121124 }
122125
123126 @ Test
@@ -184,8 +187,8 @@ private JweTokenSerializer tokenSerializer(Clock clock, Duration tokenExpiration
184187 return new JweTokenSerializer (
185188 refreshTokensConfig ,
186189 new Oauth2ClientStub (),
187- "trino_coordinator_test_version " ,
188- "trino_coordinator " ,
190+ "presto_coordinator_test_version " ,
191+ "presto_coordinator " ,
189192 "sub" ,
190193 clock ,
191194 tokenExpiration );
0 commit comments