### Question:
CEKRequestMappingHandlerMapping implements BeanFactoryAware, InitializingBean { @SuppressWarnings("rawTypes") static Map<Class<? extends CEKHandleConditionMatcherFactory>, Set<Annotation>> extractConditionMatcherFactories(Object beanTypeOrMethod) { Assert.isTrue(beanTypeOrMethod instanceof Class || beanTypeOrMethod instanceof Method, "beanTypeOrMethod should be Class or Method. " + "[beanTypeOrMethod:" + beanTypeOrMethod + "]"); Annotation[] annotations = AnnotationUtils.getAnnotations((AnnotatedElement) beanTypeOrMethod); if (annotations == null || annotations.length == 0) { return Collections.emptyMap(); } return Arrays.stream(annotations) .flatMap(annotation -> searchCEKHandleCondition(annotation).stream()) .collect(groupingBy(annotation -> annotation.annotationType() .getAnnotation(CEKHandleCondition.class) .value(), mapping(Function.identity(), Collectors.toSet()))); }  @Override void afterPropertiesSet();  }### Answer:
@Test public void extractConditionMatcherFactories_Method() throws Exception { Method method = TestHandler.getTestMethod(); Map<Class<? extends CEKHandleConditionMatcherFactory>, Set<Annotation>> conditionMatcherFactories = CEKRequestMappingHandlerMapping.extractConditionMatcherFactories(method); assertThat(conditionMatcherFactories) .containsOnlyKeys(DummyConditionMatcherFactory.class); assertThat(conditionMatcherFactories.get(DummyConditionMatcherFactory.class)) .isEqualTo(AnnotationUtils.getRepeatableAnnotations(method, DummyCondition.class)); assertThat(conditionMatcherFactories.get(DummyConditionMatcherFactory.class)) .isEqualTo(AnnotatedElementUtils.getMergedRepeatableAnnotations(method, DummyCondition.class)); }
@Test public void extractConditionMatcherFactories_BeanType() throws Exception { Map<Class<? extends CEKHandleConditionMatcherFactory>, Set<Annotation>> conditionMatcherFactories = CEKRequestMappingHandlerMapping.extractConditionMatcherFactories(TestHandler.class); assertThat(conditionMatcherFactories) .containsOnlyKeys(ExtensionIdConditionMatcherFactory.class); assertThat(conditionMatcherFactories.get(ExtensionIdConditionMatcherFactory.class)) .containsOnlyOnce(AnnotationUtils.getAnnotation(TestHandler.class, ExtensionIdCondition.class)) .hasSize(1); }