@Test public void shouldCollectEmpty() { UnionAnnotatedElement union = new UnionAnnotatedElement(EMPTY); assertEquals(0, union.getAnnotations().length); assertEquals(0, union.getDeclaredAnnotations().length); assertFalse(union.isAnnotationPresent(XmlRootElement.class)); assertNull(union.getAnnotation(XmlRootElement.class)); }
@Test public void shouldMergeAandB() { UnionAnnotatedElement union = new UnionAnnotatedElement(A, B); assertAnnotationTypes(union.getAnnotations(), XmlRootElement.class, XmlType.class); assertAnnotationTypes(union.getDeclaredAnnotations(), XmlRootElement.class, XmlType.class); assertEquals("root-a", union.getAnnotation(XmlRootElement.class).name()); assertTrue(union.isAnnotationPresent(XmlRootElement.class)); assertTrue(union.isAnnotationPresent(XmlType.class)); }
@Test public void shouldCollectA() { UnionAnnotatedElement union = new UnionAnnotatedElement(A); assertAnnotationTypes(union.getAnnotations(), XmlRootElement.class); assertAnnotationTypes(union.getDeclaredAnnotations(), XmlRootElement.class); assertEquals("root-a", union.getAnnotation(XmlRootElement.class).name()); assertTrue(union.isAnnotationPresent(XmlRootElement.class)); assertFalse(union.isAnnotationPresent(XmlType.class)); assertNull(union.getAnnotation(XmlType.class)); }