ComponentNameExtractor { public boolean hasComponentAnnotation(final InjectionPoint injectionPoint) { return hasComponentAnnotation(injectionPoint.getMember().getDeclaringClass()); }  String componentFrom(final Class<?> aClass); String componentFrom(final InjectionPoint injectionPoint); boolean hasComponentAnnotation(final InjectionPoint injectionPoint);  }
@Test public void shouldReturnTrueForClassWithComponentAnnotation() throws Exception { assertThat(componentNameExtractor.hasComponentAnnotation(injectionPointWith(ServiceComponentClassLevelAnnotation.class.getDeclaredField(FIELD_NAME))), is(true)); assertThat(componentNameExtractor.hasComponentAnnotation(injectionPointWith(ServiceComponentClassLevelAnnotationMethod.class.getDeclaredMethods()[0])), is(true)); assertThat(componentNameExtractor.hasComponentAnnotation(injectionPointWith(AdapterAnnotation.class.getDeclaredField(FIELD_NAME))), is(true)); assertThat(componentNameExtractor.hasComponentAnnotation(injectionPointWith(DirectAdapterAnnotation.class.getDeclaredField(FIELD_NAME))), is(true)); assertThat(componentNameExtractor.hasComponentAnnotation(injectionPointWith(CustomAdapterAnnotation.class.getDeclaredField(FIELD_NAME))), is(true)); assertThat(componentNameExtractor.hasComponentAnnotation(injectionPointWith(FrameworkComponentClassLevelAnnotation.class.getDeclaredField(FIELD_NAME))), is(true)); assertThat(componentNameExtractor.hasComponentAnnotation(injectionPointWith(CustomServiceClassLevelAnnotation.class.getDeclaredMethods()[0])), is(true)); }
@Test public void shouldReturnFalseForClassWithNoComponentAnnotation() throws Exception { assertThat(componentNameExtractor.hasComponentAnnotation(injectionPointWith(NoAnnotation.class.getDeclaredField(FIELD_NAME))), is(false)); }