*/
@Test
public void testFetchLinkTarget() {
{
DefaultJavadocScanner scanner = string("java.lang.String");
IrDocFragment target = JavadocBlockParserUtil.fetchLinkTarget(scanner, null);
assertNotNull(target);
assertEquals(IrDocElementKind.NAMED_TYPE, target.getKind());
IrDocNamedType elem = (IrDocNamedType) target;
assertEquals("java.lang.String", elem.getName().asString());
assertSameLocation(0, "java.lang.String".length(), elem.getLocation());
assertEquals(EOF, scanner.lookahead(0).getKind());
}
{
DefaultJavadocScanner scanner = string("Math#PI{");
IrDocFragment target = JavadocBlockParserUtil.fetchLinkTarget(scanner, null);
assertNotNull(target);
assertEquals(IrDocElementKind.FIELD, target.getKind());
IrDocField elem = (IrDocField) target;
assertEquals("Math", elem.getDeclaringType().getName().asString());
assertEquals("PI", elem.getName().getIdentifier());
assertSameLocation(0, "Math#PI".length(), elem.getLocation());
assertEquals(LEFT_BRACE, scanner.lookahead(0).getKind());
}
{
DefaultJavadocScanner scanner = string("Math#max(int a, int b)");
IrDocFragment target = JavadocBlockParserUtil.fetchLinkTarget(scanner, null);
assertNotNull(target);
assertEquals(IrDocElementKind.METHOD, target.getKind());
IrDocMethod elem = (IrDocMethod) target;
assertEquals("Math", elem.getDeclaringType().getName().asString());
assertEquals("max", elem.getName().asString());
assertEquals(2, elem.getParameters().size());
{