### Question:
AspectAnnotationReader { public static List<LinkkiAspectDefinition> createAspectDefinitionsFor(AnnotatedElement annotatedElement) { return getAllAnnotations(annotatedElement) .map(a -> AspectAnnotationReader.createAspectDefinitionsFrom(a)) .flatMap(Collection::stream) .collect(Collectors.toList()); } private  AspectAnnotationReader(); static List<LinkkiAspectDefinition> createAspectDefinitionsFrom(
            UI_ANNOTATION uiAnnotation); static List<LinkkiAspectDefinition> createAspectDefinitionsFor(AnnotatedElement annotatedElement); static List<LinkkiAspectDefinition> createAspectDefinitionsFor(Annotation componentDefAnnotation,
            AnnotatedElement annotatedElement);  }### Answer:
@Test public void testCreateAspectDefinitionsFor() throws NoSuchMethodException, SecurityException { AnnotatedElement annotatedElement = TestClass.class.getMethod("somethingElse"); List<LinkkiAspectDefinition> definitions = AspectAnnotationReader .createAspectDefinitionsFor(annotatedElement); assertThat(definitions.size(), is(3)); LinkkiAspectDefinition definition = definitions.get(0); assertThat(definition, is(instanceOf(TestAspectDefinition.class))); assertThat(definition, isInitializedWith(TestAnnotation.class)); LinkkiAspectDefinition anotherDefinition = definitions.get(1); assertThat(anotherDefinition, is(instanceOf(AnotherTestAspectDefinition.class))); assertThat(anotherDefinition, isInitializedWith(TestAnnotation.class)); LinkkiAspectDefinition definitionFromSecondAnnotation = definitions.get(2); assertThat(definitionFromSecondAnnotation, is(instanceOf(TestAspectDefinition.class))); assertThat(definitionFromSecondAnnotation, isInitializedWith(AnotherTestAnnotation.class)); }
@Test public void testCreateAspectDefinitionsFor_Dynamic() throws NoSuchMethodException, SecurityException { class DynamicFieldTestPmo { @TestComponentAnnotation1(position = 10) @TestComponentAnnotation2(position = 10) @AnotherTestAnnotation @SuppressFBWarnings("UMAC_UNCALLABLE_METHOD_OF_ANONYMOUS_CLASS") public String getDynamic() { return "dyn"; } } AnnotatedElement annotatedElement = DynamicFieldTestPmo.class.getMethod("getDynamic"); List<LinkkiAspectDefinition> definitions = AspectAnnotationReader .createAspectDefinitionsFor(annotatedElement.getAnnotation(TestComponentAnnotation1.class), annotatedElement); assertThat(definitions.size(), is(2)); assertThat(definitions.get(0), is(instanceOf(TestAspectDefinition.class))); assertThat(definitions.get(0), isInitializedWith(TestComponentAnnotation1.class)); assertThat(definitions.get(1), is(instanceOf(TestAspectDefinition.class))); assertThat(definitions.get(1), isInitializedWith(AnotherTestAnnotation.class)); definitions = AspectAnnotationReader .createAspectDefinitionsFor(annotatedElement.getAnnotation(TestComponentAnnotation2.class), annotatedElement); assertThat(definitions.size(), is(2)); assertThat(definitions.get(0), is(instanceOf(YetAnotherTestAspectDefinition.class))); assertThat(definitions.get(0), isInitializedWith(TestComponentAnnotation2.class)); assertThat(definitions.get(1), is(instanceOf(TestAspectDefinition.class))); assertThat(definitions.get(1), isInitializedWith(AnotherTestAnnotation.class)); }