test_class.declarator: converter = new StringToEnumConverter()
test_class.original_string: StringToEnumConverter converter = new StringToEnumConverter();
test_class.type: StringToEnumConverter
test_class.var_name: converter
test_class.file: beanmother-core/src/test/java/io/beanmother/core/converter/std/StringToEnumConverterTest.java
test_class.identifier: StringToEnumConverterTest
test_case.body: @Test
      public void testConvert() {
          assertEquals(TestEnum.CONVERTER, converter.convert("CONVERTER", TypeToken.of(TestEnum.class)));
          assertEquals(TestEnum.CONVERTER, converter.convert("converter", TypeToken.of(TestEnum.class)));
  
          assertEquals(TestEnum.SCRIPT_PROCESSOR, converter.convert("SCRIPT_PROCESSOR", TypeToken.of(TestEnum.class)));
          assertEquals(TestEnum.SCRIPT_PROCESSOR, converter.convert("script processor", TypeToken.of(TestEnum.class)));
          assertEquals(TestEnum.SCRIPT_PROCESSOR, converter.convert("script-processor", TypeToken.of(TestEnum.class)));
      }
test_case.class_method_signature: StringToEnumConverterTest.testConvert()
test_case.full_signature: @Test public void testConvert()
test_case.identifier: testConvert
test_case.invocations: assertEquals convert of assertEquals convert of assertEquals convert of assertEquals convert of assertEquals convert of
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testConvert()
focal_class.file: beanmother-core/src/main/java/io/beanmother/core/converter/std/StringToEnumConverter.java
focal_class.identifier: StringToEnumConverter
focal_class.class_method_signature: StringToEnumConverter.convert(Object source, TypeToken<?> targetTypeToken)
focal_class.full_signature: @SuppressWarnings("unchecked") @Override public Object convert(Object source, TypeToken<?> targetTypeToken)
focal_class.identifier: convert
focal_class.modifiers: @SuppressWarnings("unchecked") @Override public
focal_class.parameters: (Object source, TypeToken<?> targetTypeToken)
focal_class.return: Object
focal_class.signature: Object convert(Object source, TypeToken<?> targetTypeToken)
focal_class.class_method_signature: StringToEnumConverter.canHandle(Object source, TypeToken<?> targetTypeToken)
focal_class.full_signature: @Override public boolean canHandle(Object source, TypeToken<?> targetTypeToken)
focal_class.identifier: canHandle
focal_class.modifiers: @Override public
focal_class.parameters: (Object source, TypeToken<?> targetTypeToken)
focal_class.return: boolean
focal_class.signature: boolean canHandle(Object source, TypeToken<?> targetTypeToken)
focal_class.superclass: extends AbstractConverter
focal_method.body: @SuppressWarnings("unchecked")
      @Override
      public Object convert(Object source, TypeToken<?> targetTypeToken) {
          if (!canHandle(source, targetTypeToken)) throw new ConverterException(source, targetTypeToken.getRawType());
  
          Class enumClass = targetTypeToken.getRawType();
          for (Object enumConstant : enumClass.getEnumConstants()) {
              String enumStr = enumConstant.toString().replaceAll("\\_", "");
              String sourceStr = ((String) source).replaceAll("\\-", "").replaceAll("\\_", "").replaceAll("\\s", "");
              if (enumStr.equalsIgnoreCase(sourceStr)) {
                  return Enum.valueOf(enumClass, enumConstant.toString());
              }
          }
  
          throw new ConverterException(source, targetTypeToken.getRawType(), "can not find enum constants");
      }
focal_method.class_method_signature: StringToEnumConverter.convert(Object source, TypeToken<?> targetTypeToken)
focal_method.full_signature: @SuppressWarnings("unchecked") @Override public Object convert(Object source, TypeToken<?> targetTypeToken)
focal_method.identifier: convert
focal_method.invocations: canHandle getRawType getRawType getEnumConstants replaceAll toString replaceAll replaceAll replaceAll equalsIgnoreCase valueOf toString getRawType
focal_method.modifiers: @SuppressWarnings("unchecked") @Override public
focal_method.parameters: (Object source, TypeToken<?> targetTypeToken)
focal_method.return: Object
focal_method.signature: Object convert(Object source, TypeToken<?> targetTypeToken)