ProjectionService implements InitializingBean { Set<Class<?>> getAnnotatedInterfaces(String basePackage) { return typeScanner.findTypes(basePackage).stream() .filter(Class::isInterface) .collect(Collectors.toSet()); } @Autowired  ProjectionService(AnnotatedTypeScanner typeScanner, AnnotationUtilsWrapper annotationUtilsWrapper); Class<?> getByNameOrDefault(@NonNull String projectionName, @NonNull Class<?> projectionTarget); Class<?> getDefault(Class<?> projectionTarget); @Override void afterPropertiesSet();  }
@Test public void getAnnotatedMethodsOnlyReturnsInterfaces() { var expectedBasePackage = "de/test"; var allAnnotatedClasses = Set.of(String.class, Iterable.class, Comparable.class); var expectedReturnedClasses = Set.of(Iterable.class, Comparable.class); given(typeScannerMock.findTypes(expectedBasePackage)).willReturn(allAnnotatedClasses); var actualAnnotatedClasses = projectionService.getAnnotatedInterfaces(expectedBasePackage); assertThat(actualAnnotatedClasses).containsExactlyInAnyOrderElementsOf(expectedReturnedClasses); }