MCPcopy
hub / github.com/google/gson / testRemove

Method testRemove

gson/src/test/java/com/google/gson/JsonArrayTest.java:62–76  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

60 }
61
62 @Test
63 public void testRemove() {
64 JsonArray array = new JsonArray();
65 assertThrows(IndexOutOfBoundsException.class, () -> array.remove(0));
66
67 JsonPrimitive a = new JsonPrimitive("a");
68 array.add(a);
69 assertThat(array.remove(a)).isTrue();
70 assertThat(array).doesNotContain(a);
71 array.add(a);
72 array.add(new JsonPrimitive("b"));
73 assertThat(array.remove(1).getAsString()).isEqualTo("b");
74 assertThat(array).hasSize(1);
75 assertThat(array).contains(a);
76 }
77
78 @Test
79 public void testSet() {

Callers

nothing calls this directly

Calls 4

removeMethod · 0.95
addMethod · 0.95
getAsStringMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected