### Question:
BeanDefinitions { public static Map<String, Object> extractQualifiers(BeanDefinition beanDefinition) { Map<String, Object> qualifiers = new LinkedHashMap<>(); if (beanDefinition instanceof AnnotatedBeanDefinition) { MethodMetadata factoryMethodMetadata = ((AnnotatedBeanDefinition) beanDefinition).getFactoryMethodMetadata(); if (factoryMethodMetadata instanceof MethodMetadataReadingVisitor) { Map<String, Object> qualityQualifiers = listQualityQualifiers((MethodMetadataReadingVisitor) factoryMethodMetadata); qualifiers.putAll(qualityQualifiers); } else if (factoryMethodMetadata instanceof StandardMethodMetadata) { Map<String, Object> qualityQualifiers = listQualityQualifiers((StandardMethodMetadata) factoryMethodMetadata); qualifiers.putAll(qualityQualifiers); } Map<String, Object> annotationAttributes = factoryMethodMetadata.getAnnotationAttributes(QUALIFIER_CLASS_NAME); if (annotationAttributes != null) { Object qualifierValue = annotationAttributes.get(VALUE_KEY); if (!"".equals(qualifierValue)) { qualifiers.put(QUALIFIER_CLASS_NAME, qualifierValue); } } } return qualifiers; } private  BeanDefinitions(); static Class<?> extractClass(AbstractBeanDefinition beanDefinition); static Map<String, Object> extractQualifiers(BeanDefinition beanDefinition);  }### Answer:
@Test void extractQualifier_for_simple_qualifier() { ApplicationContext context = new AnnotationConfigApplicationContext(TestConfiguration.class); BeanDefinition beanDefinition = ((AnnotationConfigApplicationContext) context).getBeanDefinition("test1_serializable"); Map<String, Object> qualifiers = BeanDefinitions.extractQualifiers(beanDefinition); assertThat(qualifiers).containsOnly(MapEntry.entry(Qualifier.class.getName(), "test1")); }
@Test void extractQualifier_for_scanned_quality_qualifier() { ApplicationContext context = new AnnotationConfigApplicationContext(TestConfiguration.class); BeanDefinition beanDefinition = ((AnnotationConfigApplicationContext) context).getBeanDefinition("test2_serializable"); Map<String, Object> qualifiers = BeanDefinitions.extractQualifiers(beanDefinition); assertThat(qualifiers).containsOnly(MapEntry.entry(Platform.class.getName(), Platform.OperatingSystems.IOS)); }
@Test void extractQualifier_for_read_quality_qualifier() { ApplicationContext context = new AnnotationConfigApplicationContext(TestConfiguration.class); BeanDefinition beanDefinition = ((AnnotationConfigApplicationContext) context).getBeanDefinition("test3_serializable"); Map<String, Object> qualifiers = BeanDefinitions.extractQualifiers(beanDefinition); assertThat(qualifiers).containsOnly(MapEntry.entry(Platform.class.getName(), Platform.OperatingSystems.ANDROID)); }