### Question:
JsonArray extends JsonValue implements Iterable<Object>, Serializable { public static JsonArray from(Object... items) { JsonArray array = new JsonArray(items.length); for (Object item : items) { array.add(JsonValue.coerce(item)); } return array; } private  JsonArray(); private  JsonArray(int initialCapacity); static JsonArray create(); static JsonArray create(int initialCapacity); static JsonArray from(Object... items); static JsonArray from(List<?> items); static JsonArray fromJson(String s); static JsonArray fromJson(byte[] s); Object get(int index); JsonArray add(Object value); JsonArray addNull(); JsonArray add(String value); String getString(int index); JsonArray add(long value); Long getLong(int index); JsonArray add(int value); Integer getInt(int index); JsonArray add(double value); Double getDouble(int index); JsonArray add(boolean value); boolean getBoolean(int index); JsonArray add(JsonObject value); JsonArray add(Map<String, ?> value); JsonObject getObject(int index); JsonArray add(JsonArray value); JsonArray add(List<?> value); JsonArray add(Number value); JsonArray getArray(int index); BigInteger getBigInteger(int index); BigDecimal getBigDecimal(int index); Number getNumber(int index); List<Object> toList(); boolean isEmpty(); int size(); boolean contains(Object value); @Override Iterator<Object> iterator(); @Override String toString(); byte[] toBytes(); @Override boolean equals(Object o); @Override int hashCode();  }### Answer:
@Test void shouldNullPointerOnNullList() { assertThrows(InvalidArgumentException.class, () -> JsonArray.from((List) null)); }
@Test void shouldDetectIncorrectItemInList() { Object badItem = new java.lang.CloneNotSupportedException(); assertThrows( InvalidArgumentException.class, () -> JsonArray.from(Arrays.asList("item1", "item2", badItem)) ); }
@Test void shouldThrowOnBadSubMap() { Map<Integer, String> badMap1 = mapOf(1, "test"); Map<String, Object> badMap2 = mapOf("key1", new CloneNotSupportedException()); InvalidArgumentException e = assertThrows(InvalidArgumentException.class, () -> JsonArray.from(listOf(badMap1))); assertTrue(e.getCause() instanceof ClassCastException); assertThrows(InvalidArgumentException.class, () -> JsonArray.from(listOf(badMap2))); }
@Test void shouldThrowOnBadSubList() { List<?> badSubList = listOf(new CloneNotSupportedException()); assertThrows(InvalidArgumentException.class, () -> JsonArray.from(listOf(badSubList))); }