### Question:
AlarmClockLogic implements RunnableService { protected Alarm getAlarm(int alarmNumber) { for (Alarm a : this.alarmStorage.getAll()) { if (a.getId() == alarmNumber) { return a; } } throw new NoSuchElementException(); }  String stopRinging(); @Override void start(); @Override void stop();  }### Answer:
@Test protected void testGetAlarm() { when(this.alarmStorage.getAll()).thenReturn(createAlarms(3, true)); this.alarmNumber = 2; Alarm returnedAlarm = this.acl.getAlarm(this.alarmNumber); assertThat(returnedAlarm.getId(), is(2)); }
@Test protected void testGetAlarmNotFound() { when(this.alarmStorage.getAll()).thenReturn(createAlarms(3, true)); this.alarmNumber = 4; assertThrows(NoSuchElementException.class, () -> this.acl.getAlarm(this.alarmNumber)); }