### Question:
JavadocScannerUtil { public static int countUntil(Collection<JavadocTokenKind> kinds, JavadocScanner scanner, int start) { return countWhileUntil(kinds, scanner, start, true); } 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 testCountUntilVoid() { DefaultJavadocScanner scanner = scanner("kinds.txt"); { EnumSet<JavadocTokenKind> set = EnumSet.noneOf(JavadocTokenKind.class); int count = JavadocScannerUtil.countUntil(set, scanner, 0); assertEquals(scanner.getTokens().size(), count); } { EnumSet<JavadocTokenKind> set = EnumSet.noneOf(JavadocTokenKind.class); int count = JavadocScannerUtil.countUntil(set, scanner, 5); assertEquals(scanner.getTokens().size() - 5, count); } }
@Test public void testCountUntilSingle() { DefaultJavadocScanner scanner = scanner("kinds.txt"); { EnumSet<JavadocTokenKind> set = EnumSet.of(ASTERISK); int count = JavadocScannerUtil.countUntil(set, scanner, 0); assertEquals(0, count); } { EnumSet<JavadocTokenKind> set = EnumSet.of(IDENTIFIER); int count = JavadocScannerUtil.countUntil(set, scanner, 0); assertEquals(3, count); } { EnumSet<JavadocTokenKind> set = EnumSet.of(QUESTION); int count = JavadocScannerUtil.countUntil(set, scanner, 0); assertEquals(4, count); } { EnumSet<JavadocTokenKind> set = EnumSet.of(WHITE_SPACES); int count = JavadocScannerUtil.countUntil(set, scanner, 0); assertEquals(8, count); } { EnumSet<JavadocTokenKind> set = EnumSet.of(AT); int count = JavadocScannerUtil.countUntil(set, scanner, 5); assertEquals(5, count); } }
@Test public void testCountUntilMulti() { DefaultJavadocScanner scanner = scanner("kinds.txt"); { EnumSet<JavadocTokenKind> set = EnumSet.of(IDENTIFIER, AT); int count = JavadocScannerUtil.countUntil(set, scanner, 0); assertEquals(3, count); } { EnumSet<JavadocTokenKind> set = EnumSet.of(IDENTIFIER, AT); int count = JavadocScannerUtil.countUntil(set, scanner, 5); assertEquals(5, count); } }