Search in sources :

Example 16 with ImportDeclaration

use of com.github.javaparser.ast.ImportDeclaration in project javaparser by javaparser.

the class NameTest method importName.

@Test
public void importName() {
    ImportDeclaration importDeclaration = parseImport("import java.@Abc util.List;");
    assertThat(importDeclaration.getName().getQualifier().get().getAnnotations()).containsExactly(new MarkerAnnotationExpr("Abc"));
    assertEquals("import java.@Abc util.List;" + EOL, importDeclaration.toString());
    assertEquals("import java.@Abc util.List;", ConcreteSyntaxModel.genericPrettyPrint(importDeclaration));
}
Also used : ImportDeclaration(com.github.javaparser.ast.ImportDeclaration) Test(org.junit.Test)

Aggregations

ImportDeclaration (com.github.javaparser.ast.ImportDeclaration)16 TypeDeclaration (com.github.javaparser.ast.body.TypeDeclaration)5 Test (org.junit.Test)5 CompilationUnit (com.github.javaparser.ast.CompilationUnit)4 PackageDeclaration (com.github.javaparser.ast.PackageDeclaration)3 ClassOrInterfaceDeclaration (com.github.javaparser.ast.body.ClassOrInterfaceDeclaration)3 AnnotationDeclaration (com.github.javaparser.ast.body.AnnotationDeclaration)2 EmptyTypeDeclaration (com.github.javaparser.ast.body.EmptyTypeDeclaration)2 EnumDeclaration (com.github.javaparser.ast.body.EnumDeclaration)2 MethodDeclaration (com.github.javaparser.ast.body.MethodDeclaration)2 ResolvedMethodDeclaration (com.github.javaparser.resolution.declarations.ResolvedMethodDeclaration)2 ResolvedReferenceTypeDeclaration (com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration)2 ResolvedTypeDeclaration (com.github.javaparser.resolution.declarations.ResolvedTypeDeclaration)2 ResolvedType (com.github.javaparser.resolution.types.ResolvedType)2 JavaParserAnnotationDeclaration (com.github.javaparser.symbolsolver.javaparsermodel.declarations.JavaParserAnnotationDeclaration)2 JavaParserEnumDeclaration (com.github.javaparser.symbolsolver.javaparsermodel.declarations.JavaParserEnumDeclaration)2 SymbolSolver (com.github.javaparser.symbolsolver.resolution.SymbolSolver)2 ASTParser (com.github.javaparser.ASTParser)1 Node (com.github.javaparser.ast.Node)1 NodeList (com.github.javaparser.ast.NodeList)1