@Test public void isEnabledByDefault_should_throw_exception_if_not_found() { String feature1 = "feature-7"; Mockito.doReturn(false).when(defaultStatesMock).containsKey(feature1); assertThrows(IllegalArgumentException.class, () -> cut.isEnabledByDefault("feature-7")); }
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);  }