private String getClassName(ASTCompilationUnit node) { ASTAnyTypeDeclaration classDecl = node.getFirstDescendantOfType(ASTAnyTypeDeclaration.class); if (classDecl == null) { // package-info.java? return null; } if (node.declarationsAreInDefaultPackage()) { return classDecl.getImage(); } importedOnDemand.add(node.getPackageDeclaration().getPackageNameImage()); return classDecl.getQualifiedName().toString(); }
private boolean isJUnit3Class(ASTCompilationUnit node) { ASTClassOrInterfaceDeclaration cid = node.getFirstDescendantOfType(ASTClassOrInterfaceDeclaration.class); if (cid == null) { return false; } if (node.getType() != null && TypeHelper.isA(node, JUNIT3_CLASS_NAME)) { return true; } else if (node.getType() == null) { ASTExtendsList extendsList = cid.getFirstChildOfType(ASTExtendsList.class); if (extendsList == null) { return false; } if (((ASTClassOrInterfaceType) extendsList.jjtGetChild(0)).getImage().endsWith("TestCase")) { return true; } String className = cid.getImage(); return className.endsWith("Test"); } else if (hasImports(node, JUNIT3_CLASS_NAME)) { return cid.getImage().endsWith("Test"); } return false; }
private String getClassName(ASTCompilationUnit node) { ASTAnyTypeDeclaration classDecl = node.getFirstDescendantOfType(ASTAnyTypeDeclaration.class); if (classDecl == null) { // package-info.java? return null; } if (node.declarationsAreInDefaultPackage()) { return classDecl.getImage(); } importedOnDemand.add(node.getPackageDeclaration().getPackageNameImage()); return classDecl.getQualifiedName().toString(); }
private String getClassName(ASTCompilationUnit node) { ASTClassOrInterfaceDeclaration classDecl = node.getFirstDescendantOfType(ASTClassOrInterfaceDeclaration.class); if (classDecl == null) { // Happens if this compilation unit only contains an // enum return null; } if (node.declarationsAreInDefaultPackage()) { return classDecl.getImage(); } ASTPackageDeclaration pkgDecl = node.getPackageDeclaration(); importedOnDemand.add(pkgDecl.getPackageNameImage()); return pkgDecl.getPackageNameImage() + DOT_STRING + classDecl.getImage(); }
private boolean isJUnit3Class(ASTCompilationUnit node) { ASTClassOrInterfaceDeclaration cid = node.getFirstDescendantOfType(ASTClassOrInterfaceDeclaration.class); if (cid == null) { return false; } if (node.getType() != null && TypeHelper.isA(node, JUNIT3_CLASS_NAME)) { return true; } else if (node.getType() == null) { ASTExtendsList extendsList = cid.getFirstChildOfType(ASTExtendsList.class); if (extendsList == null) { return false; } if (((ASTClassOrInterfaceType) extendsList.jjtGetChild(0)).getImage().endsWith("TestCase")) { return true; } String className = cid.getImage(); return className.endsWith("Test"); } else if (hasImports(node, JUNIT3_CLASS_NAME)) { return cid.getImage().endsWith("Test"); } return false; }