JavaQualifiedName implements QualifiedName { @Override public final String toString() { if (toString == null) { toString = buildToString(); } return toString; }  @Override abstract JavaTypeQualifiedName getClassName(); @Deprecated boolean isLocalClass(); @Deprecated String getClassSimpleName(); @Deprecated boolean isUnnamedPackage(); @Deprecated String getOperation(); @Deprecated String[] getPackages(); @Deprecated String[] getClasses(); @Override final boolean equals(Object o); @Override final int hashCode(); @Override final String toString(); @Deprecated static JavaQualifiedName ofString(String name); @Deprecated static JavaQualifiedName ofClass(Class<?> clazz);  }
@Test public void testPackage() { final String TEST = "package foo.bar; class Bzaz{}"; List<ASTClassOrInterfaceDeclaration> nodes = getNodes(ASTClassOrInterfaceDeclaration.class, TEST); for (ASTClassOrInterfaceDeclaration coid : nodes) { JavaTypeQualifiedName qname = coid.getQualifiedName(); assertEquals("foo.bar.Bzaz", qname.toString()); assertEquals(2, qname.getPackageList().size()); assertEquals(1, qname.getClassList().size()); } }
@Test public void testNestedClass() { final String TEST = "package foo.bar; class Bzaz{ class Bor{ class Foo{}}}"; List<ASTClassOrInterfaceDeclaration> nodes = getNodes(ASTClassOrInterfaceDeclaration.class, TEST); for (ASTClassOrInterfaceDeclaration coid : nodes) { JavaTypeQualifiedName qname = coid.getQualifiedName(); switch (coid.getImage()) { case "Foo": assertEquals("foo.bar.Bzaz$Bor$Foo", qname.toString()); assertEquals(3, qname.getClassList().size()); break; default: break; } } }
@Test public void testNestedEnum() { final String TEST = "package foo.bar; class Foo { enum Bzaz{HOO;}}"; List<ASTEnumDeclaration> nodes = getNodes(ASTEnumDeclaration.class, TEST); for (ASTEnumDeclaration coid : nodes) { JavaTypeQualifiedName qname = coid.getQualifiedName(); assertEquals("foo.bar.Foo$Bzaz", qname.toString()); assertEquals(2, qname.getPackageList().size()); assertEquals(2, qname.getClassList().size()); } }
@Test public void testEnum() { final String TEST = "package foo.bar; enum Bzaz{HOO;}"; List<ASTEnumDeclaration> nodes = getNodes(ASTEnumDeclaration.class, TEST); for (ASTEnumDeclaration coid : nodes) { JavaTypeQualifiedName qname = coid.getQualifiedName(); assertEquals("foo.bar.Bzaz", qname.toString()); assertEquals(2, qname.getPackageList().size()); assertEquals(1, qname.getClassList().size()); } }