Skip to content

Commit

Permalink
Add test for JsonArray.isEmpty() (#2173)
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenzNickel committed Aug 8, 2022
1 parent 6fc1c8f commit 53234aa
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions gson/src/test/java/com/google/gson/JsonArrayTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,18 @@ public void testDeepCopy() {
assertEquals(1, original.get(0).getAsJsonArray().size());
assertEquals(0, copy.get(0).getAsJsonArray().size());
}

public void testIsEmpty() {
JsonArray array = new JsonArray();
assertTrue(array.isEmpty());

JsonPrimitive a = new JsonPrimitive("a");
array.add(a);
assertFalse(array.isEmpty());

array.remove(0);
assertTrue(array.isEmpty());
}

public void testFailedGetArrayValues() {
JsonArray jsonArray = new JsonArray();
Expand Down

0 comments on commit 53234aa

Please sign in to comment.