### Question:
EnumSetting extends BaseCyclableSetting<T> { @Override public T cycle(T value) { return values[(value.ordinal() + 1) % values.length]; } EnumSetting(String name, T def, String key, T[] values, Function<String, T> fromString); @Override T cycle(T value);  }### Answer:
@Test public void testCycle() { EnumSetting<TestEnum> setting = new EnumSetting<>("test", TestEnum.FOO, "test", TestEnum.values(), TestEnum::fromString); assertThat(setting.cycle(TestEnum.FOO), is(TestEnum.BAR)); assertThat(setting.cycle(TestEnum.BAR), is(TestEnum.BAZ)); assertThat(setting.cycle(TestEnum.BAZ), is(TestEnum.FOO)); }
@Test public void testConfig() { EnumSetting<TestEnum> setting = new EnumSetting<>("test", TestEnum.FOO, "test", TestEnum.values(), TestEnum::fromString); Configuration config = new Configuration(new DefaultConfiguration()); assertThat(config.getValue(setting), is(TestEnum.FOO)); config.cycle(setting); assertThat(config.getValue(setting), is(TestEnum.BAR)); config.cycle(setting); assertThat(config.getValue(setting), is(TestEnum.BAZ)); config.cycle(setting); assertThat(config.getValue(setting), is(TestEnum.FOO)); config.setValue(setting, TestEnum.BAZ); assertThat(config.getValue(setting), is(TestEnum.BAZ)); }