### Question:
EnumSetting extends Setting<T> { @Override public T read(String string) throws InvalidConfigException { for (T enumValue : enumValues) { if (enumValue.name().equalsIgnoreCase(string)) { return enumValue; } } throw new InvalidConfigException(string + " is not an acceptable value"); } EnumSetting(String name, T defaultValue); @Override T getDefaultValue(); @Override T read(String string);  }### Answer:
@Test public void testCaseInsensitivity() throws InvalidConfigException { EnumSetting<ConfigMode> setting = new EnumSetting<ConfigMode>("TestSetting", ConfigMode.WriteAll); for (ConfigMode configMode : ConfigMode.values()) { ConfigMode readBack = setting.read(configMode.name().toUpperCase()); assertEquals(configMode, readBack); } }
@Test(expected = InvalidConfigException.class) public void testInvalidEnumSetting() throws InvalidConfigException { new EnumSetting<ConfigMode>("TestSetting", ConfigMode.WriteAll).read("InvalidOption"); }