@Test public void forList() throws JsonParseException, JsonMappingException, IOException { assertThat(jsonRepresentation.isString("aSubList"), is(false)); try { jsonRepresentation.getString("aSubList"); fail(); } catch (final IllegalArgumentException e) { assertThat(e.getMessage(), is("'aSubList' is not a string")); } }
@Test public void forMultipartKey() throws JsonParseException, JsonMappingException, IOException { assertThat(jsonRepresentation.isString("aSubMap.aString"), is(true)); assertThat(jsonRepresentation.getString("aSubMap.aString"), is("aSubMapStringValue")); }
@Test public void forNonExistent() throws JsonParseException, JsonMappingException, IOException { assertThat(jsonRepresentation.isString("doesNotExist"), is(false)); assertThat(jsonRepresentation.getString("doesNotExist"), is(nullValue())); }
@Test public void happyCase() throws JsonParseException, JsonMappingException, IOException { assertThat(jsonRepresentation.isString("aString"), is(true)); assertThat(jsonRepresentation.getString("aString"), is("aStringValue")); }