public void next() {
        index++;
        if (index > lineLength) {
            lineIndex++;
            if (lineIndex < lines.size()) {
                setLine(lines.get(lineIndex));
            } else {
                setLine(SourceLine.of("", null));
            }
            index = 0;
        }
    }
@Test
    public void testNext() {
        Scanner scanner = new Scanner(List.of(
                SourceLine.of("foo bar", null)),
                0, 4);
        assertEquals('b', scanner.peek());
        scanner.next();
        assertEquals('a', scanner.peek());
        scanner.next();
        assertEquals('r', scanner.peek());
        scanner.next();
        assertEquals('\0', scanner.peek());
    }