/** * Indicates that the wrapped node has <tt>null</tt> value (ie * {@link JsonRepresentation#isNull()}), or returns <tt>null</tt> if there * was no node with the provided path. */ public Boolean isNull(final String path) { return isNull(getNode(path)); }
public boolean isNull() { return isNull(asJsonNode()); }
@Test public void isNull_forNonExistent() { final Boolean isNull = jsonRepresentation.isNull("nonExistent"); assertThat(isNull, is(nullValue())); // ie don't know whether is null }
@Test public void isNull_forArray() throws JsonParseException, JsonMappingException, IOException { final Boolean isNull = jsonRepresentation.isNull("anEmptyArray"); assertThat(isNull, is(false)); }
@Test public void isNull_forMap() throws IOException { final Boolean isNull = jsonRepresentation.isNull("aSubMap"); assertThat(isNull, is(false)); }
@Test public void isNull_forNonExistent() { final Boolean isNull = jsonRepresentation.isNull("nonExistent"); assertThat(isNull, is(nullValue())); // ie don't know whether is null }
@Test public void isNull_forArray() throws IOException { final Boolean isNull = jsonRepresentation.isNull("anEmptyArray"); assertThat(isNull, is(false)); }
@Test public void forNullValue() throws IOException { final JsonRepresentation nullValue = jsonRepresentation.getNull("aNull"); assertThat(nullValue, is(not(nullValue()))); assertThat(nullValue.isNull(), is(true)); final Boolean isNull = jsonRepresentation.isNull("aNull"); assertThat(isNull, is(true)); }
@Test public void forNullValue() throws JsonParseException, JsonMappingException, IOException { final JsonRepresentation nullValue = jsonRepresentation.getNull("aNull"); assertThat(nullValue, is(not(nullValue()))); assertThat(nullValue.isNull(), is(true)); final Boolean isNull = jsonRepresentation.isNull("aNull"); assertThat(isNull, is(true)); }
@Test public void isNull_forMap() throws JsonParseException, JsonMappingException, IOException { final Boolean isNull = jsonRepresentation.isNull("aSubMap"); assertThat(isNull, is(false)); }
@Test public void newArrayInitialSize() throws Exception { final JsonRepresentation jsonRepresentation = JsonRepresentation.newArray(2); assertThat(jsonRepresentation.size(), is(2)); assertThat(jsonRepresentation.arrayGet(0).isNull(), is(true)); assertThat(jsonRepresentation.arrayGet(1).isNull(), is(true)); }
@Test public void newArrayInitialSize() throws Exception { final JsonRepresentation jsonRepresentation = JsonRepresentation.newArray(2); assertThat(jsonRepresentation.size(), is(2)); assertThat(jsonRepresentation.arrayGet(0).isNull(), is(true)); assertThat(jsonRepresentation.arrayGet(1).isNull(), is(true)); }