public String asArg() { if (isValue()) { return asJsonNode().getValueAsText(); } else { return asJsonNode().toString(); } }
throw new IllegalArgumentException("ObjectSpecification is required"); if (!argValueRepr.isValue()) { throw new IllegalArgumentException("Representation must be of a value");
@Test public void forValue() throws IOException { final JsonRepresentation valueRepresentation = jsonRepresentation.getRepresentation("anInt"); assertThat(valueRepresentation.isValue(), is(true)); }
@Test public void forValue() throws JsonParseException, JsonMappingException, IOException { final JsonRepresentation valueRepresentation = jsonRepresentation.getRepresentation("anInt"); assertThat(valueRepresentation.isValue(), is(true)); }
throw new IllegalArgumentException("ObjectSpecification is required"); if (!argValueRepr.isValue()) { throw new IllegalArgumentException("Representation must be of a value");
@Test public void forMap() throws IOException { assertThat(jsonRepresentation.isArray(), is(false)); assertThat(jsonRepresentation.isMap(), is(true)); assertThat(jsonRepresentation.isValue(), is(false)); }
@Test public void forMap() throws JsonParseException, JsonMappingException, IOException { assertThat(jsonRepresentation.isArray(), is(false)); assertThat(jsonRepresentation.isMap(), is(true)); assertThat(jsonRepresentation.isValue(), is(false)); }
@Test public void forValue() throws JsonParseException, JsonMappingException, IOException { final JsonRepresentation valueRepresentation = jsonRepresentation.getRepresentation("aString"); assertThat(valueRepresentation.isArray(), is(false)); assertThat(valueRepresentation.isMap(), is(false)); assertThat(valueRepresentation.isValue(), is(true)); }
@Test public void forValue() throws IOException { final JsonRepresentation valueRepresentation = jsonRepresentation.getRepresentation("aString"); assertThat(valueRepresentation.isArray(), is(false)); assertThat(valueRepresentation.isMap(), is(false)); assertThat(valueRepresentation.isValue(), is(true)); }
@Test public void forList() throws IOException { jsonRepresentation = new JsonRepresentation(readJson("list.json")); assertThat(jsonRepresentation.isArray(), is(true)); assertThat(jsonRepresentation.isMap(), is(false)); assertThat(jsonRepresentation.isValue(), is(false)); }
@Test public void forList() throws JsonParseException, JsonMappingException, IOException { jsonRepresentation = new JsonRepresentation(readJson("list.json")); assertThat(jsonRepresentation.isArray(), is(true)); assertThat(jsonRepresentation.isMap(), is(false)); assertThat(jsonRepresentation.isValue(), is(false)); }
throw new IllegalArgumentException("representation cannot be null"); if (!representation.isValue()) { throw new IllegalArgumentException("representation must be of a value");