*/
@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());
}
}