### Question:
JsonValueReader extends JsonReader { @Override public void beginArray() throws IOException { List<?> peeked = require(List.class, Token.BEGIN_ARRAY); JsonIterator iterator = new JsonIterator(Token.END_ARRAY, peeked.toArray(new Object[peeked.size()]), 0); stack[stackSize - 1] = iterator; scopes[stackSize - 1] = JsonScope.EMPTY_ARRAY; pathIndices[stackSize - 1] = 0; if (iterator.hasNext()) { push(iterator.next()); } } JsonValueReader(Object root);   JsonValueReader(JsonValueReader copyFrom); @Override void beginArray(); @Override void endArray(); @Override void beginObject(); @Override void endObject(); @Override boolean hasNext(); @Override Token peek(); @Override String nextName(); @Override int selectName(Options options); @Override void skipName(); @Override String nextString(); @Override int selectString(Options options); @Override boolean nextBoolean(); @Override @Nullable T nextNull(); @Override double nextDouble(); @Override long nextLong(); @Override int nextInt(); @Override void skipValue(); @Override BufferedSource nextSource(); @Override JsonReader peekJson(); @Override void promoteNameToValue(); @Override void close();  }### Answer:
@Test public void tooDeeplyNestedArrays() throws IOException { Object root = Collections.emptyList(); for (int i = 0; i < MAX_DEPTH + 1; i++) { root = singletonList(root); } JsonReader reader = new JsonValueReader(root); for (int i = 0; i < MAX_DEPTH; i++) { reader.beginArray(); } try { reader.beginArray(); fail(); } catch (JsonDataException expected) { assertThat(expected) .hasMessageThat() .isEqualTo("Nesting too deep at $" + repeat("[0]", MAX_DEPTH + 1)); } }