public static Iterator<Integer> lineOffsetIterator(String input) {
    return new LineOffsetIterator(input);
  }
@Test
  public void terminalOffset() {
    Iterator<Integer> it = Newlines.lineOffsetIterator("foo\nbar\n");
    it.next();
    it.next();
    it.next();
    try {
      it.next();
      fail();
    } catch (NoSuchElementException e) {
      // expected
    }

    it = Newlines.lineOffsetIterator("foo\nbar");
    it.next();
    it.next();
    try {
      it.next();
      fail();
    } catch (NoSuchElementException e) {
      // expected
    }
  }