@Test protected void testDeactivateAlarmActive() { List<Alarm> returnedAlarms = createAlarms(3, true); this.alarmNumber = 2; when(this.alarmStorage.getAll()).thenReturn(returnedAlarms); assertThat(this.acl.deactivateAlarm(2), is("Alarm " + this.alarmNumber + " deactivated")); }
protected String deactivateAlarm(int alarmNumber) { Alarm a = getAlarm(alarmNumber); if (a.isActive()) { this.alarmbeep.stopBeep(a); a.setActive(false); this.alarmStorage.save(a); return "Alarm " + a.getId() + " deactivated"; } return this.alarmS + alarmNumber + " is already inactive"; }
AlarmClockLogic implements RunnableService { protected String deactivateAlarm(int alarmNumber) { Alarm a = getAlarm(alarmNumber); if (a.isActive()) { this.alarmbeep.stopBeep(a); a.setActive(false); this.alarmStorage.save(a); return "Alarm " + a.getId() + " deactivated"; } return this.alarmS + alarmNumber + " is already inactive"; } }
AlarmClockLogic implements RunnableService { protected String deactivateAlarm(int alarmNumber) { Alarm a = getAlarm(alarmNumber); if (a.isActive()) { this.alarmbeep.stopBeep(a); a.setActive(false); this.alarmStorage.save(a); return "Alarm " + a.getId() + " deactivated"; } return this.alarmS + alarmNumber + " is already inactive"; }  }
AlarmClockLogic implements RunnableService { protected String deactivateAlarm(int alarmNumber) { Alarm a = getAlarm(alarmNumber); if (a.isActive()) { this.alarmbeep.stopBeep(a); a.setActive(false); this.alarmStorage.save(a); return "Alarm " + a.getId() + " deactivated"; } return this.alarmS + alarmNumber + " is already inactive"; }  String stopRinging(); @Override void start(); @Override void stop(); }
AlarmClockLogic implements RunnableService { protected String deactivateAlarm(int alarmNumber) { Alarm a = getAlarm(alarmNumber); if (a.isActive()) { this.alarmbeep.stopBeep(a); a.setActive(false); this.alarmStorage.save(a); return "Alarm " + a.getId() + " deactivated"; } return this.alarmS + alarmNumber + " is already inactive"; }  String stopRinging(); @Override void start(); @Override void stop();  }