Skip to content

Commit 7258a73

Browse files
♻️ Refactoring test cases
1 parent 8bdcb83 commit 7258a73

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/test/java/org/rrajesh1979/utils/JWTUtilTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ void encodeDecodeJWTTtlTest() {
5454
String key = jwtAndKey.getValue1();
5555

5656
Pair<String, String> decodedJwtAndKey = JWTUtil.decodeJWT(jwt, key);
57-
assertEquals(decodedJwtAndKey.getValue0(), "{typ=JWT, alg=HS512}");
58-
assertNotEquals(decodedJwtAndKey.getValue1(), "{sub=JWT Encoder, aud=Hello JWT, name=Joe, iss=rrajesh1979, picture=https://example.com/image.png}");
57+
assertEquals("{alg=HS512, typ=JWT}", decodedJwtAndKey.getValue0());
58+
assertNotEquals("{sub=JWT Encoder, aud=Hello JWT, name=Joe, iss=rrajesh1979, picture=https://example.com/image.png}", decodedJwtAndKey.getValue1());
5959
}
6060

6161

@@ -71,8 +71,8 @@ void encodeDecodeJWTEmptyPayloadTest() {
7171
String key = jwtAndKey.getValue1();
7272

7373
Pair<String, String> decodedJwtAndKey = JWTUtil.decodeJWT(jwt, key);
74-
assertEquals(decodedJwtAndKey.getValue0(), "{typ=JWT, alg=HS512}");
75-
assertEquals(decodedJwtAndKey.getValue1(), "{sub=JWT Encoder, aud=Hello JWT, iss=rrajesh1979}");
74+
assertEquals("{alg=HS512, typ=JWT}", decodedJwtAndKey.getValue0());
75+
assertEquals("{sub=JWT Encoder, aud=Hello JWT, iss=rrajesh1979}", decodedJwtAndKey.getValue1());
7676
}
7777

7878
@Test
@@ -84,8 +84,8 @@ void encodeDecodeJWTInvalidKeyTest() {
8484
String payload = "{\"sub\": \"JWT Encoder\", \"aud\": \"Hello JWT\", \"name\": \"Joe\", \"iss\": \"rrajesh1979\", \"picture\": \"https://example.com/image.png\"}";
8585

8686
Pair<String, String> decodedJwtAndKey = JWTUtil.decodeJWT(jwt, key);
87-
assertEquals(decodedJwtAndKey.getValue0(), "{typ=JWT, alg=HS512}");
88-
assertEquals(decodedJwtAndKey.getValue1(), payload.replace("\"", "").replace(": ", "="));
87+
assertEquals("{typ=JWT, alg=HS512}", decodedJwtAndKey.getValue0());
88+
assertEquals(payload.replace("\"", "").replace(": ", "="), decodedJwtAndKey.getValue1());
8989
}
9090

9191

0 commit comments

Comments
 (0)