use of com.auth0.jwt.Claim in project java-jwt by auth0.
the class JsonNodeClaimTest method shouldReturnBaseClaimWhenParsingMissingNode.
@Test
public void shouldReturnBaseClaimWhenParsingMissingNode() {
JsonNode value = MissingNode.getInstance();
Claim claim = claimFromNode(value);
assertThat(claim, is(notNullValue()));
assertThat(claim.isMissing(), is(true));
assertThat(claim.isNull(), is(false));
}
use of com.auth0.jwt.Claim in project java-jwt by auth0.
the class JsonNodeClaimTest method shouldGetLongValue.
@Test
public void shouldGetLongValue() {
JsonNode value = mapper.valueToTree(Long.MAX_VALUE);
Claim claim = claimFromNode(value);
assertThat(claim.asLong(), is(notNullValue()));
assertThat(claim.asLong(), is(Long.MAX_VALUE));
}
use of com.auth0.jwt.Claim in project java-jwt by auth0.
the class JsonNodeClaimTest method shouldGetStringValue.
@Test
public void shouldGetStringValue() {
JsonNode value = mapper.valueToTree("string");
Claim claim = claimFromNode(value);
assertThat(claim.asString(), is(notNullValue()));
assertThat(claim.asString(), is("string"));
}
use of com.auth0.jwt.Claim in project java-jwt by auth0.
the class JsonNodeClaimTest method shouldGetNullListIfNonArrayValue.
@Test
public void shouldGetNullListIfNonArrayValue() {
JsonNode value = mapper.valueToTree(1);
Claim claim = claimFromNode(value);
assertThat(claim.asList(String.class), is(nullValue()));
}
use of com.auth0.jwt.Claim in project java-jwt by auth0.
the class JsonNodeClaimTest method shouldReturnNonNullClaimWhenParsingDateValue.
@Test
public void shouldReturnNonNullClaimWhenParsingDateValue() {
JsonNode value = mapper.valueToTree(new Date());
Claim claim = claimFromNode(value);
assertThat(claim, is(notNullValue()));
assertThat(claim, is(instanceOf(JsonNodeClaim.class)));
assertThat(claim.isNull(), is(false));
assertThat(claim.isMissing(), is(false));
}
Aggregations