### Question:
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();  }### Answer:
@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")); }
@Test protected void testDeactivateAlarmInactive() { List<Alarm> returnedAlarms = createAlarms(3, false); this.alarmNumber = 2; when(this.alarmStorage.getAll()).thenReturn(returnedAlarms); assertThat(this.acl.deactivateAlarm(2), is("Alarm " + this.alarmNumber + " is already inactive")); }
@Test protected void testDeactivateAlarmNotFound() { when(this.alarmStorage.getAll()).thenReturn(createAlarms(3, true)); this.alarmNumber = 4; assertThrows(NoSuchElementException.class, () -> this.acl.deactivateAlarm(this.alarmNumber)); }