@Test public void turnNextLightOn() { model.turnNextLightOn(); List<Light> lights = model.lights(); assertTrue("Light should be on", lights.get(0).isOn()); assertFalse("Light should be off", lights.get(1).isOn()); assertFalse("Light should be off", lights.get(2).isOn()); model.turnNextLightOn(); lights = model.lights(); assertTrue("Light should be on", lights.get(0).isOn()); assertTrue("Light should be on", lights.get(1).isOn()); assertFalse("Light should be off", lights.get(2).isOn()); model.turnNextLightOn(); lights = model.lights(); assertTrue("Light should be on", lights.get(0).isOn()); assertTrue("Light should be on", lights.get(1).isOn()); assertTrue("Light should be on", lights.get(2).isOn()); }
public void turnNextLightOn() { Light light = findFirstLightOff(); if(light != null) light.turnOn(); }
GaugeButtonModel extends DefaultButtonModel { public void turnNextLightOn() { Light light = findFirstLightOff(); if(light != null) light.turnOn(); } }
GaugeButtonModel extends DefaultButtonModel { public void turnNextLightOn() { Light light = findFirstLightOff(); if(light != null) light.turnOn(); } GaugeButtonModel(int numberOfLights); }
GaugeButtonModel extends DefaultButtonModel { public void turnNextLightOn() { Light light = findFirstLightOff(); if(light != null) light.turnOn(); } GaugeButtonModel(int numberOfLights); List<Light> lights(); void turnNextLightOn(); boolean areAllLightsOn(); void turnAllLightsOff(); }
GaugeButtonModel extends DefaultButtonModel { public void turnNextLightOn() { Light light = findFirstLightOff(); if(light != null) light.turnOn(); } GaugeButtonModel(int numberOfLights); List<Light> lights(); void turnNextLightOn(); boolean areAllLightsOn(); void turnAllLightsOff();  }