@Override
  public JsonElement next() throws JsonParseException {
    if (!hasNext()) {
      throw new NoSuchElementException();
    }

    try {
      return Streams.parse(parser);
    } catch (StackOverflowError e) {
      throw new JsonParseException("Failed parsing JSON source to Json", e);
    } catch (OutOfMemoryError e) {
      throw new JsonParseException("Failed parsing JSON source to Json", e);
    }
  }
@Test
  public void testCallingNextBeyondAvailableInput() {
    JsonElement unused1 = parser.next();
    JsonElement unused2 = parser.next();
    // Parser should not go beyond available input
    assertThrows(NoSuchElementException.class, parser::next);
  }