use of com.auth0.android.jwt.Claim in project java-jwt by auth0.
the class JsonNodeClaimTest method shouldGetNullListIfNullValue.
@Test
public void shouldGetNullListIfNullValue() {
JsonNode value = mapper.valueToTree(null);
Claim claim = claimFromNode(value);
assertThat(claim.asList(String.class), is(nullValue()));
}
use of com.auth0.android.jwt.Claim in project java-jwt by auth0.
the class JsonNodeClaimTest method shouldGetArrayValue.
@Test
public void shouldGetArrayValue() {
JsonNode value = mapper.valueToTree(new String[] { "string1", "string2" });
Claim claim = claimFromNode(value);
assertThat(claim.asArray(String.class), is(notNullValue()));
assertThat(claim.asArray(String.class), is(arrayContaining("string1", "string2")));
}
use of com.auth0.android.jwt.Claim in project java-jwt by auth0.
the class JsonNodeClaimTest method shouldReturnNonNullClaimWhenParsingStringValue.
@Test
public void shouldReturnNonNullClaimWhenParsingStringValue() {
JsonNode value = mapper.valueToTree("");
Claim claim = claimFromNode(value);
assertThat(claim, is(notNullValue()));
assertThat(claim, is(instanceOf(JsonNodeClaim.class)));
assertThat(claim.isNull(), is(false));
assertThat(claim.isMissing(), is(false));
}
use of com.auth0.android.jwt.Claim in project java-jwt by auth0.
the class JsonNodeClaimTest method shouldGetListValue.
@Test
public void shouldGetListValue() {
JsonNode value = mapper.valueToTree(Arrays.asList("string1", "string2"));
Claim claim = claimFromNode(value);
assertThat(claim.asList(String.class), is(notNullValue()));
assertThat(claim.asList(String.class), is(hasItems("string1", "string2")));
}
use of com.auth0.android.jwt.Claim in project java-jwt by auth0.
the class JsonNodeClaimTest method shouldReturnNonNullClaimWhenParsingList.
@Test
public void shouldReturnNonNullClaimWhenParsingList() {
JsonNode value = mapper.valueToTree(new ArrayList<String>());
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