### Question:
JavadocBlockParserUtil { public static IrDocName fetchName(JavadocScanner scanner, Set<JavadocTokenKind> follow) { DefaultJavadocTokenStream stream = new DefaultJavadocTokenStream( scanner); stream.mark(); IrDocName elem = fetchName(stream); if (elem == null) { return null; } if (!follows(stream, follow)) { stream.rewind(); return null; } else { stream.discard(); return elem; } } private  JavadocBlockParserUtil(); static T setLocation(T elem, JavadocToken start, JavadocToken stop); static T setLocation(T elem, IrLocation start, IrLocation stop); static IrDocText fetchText(JavadocScanner scanner, boolean trimHead, boolean trimTail); static JavadocBlockInfo fetchBlockInfo(JavadocScanner scanner); static int countWhileTagName(JavadocScanner scanner, int start); static IrDocSimpleName fetchSimpleName(JavadocScanner scanner, Set<JavadocTokenKind> follow); static IrDocName fetchName(JavadocScanner scanner, Set<JavadocTokenKind> follow); static IrDocBasicType fetchBasicType(JavadocScanner scanner, Set<JavadocTokenKind> follow); static IrDocBasicType fetchPrimitiveType(JavadocScanner scanner, Set<JavadocTokenKind> follow); static IrDocNamedType fetchNamedType(JavadocScanner scanner, Set<JavadocTokenKind> follow); static IrDocType fetchType(JavadocScanner scanner, Set<JavadocTokenKind> follow); static IrDocField fetchField(JavadocScanner scanner, Set<JavadocTokenKind> follow); static IrDocMethod fetchMethod(JavadocScanner scanner, Set<JavadocTokenKind> follow); static IrDocFragment fetchLinkTarget(JavadocScanner scanner, Set<JavadocTokenKind> follow); static String buildString(List<? extends JavadocToken> tokens); static final Set<JavadocTokenKind> S_WHITE; }### Answer:
@Test public void testFetchName() { { DefaultJavadocScanner scanner = string("java.lang.String#length()"); IrDocName elem = JavadocBlockParserUtil.fetchName(scanner, null); assertNotNull(elem); assertEquals("java.lang.String", elem.asString()); assertSameLocation(0, "java.lang.String".length(), elem.getLocation()); assertEquals(IrDocElementKind.QUALIFIED_NAME, elem.getKind()); assertEquals(3, elem.asSimpleNameList().size()); assertSameLocation("".length(), "java".length(), elem.asSimpleNameList().get(0).getLocation()); assertSameLocation("java.".length(), "lang".length(), elem.asSimpleNameList().get(1).getLocation()); assertSameLocation("java.lang.".length(), "String".length(), elem.asSimpleNameList().get(2).getLocation()); assertEquals(SHARP, scanner.lookahead(0).getKind()); } { DefaultJavadocScanner scanner = string(".java.lang.String"); IrDocName elem = JavadocBlockParserUtil.fetchName(scanner, null); assertNull(elem); assertEquals(DOT, scanner.lookahead(0).getKind()); } { DefaultJavadocScanner scanner = string("java.lang.String#length()"); IrDocName elem = JavadocBlockParserUtil.fetchName(scanner, EnumSet.of(WHITE_SPACES)); assertNull(elem); assertEquals(IDENTIFIER, scanner.lookahead(0).getKind()); } }