Search in sources :

Example 11 with UserPojo

use of com.auth0.jwt.UserPojo in project java-jwt by auth0.

the class JsonNodeClaimTest method shouldGetCustomClassValue.

@Test
public void shouldGetCustomClassValue() {
    JsonNode value = mapper.valueToTree(new UserPojo("john", 123));
    Claim claim = claimFromNode(value);
    assertThat(claim, is(notNullValue()));
    assertThat(claim.as(UserPojo.class).getName(), is("john"));
    assertThat(claim.as(UserPojo.class).getId(), is(123));
}
Also used : UserPojo(com.auth0.jwt.UserPojo) JsonNode(com.fasterxml.jackson.databind.JsonNode) Claim(com.auth0.jwt.interfaces.Claim) Test(org.junit.Test)

Aggregations

UserPojo (com.auth0.jwt.UserPojo)11 Test (org.junit.Test)11 Claim (com.auth0.jwt.interfaces.Claim)8 JsonNode (com.fasterxml.jackson.databind.JsonNode)8