@Test public void changeStateOf_should_not_change_state_if_bad_code() { String feature1 = "feature-3"; Mockito.doReturn(false).when(currentStateMock).containsKey(feature1); cut.changeStateOf(feature1, true); Mockito.verify(currentStateMock, Mockito.never()).put(Mockito.anyString(), Mockito.anyBoolean()); }
public void changeStateOf(String code, boolean newState) { if (this.currentStates.containsKey(code)) { log.info("Switching state of {} to {}.", code, newState ? "ENABLED" : "DISABLED"); this.currentStates.put(code, newState); } }
FeatureActivator { public void changeStateOf(String code, boolean newState) { if (this.currentStates.containsKey(code)) { log.info("Switching state of {} to {}.", code, newState ? "ENABLED" : "DISABLED"); this.currentStates.put(code, newState); } } }
FeatureActivator { public void changeStateOf(String code, boolean newState) { if (this.currentStates.containsKey(code)) { log.info("Switching state of {} to {}.", code, newState ? "ENABLED" : "DISABLED"); this.currentStates.put(code, newState); } }  }
FeatureActivator { public void changeStateOf(String code, boolean newState) { if (this.currentStates.containsKey(code)) { log.info("Switching state of {} to {}.", code, newState ? "ENABLED" : "DISABLED"); this.currentStates.put(code, newState); } }  @PostConstruct void load(); void load(FeatureCollection collection); boolean getState(String code); void changeStateOf(String code, boolean newState); boolean isEnabledByDefault(String code); }
FeatureActivator { public void changeStateOf(String code, boolean newState) { if (this.currentStates.containsKey(code)) { log.info("Switching state of {} to {}.", code, newState ? "ENABLED" : "DISABLED"); this.currentStates.put(code, newState); } }  @PostConstruct void load(); void load(FeatureCollection collection); boolean getState(String code); void changeStateOf(String code, boolean newState); boolean isEnabledByDefault(String code);  }