AlarmService { public Alarm getAlarm(String id) { return seyrenRepository.getAlarm(id); }  Alarm getAlarm(String id); Collection<Alarm> getAllAlarms(); Alarm subscribeToAAlarm(final Alarm alarm); Alarm searchAlarm(final Alarm alarm); Collection<Alarm> searchAlarmsBySubscriptionTarget(String subTarget); Alarm updateAlarm(final Alarm alarm);  }
@Test public void getAlarm() throws Exception { Alarm alarm = alarmService.getAlarm(TestUtils.DEFAULT_ALARM_ID); assertNotNull(alarm); assertEquals(TestUtils.DEFAULT_ALARM_ID, alarm.getId()); assertEquals(TestUtils.DEFAULT_ALARM_NAME, alarm.getName()); }
@Test public void getNonExistentAlarm() { Alarm alarm = null; try { alarm = alarmService.getAlarm(TestUtils.NONEXISTING_ALARM_ID); fail("Get a nonexistent alarm should throw an exception"); } catch (CerebroException e) { assertNull(alarm); assertEquals(ErrorCode.ALARM_UNKNOWN, e.getErrorCode()); } }