@Test public void logMessage () { StatsDClient client = Mockito.mock(StatsDClient.class); DataDogNotification notif = new DataDogNotification(client); notif.logNotification(chaosMessage); ArgumentCaptor<String> tagsCaptor = ArgumentCaptor.forClass(String.class); ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class); Event expectedEvent = Event.builder() .withAlertType(Event.AlertType.WARNING) .withTitle(chaosMessage.getTitle()) .withText(chaosMessage.getMessage()) .withSourceTypeName(DataDogNotification.DataDogEvent.SOURCE_TYPE) .build(); verify(client, times(1)).recordEvent(eventCaptor.capture(), tagsCaptor.capture()); List<String> actualTags = tagsCaptor.getAllValues(); actualTags.sort(Comparator.naturalOrder()); assertThat(actualTags, is(expectedTagsMessage)); Event actualEvent = eventCaptor.getValue(); assertEquals(actualEvent.getAggregationKey(), expectedEvent.getAggregationKey()); assertEquals(actualEvent.getAlertType(), expectedEvent.getAlertType()); assertEquals(actualEvent.getTitle(), expectedEvent.getTitle()); assertEquals(actualEvent.getText(), expectedEvent.getText()); assertEquals(actualEvent.getSourceTypeName(), expectedEvent.getSourceTypeName()); }
@Override public void logNotification (ChaosNotification notification) { DataDogEvent dataDogEvent = new DataDogEvent(); send(dataDogEvent.buildFromNotification(notification), dataDogEvent.generateTags(notification)); }
DataDogNotification implements NotificationMethods { @Override public void logNotification (ChaosNotification notification) { DataDogEvent dataDogEvent = new DataDogEvent(); send(dataDogEvent.buildFromNotification(notification), dataDogEvent.generateTags(notification)); } }
DataDogNotification implements NotificationMethods { @Override public void logNotification (ChaosNotification notification) { DataDogEvent dataDogEvent = new DataDogEvent(); send(dataDogEvent.buildFromNotification(notification), dataDogEvent.generateTags(notification)); } DataDogNotification();   DataDogNotification(StatsDClient statsDClient); }
DataDogNotification implements NotificationMethods { @Override public void logNotification (ChaosNotification notification) { DataDogEvent dataDogEvent = new DataDogEvent(); send(dataDogEvent.buildFromNotification(notification), dataDogEvent.generateTags(notification)); } DataDogNotification();   DataDogNotification(StatsDClient statsDClient); @Override void logNotification(ChaosNotification notification); }
DataDogNotification implements NotificationMethods { @Override public void logNotification (ChaosNotification notification) { DataDogEvent dataDogEvent = new DataDogEvent(); send(dataDogEvent.buildFromNotification(notification), dataDogEvent.generateTags(notification)); } DataDogNotification();   DataDogNotification(StatsDClient statsDClient); @Override void logNotification(ChaosNotification notification);  }