### Question:
StringUtils { public static <E extends Enum<E>> E parseEnum(final String s, final Class<E> enumClass) { final String t = s.trim().toUpperCase().replace(' ', '_'); if (t.isEmpty()) { return null; } try { return Enum.valueOf(enumClass, t); } catch (final IllegalArgumentException e) { final String errorMessage = String.format("Value is not a valid enum %s : value -> [%s]", enumClass.getSimpleName(), t); throw new ValidationException(errorMessage); } }  static String replaceSubstring(final String s, final int startIndex, final int endIndex,
            final String replacement); static List<E> parseListEnums(final String s, final Class<E> enumClass); static E parseEnum(final String s, final Class<E> enumClass); static E fromValue(final Class<E> enumClass, final String value); static String join(final List<String> substrings, final String join); static String join(final List<String> substrings); static boolean containsPattern(final String string, final String pattern); static boolean containsPattern(final String string, final Pattern pattern);  }### Answer:
@Test public void shouldParseEnum_withStringAndEnumClass() { final String s = "value TWO"; final Class<TestEnum> enumClass = TestEnum.class; final TestEnum result = StringUtils.parseEnum(s, enumClass); assertEquals(TestEnum.VALUE_TWO, result); }
@Test public void shouldParseEnumAsNull_withBlankString() { final String s = " "; final Class<TestEnum> enumClass = TestEnum.class; final TestEnum result = StringUtils.parseEnum(s, enumClass); assertNull(result); }
@Test public void shouldNotParseEnum_withUnknownStringValue() { final String s = "unknown"; final Class<TestEnum> enumClass = TestEnum.class; ValidationException thrownException = null; try { StringUtils.parseEnum(s, enumClass); } catch (final ValidationException e) { thrownException = e; } assertNotNull(thrownException); }