SeyrenRepository { public Alert.Alerts getAlerts(final int start, final int items) { return restTemplate.getForObject(seyrenUrl + API_ALERTS + "?start=" + start + "&items=" + items, Alert.Alerts.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 testGetAlerts() { Alert.Alerts result = new Alert.Alerts(); result.setValues(Arrays.asList(TestUtils.getDefaultAlert(), TestUtils.getDefaultAlert())); when(restTemplate.getForObject(DEFAULT_SEYREN_URL + SeyrenRepository.API_ALERTS + "?start=0&items=10",Alert.Alerts.class)).thenReturn(result); Alert.Alerts alerts = repository.getAlerts(0,10); assertNotNull(alerts); assertTrue(alerts.getValues().size()==result.getValues().size()); assertArrayEquals(result.getValues().toArray(),alerts.getValues().toArray()); }