### Question:
MoreMapUtils { public static <T extends Enum<T>> List<T> getListOfEnum( Map<?, ?> map, Object key, List<T> defaultValue, final Class<T> enumClass) { return getList(map, key, defaultValue, new Function<Object, T>() { @Override public T apply(Object input) { if (input == null) { return null; } if (enumClass.isAssignableFrom(input.getClass())) { return enumClass.cast(input); } return Enum.valueOf(enumClass, input.toString().trim().toUpperCase(Locale.ROOT)); } }); } private  MoreMapUtils(); static List<T> getListOfEnum(
      Map<?, ?> map,
      Object key,
      List<T> defaultValue,
      final Class<T> enumClass); static Path getHadoopPath(Map<?, ?> map, Object key, Path defaultValue); static URI getUri(Map<?, ?> map, Object key, URI defaultValue);  }### Answer:
@Test public void listOfEnumSingleStringValue() { Map<?, ?> map = newMap(KEY, ONE.name()); List<MyEnum> actualEnums = MoreMapUtils.getListOfEnum(map, KEY, null, MyEnum.class); List<MyEnum> expectedEnums = Lists.newArrayList(ONE); assertThat(actualEnums, is(expectedEnums)); }
@Test public void listOfEnumSingleValue() { Map<?, ?> map = newMap(KEY, ONE); List<MyEnum> actualEnums = MoreMapUtils.getListOfEnum(map, KEY, null, MyEnum.class); List<MyEnum> expectedEnums = Lists.newArrayList(ONE); assertThat(actualEnums, is(expectedEnums)); }
@Test public void listOfEnumMultiStringValue() { Map<?, ?> map = newMap(KEY, Lists.newArrayList(ONE.name(), TWO_AND_A_HALF.name())); List<MyEnum> actualEnums = MoreMapUtils.getListOfEnum(map, KEY, null, MyEnum.class); List<MyEnum> expectedEnums = Lists.newArrayList(ONE, TWO_AND_A_HALF); assertThat(actualEnums, is(expectedEnums)); }
@Test public void listOfEnumStringMultiValue() { Map<?, ?> map = newMap(KEY, ONE.name() + ", " + TWO_AND_A_HALF.name()); List<MyEnum> actualEnums = MoreMapUtils.getListOfEnum(map, KEY, null, MyEnum.class); List<MyEnum> expectedEnums = Lists.newArrayList(ONE, TWO_AND_A_HALF); assertThat(actualEnums, is(expectedEnums)); }