@SuppressWarnings("unchecked") @Test public void test_Existing_Static_Imports2() { AST ast = AST.newAST(AST.JLS4); CompilationUnit cu = ast.newCompilationUnit(); PackageDeclaration packageDeclaration = ast.newPackageDeclaration(); packageDeclaration.setName(ast.newName("org.kissmda.test.junit")); cu.setPackage(packageDeclaration); ImportDeclaration importDeclaration = ast.newImportDeclaration(); importDeclaration .setName(ast.newName("org.junit.Assert.assertNotNull")); importDeclaration.setStatic(true); cu.imports().add(importDeclaration); logger.info(cu.toString()); new ImportPacker(cu).pack(); logger.info(cu.toString()); assertEquals("package org.kissmda.test.junit;\n" + "import static org.junit.Assert.assertNotNull;", cu .toString().trim()); }
public void pack() { compilationUnit.accept(searchImportStatementVisitor); compilationUnit.accept(searchSimpleNameToIgnoreVisitor); compilationUnit.accept(searchQualifiedNamesVisitor); rewriteImports(); }
ImportPacker { public void pack() { compilationUnit.accept(searchImportStatementVisitor); compilationUnit.accept(searchSimpleNameToIgnoreVisitor); compilationUnit.accept(searchQualifiedNamesVisitor); rewriteImports(); } }
ImportPacker { public void pack() { compilationUnit.accept(searchImportStatementVisitor); compilationUnit.accept(searchSimpleNameToIgnoreVisitor); compilationUnit.accept(searchQualifiedNamesVisitor); rewriteImports(); } ImportPacker(CompilationUnit compilationUnit); }
ImportPacker { public void pack() { compilationUnit.accept(searchImportStatementVisitor); compilationUnit.accept(searchSimpleNameToIgnoreVisitor); compilationUnit.accept(searchQualifiedNamesVisitor); rewriteImports(); } ImportPacker(CompilationUnit compilationUnit); void pack(); }
ImportPacker { public void pack() { compilationUnit.accept(searchImportStatementVisitor); compilationUnit.accept(searchSimpleNameToIgnoreVisitor); compilationUnit.accept(searchQualifiedNamesVisitor); rewriteImports(); } ImportPacker(CompilationUnit compilationUnit); void pack();  }