SeyrenRepository { public boolean deleteAlarm(final String alarmId) { final ResponseEntity<String> response = restTemplate.exchange(seyrenUrl + API_ALARMS + "/" + alarmId, HttpMethod.DELETE, null, String.class); LOGGER.info("Delete alarm {}. Response {}", alarmId, response.getStatusCode()); return response.getStatusCode().is2xxSuccessful(); }  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 testDeleteAlarm() { ResponseEntity<Object> response = new ResponseEntity(HttpStatus.OK); when(restTemplate.exchange(anyString(), Mockito.<HttpMethod> eq(HttpMethod.DELETE), Mockito.<HttpEntity<?>> any(), Matchers.<Class<Object>>any())).thenReturn(response); assertTrue(repository.deleteAlarm("id")); }