@Test public void arrayGet_forNonEmptyList() throws IOException { jsonRepresentation = new JsonRepresentation(readJson("list.json")); assertThat(jsonRepresentation.arrayGet(0), is(not(nullValue()))); }
@Test public void arrayGet_forNonEmptyList() throws JsonParseException, JsonMappingException, IOException { jsonRepresentation = new JsonRepresentation(readJson("list.json")); assertThat(jsonRepresentation.arrayGet(0), is(not(nullValue()))); }
@Test(expected = IndexOutOfBoundsException.class) public void arrayGet_outOfBounds() throws JsonParseException, JsonMappingException, IOException { jsonRepresentation = new JsonRepresentation(readJson("emptyList.json")); jsonRepresentation.arrayGet(0); }
@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)); }
@Test(expected = IndexOutOfBoundsException.class) public void arrayGet_outOfBounds() throws IOException { jsonRepresentation = new JsonRepresentation(readJson("emptyList.json")); jsonRepresentation.arrayGet(0); }
@Test(expected = IllegalStateException.class) public void arrayGet_forMap() throws JsonParseException, JsonMappingException, IOException { jsonRepresentation = new JsonRepresentation(readJson("emptyMap.json")); jsonRepresentation.arrayGet(0); }
@Test(expected = IllegalStateException.class) public void arrayGet_forMap() throws IOException { jsonRepresentation = new JsonRepresentation(readJson("emptyMap.json")); jsonRepresentation.arrayGet(0); }
@Test(expected = IllegalStateException.class) public void arrayGet_forValue() throws IOException { jsonRepresentation = new JsonRepresentation(readJson("map.json")); final JsonRepresentation valueRepresentation = jsonRepresentation.getRepresentation("anInt"); valueRepresentation.arrayGet(0); }
@Test(expected = IllegalStateException.class) public void arrayGet_forValue() throws JsonParseException, JsonMappingException, IOException { jsonRepresentation = new JsonRepresentation(readJson("map.json")); final JsonRepresentation valueRepresentation = jsonRepresentation.getRepresentation("anInt"); valueRepresentation.arrayGet(0); }