SeyrenRepository { public Alarm.Alarms getAllAlarms() { return restTemplate.getForObject(seyrenUrl + API_ALARMS, Alarm.Alarms.class); }  void setRestTemplate(final RestTemplate restTemplate); void setSeyrenUrl(final String seyrenUrl); Alarm getAlarm(final String id); Alarm.Alarms getAllAlarms(); void addAlarm(final Alarm alarm); void updateAlarm(final Alarm alarm); boolean deleteAlarm(final String alarmId); void addSubscription(final Subscription subscription, final String alarmId); void updateSubscription(final Subscription subscription, final String alarmId); boolean deleteSubscription(final String alarmId, final String subscriptionId); Alert.Alerts getAlerts(final int start, final int items); Alert.Alerts getAlarmAlerts(final String alarmId, final int start, final int items); static final String API_ALARMS; static final String API_ALERTS; }
@Test public void testGetAllAlarms() { Alarm.Alarms result = new Alarm.Alarms(); result.setValues(Arrays.asList(TestUtils.getDefaultAlarm(), TestUtils.getDefaultAlarm())); when(restTemplate.getForObject(DEFAULT_SEYREN_URL + SeyrenRepository.API_ALARMS,Alarm.Alarms.class)).thenReturn(result); Alarm.Alarms alarms = repository.getAllAlarms(); assertNotNull(alarms); assertTrue(alarms.getValues().size()==result.getValues().size()); assertArrayEquals(result.getValues().toArray(),alarms.getValues().toArray()); }