@Test protected void testDeactivateAlarmNotFound() { when(this.alarmStorage.getAll()).thenReturn(createAlarms(3, true)); this.alarmNumber = 4; assertThrows(NoSuchElementException.class, () -> this.acl.deactivateAlarm(this.alarmNumber)); }
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();  }