@Test public void testPlainInterface() throws Exception { MetadataReader metadataReader = factory.getMetadataReader("org.test.spring.PlainInterface"); ClassMetadata metadata = metadataReader.getClassMetadata(); assertEquals("org.test.spring.PlainInterface", metadata.getClassName()); assertEquals(0, metadata.getInterfaceNames().length); assertFalse(metadata.hasEnclosingClass()); assertNull(metadata.getEnclosingClassName()); assertTrue(metadata.hasSuperClass()); assertEquals("java.lang.Object", metadata.getSuperClassName()); }
@Test public void testSubtypeOfGenericSupertype() throws Exception { MetadataReader metadataReader = factory.getMetadataReader("org.test.spring.GenericSubtype"); ClassMetadata metadata = metadataReader.getClassMetadata(); assertEquals("org.test.spring.GenericSubtype", metadata.getClassName()); assertEquals(0, metadata.getInterfaceNames().length); assertFalse(metadata.hasEnclosingClass()); assertNull(metadata.getEnclosingClassName()); assertTrue(metadata.hasSuperClass()); assertEquals("org.test.spring.GenericSupertype", metadata.getSuperClassName()); }
@Test public void testSubClassOfBinaryType() throws Exception { MetadataReader metadataReader = factory.getMetadataReader("org.test.spring.SubClassOfBinaryType"); ClassMetadata metadata = metadataReader.getClassMetadata(); assertEquals("org.test.spring.SubClassOfBinaryType", metadata.getClassName()); assertEquals(0, metadata.getInterfaceNames().length); assertFalse(metadata.hasEnclosingClass()); assertNull(metadata.getEnclosingClassName()); assertTrue(metadata.hasSuperClass()); assertEquals("org.springframework.core.SpringVersion", metadata.getSuperClassName()); }
@Test public void testSubClass() throws Exception { MetadataReader metadataReader = factory.getMetadataReader("org.test.spring.SubClassWithoutAnnotation"); ClassMetadata metadata = metadataReader.getClassMetadata(); assertEquals("org.test.spring.SubClassWithoutAnnotation", metadata.getClassName()); assertEquals(0, metadata.getInterfaceNames().length); assertFalse(metadata.hasEnclosingClass()); assertNull(metadata.getEnclosingClassName()); assertTrue(metadata.hasSuperClass()); assertEquals("org.test.spring.SimpleConfigurationClass", metadata.getSuperClassName()); }
@Test public void testSimpleClass() throws Exception { MetadataReader metadataReader = factory.getMetadataReader("org.test.spring.NoAnnotations"); ClassMetadata metadata = metadataReader.getClassMetadata(); assertEquals("org.test.spring.NoAnnotations", metadata.getClassName()); assertEquals(0, metadata.getInterfaceNames().length); assertFalse(metadata.hasEnclosingClass()); assertNull(metadata.getEnclosingClassName()); assertTrue(metadata.hasSuperClass()); assertEquals("java.lang.Object", metadata.getSuperClassName()); assertTrue(metadata instanceof JdtConnectedMetadata); IType type = JdtUtils.getJavaType(project, "org.test.spring.NoAnnotations"); assertEquals(type, ((JdtConnectedMetadata) metadata).getJavaElement()); }