### Question:
AlarmClockLogic implements RunnableService { protected String activateAlarm(int alarmNumber) { Alarm a = getAlarm(alarmNumber); if (!a.isActive()) { a.setActive(true); this.alarmStorage.save(a); return this.alarmS + a.getId() + " activated"; } return this.alarmS + alarmNumber + " is already active"; }  String stopRinging(); @Override void start(); @Override void stop();  }### Answer:
@Test protected void testActivateAlarmActive() { List<Alarm> returnedAlarms = createAlarms(3, true); this.alarmNumber = 2; when(this.alarmStorage.getAll()).thenReturn(returnedAlarms); assertThat(this.acl.activateAlarm(2), is("Alarm " + this.alarmNumber + " is already active")); }
@Test protected void testActivateAlarmInactive() { List<Alarm> returnedAlarms = createAlarms(3, false); this.alarmNumber = 2; when(this.alarmStorage.getAll()).thenReturn(returnedAlarms); assertThat(this.acl.activateAlarm(2), is("Alarm " + this.alarmNumber + " activated")); }
@Test protected void testActivateAlarmNotFound() { when(this.alarmStorage.getAll()).thenReturn(createAlarms(3, true)); this.alarmNumber = 4; assertThrows(NoSuchElementException.class, () -> this.acl.activateAlarm(this.alarmNumber)); }