@Test public void isEnabledByDefault_should_return_the_default_state_of_a_feature() { String feature1 = "feature-5"; String feature2 = "feature-6"; Mockito.doReturn(true).when(defaultStatesMock).containsKey(feature1); Mockito.doReturn(true).when(defaultStatesMock).containsKey(feature2); Mockito.doReturn(false).when(defaultStatesMock).get(feature1); Mockito.doReturn(true).when(defaultStatesMock).get(feature2); boolean stateFeature1 = cut.isEnabledByDefault("feature-5"); boolean stateFeature2 = cut.isEnabledByDefault("feature-6"); Assertions.assertThat(stateFeature1).isFalse(); Assertions.assertThat(stateFeature2).isTrue(); }
public boolean isEnabledByDefault(String code) throws IllegalArgumentException { if (!this.defaultStates.containsKey(code)) { throw new IllegalArgumentException("Unknown code : " + code); } return this.defaultStates.get(code); }
FeatureActivator { public boolean isEnabledByDefault(String code) throws IllegalArgumentException { if (!this.defaultStates.containsKey(code)) { throw new IllegalArgumentException("Unknown code : " + code); } return this.defaultStates.get(code); } }
FeatureActivator { public boolean isEnabledByDefault(String code) throws IllegalArgumentException { if (!this.defaultStates.containsKey(code)) { throw new IllegalArgumentException("Unknown code : " + code); } return this.defaultStates.get(code); }  }
FeatureActivator { public boolean isEnabledByDefault(String code) throws IllegalArgumentException { if (!this.defaultStates.containsKey(code)) { throw new IllegalArgumentException("Unknown code : " + code); } return this.defaultStates.get(code); }  @PostConstruct void load(); void load(FeatureCollection collection); boolean getState(String code); void changeStateOf(String code, boolean newState); boolean isEnabledByDefault(String code); }
FeatureActivator { public boolean isEnabledByDefault(String code) throws IllegalArgumentException { if (!this.defaultStates.containsKey(code)) { throw new IllegalArgumentException("Unknown code : " + code); } return this.defaultStates.get(code); }  @PostConstruct void load(); void load(FeatureCollection collection); boolean getState(String code); void changeStateOf(String code, boolean newState); boolean isEnabledByDefault(String code);  }