### Question:
StringUtils { public static String toEnumConstant(String value) { if (ENUM_CONSTANT_VALUE_OVERRIDES.get(value) != null) { return ENUM_CONSTANT_VALUE_OVERRIDES.get(value); } StringBuilder sb = new StringBuilder(); for (int i = 0; i < value.length(); i++) { char c = value.charAt(i); if ((Character.isUpperCase(c) && i > 0 && Character.isLowerCase(value.charAt(i - 1))) || (Character.isDigit(c) && i > 0 && Character.isLetter(value.charAt(i - 1))) || (Character.isUpperCase(c) && i > 1 && i < value.length() - 1 && Character.isUpperCase(value.charAt(i - 1))) && Character.isLowerCase(value.charAt(i + 1))) { sb.append("_"); } if (Character.isLetterOrDigit(c)) { sb.append(Character.toUpperCase(c)); } else { sb.append("_"); } } return sb.toString(); }  static String toEnumConstant(String value); static String buildPackageName(
      String basePackageName, String packageName, String... subPackageNames); static String capitalize(String value); static String toEnumClass(String value); static String getReturnTypeFromGetter(String getterName);  }### Answer:
@Test public void testToEnumConstant() { assertEquals("ENUM_CONSTANT", StringUtils.toEnumConstant("enum_constant")); assertEquals("ENUM_CONSTANT", StringUtils.toEnumConstant("enumConstant")); assertEquals("ENUM_CONSTANT", StringUtils.toEnumConstant("Enum-Constant")); assertEquals("ENUM_CONSTANT_123", StringUtils.toEnumConstant("Enum-Constant123")); assertEquals("DOM_CONSTANT", StringUtils.toEnumConstant("DOMConstant")); assertEquals("DOM_CONSTANT", StringUtils.toEnumConstant("DOM*Constant")); assertEquals("NAN", StringUtils.toEnumConstant("NaN")); assertEquals("NEGATIVE_INFINITY", StringUtils.toEnumConstant("-Infinity")); assertEquals("NEGATIVE_0", StringUtils.toEnumConstant("-0")); }