Skip to content

Commit

Permalink
add test for null claim name
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmyjames committed Sep 24, 2020
1 parent 4efb296 commit ff7bdcd
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/src/test/java/com/auth0/jwt/JWTVerifierTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -807,6 +807,19 @@ public void shouldThrowWhenVerifyingClaimPresenceButClaimNotPresent() {
verifier.verify(jwt);
}

@Test
public void shouldThrowWhenVerifyingClaimPresenceWhenClaimNameIsNull() {
exception.expect(IllegalArgumentException.class);
exception.expectMessage("The Custom Claim's name can't be null.");

String jwt = JWTCreator.init()
.withClaim("custom", "value")
.sign(Algorithm.HMAC256("secret"));

JWTVerifier.init(Algorithm.HMAC256("secret"))
.withClaimPresence(null);
}

@Test
public void shouldVerifyStringClaimPresence() {
String jwt = JWTCreator.init()
Expand Down

0 comments on commit ff7bdcd

Please sign in to comment.