### Question:
JavadocScannerUtil { public static int countUntilNextPrintable(JavadocScanner scanner, int start) { int offset = 0; while (true) { offset += countWhile(S_WHITE_SPACES, scanner, start + offset); JavadocToken token = scanner.lookahead(start + offset); JavadocTokenKind kind = token.getKind(); if (kind == JavadocTokenKind.EOF) { return offset; } else if (kind != JavadocTokenKind.LINE_BREAK) { return offset; } offset += countUntilNextLineStart(scanner, start + offset); } } private  JavadocScannerUtil(); static List<JavadocToken> lookaheadTokens(JavadocScanner scanner, int start, int count); static int countWhile(Collection<JavadocTokenKind> kinds, JavadocScanner scanner, int start); static int countUntil(Collection<JavadocTokenKind> kinds, JavadocScanner scanner, int start); static int countUntilBlockEnd(JavadocScanner scanner, int start); static int countUntilCommentEnd(JavadocScanner scanner, boolean returnMinusIfMissing, int start); static int countUntilNextPrintable(JavadocScanner scanner, int start); static int countUntilNextLineStart(JavadocScanner scanner, int start); static int consumeLineEnd(JavadocScanner scanner, boolean multiline);  }### Answer:
@Test public void testCountUntilNextPrintableGeneral() { DefaultJavadocScanner scanner = scanner("alphabets.txt"); int offset = 0; assertEquals("a", scanner.lookahead(offset).getText()); offset++; assertEquals(WHITE_SPACES, scanner.lookahead(offset).getKind()); offset += JavadocScannerUtil.countUntilNextPrintable(scanner, offset); assertEquals("b", scanner.lookahead(offset).getText()); offset++; assertEquals(WHITE_SPACES, scanner.lookahead(offset).getKind()); offset += JavadocScannerUtil.countUntilNextPrintable(scanner, offset); assertEquals("c", scanner.lookahead(offset).getText()); }
@Test public void testCountUntilNextPrintableBeyondLines() { DefaultJavadocScanner scanner = scanner("3lines-formatted.txt"); int offset = 0; assertEquals("a", scanner.lookahead(offset).getText()); offset++; offset += JavadocScannerUtil.countUntilNextPrintable(scanner, offset); assertEquals("b", scanner.lookahead(offset).getText()); offset++; offset += JavadocScannerUtil.countUntilNextPrintable(scanner, offset); assertEquals("c", scanner.lookahead(offset).getText()); offset++; offset += JavadocScannerUtil.countUntilNextPrintable(scanner, offset); assertEquals(EOF, scanner.lookahead(offset).getKind()); }
@Test public void testCountUntilNextPrintableBeyondBlankLines() { DefaultJavadocScanner scanner = scanner("blank-lines.txt"); int offset = 0; assertEquals("a", scanner.lookahead(offset).getText()); offset++; offset += JavadocScannerUtil.countUntilNextPrintable(scanner, offset); assertEquals("b", scanner.lookahead(offset).getText()); offset++; offset += JavadocScannerUtil.countUntilNextPrintable(scanner, offset); assertEquals("c", scanner.lookahead(offset).getText()); offset++; offset += JavadocScannerUtil.countUntilNextPrintable(scanner, offset); assertEquals("d", scanner.lookahead(offset).getText()); offset++; offset += JavadocScannerUtil.countUntilNextPrintable(scanner, offset); assertEquals(EOF, scanner.lookahead(offset).getKind()); }