SeyrenRepository { public void updateSubscription(final Subscription subscription, final String alarmId) { restTemplate.put(seyrenUrl + API_ALARMS + "/" + alarmId + "/subscriptions/" + subscription.getId(), subscription, String.class); LOGGER.info("Subscription {} for Alarm {} has been updated.", subscription.getId(), alarmId); }  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 testUpdateSubscription() { Subscription subscription = new Subscription(); subscription.setId("subscriptionId"); doNothing().when(restTemplate).put(anyString(),anyObject(),Matchers.<Class<Object>>any()); repository.updateSubscription(subscription,"alarmId"); verify(restTemplate).put(DEFAULT_SEYREN_URL + SeyrenRepository.API_ALARMS+"/alarmId/subscriptions/subscriptionId", subscription, String.class); }