@Test public void changeStateOf_should_erase_and_not_flip() { String feature1 = "feature-4"; Mockito.doReturn(true).when(currentStateMock).containsKey(feature1); cut.changeStateOf(feature1, false); Mockito.verify(currentStateMock).put(feature1, false); }
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);  }