@Test public void sendNotification () throws IOException { slackNotifications.sendNotification(chaosExperimentEvent); ArgumentCaptor<SlackMessage> slackMessageArgumentCaptor = ArgumentCaptor.forClass(SlackMessage.class); verify(slackNotifications, times(1)).sendSlackMessage(slackMessageArgumentCaptor.capture()); SlackMessage actualSlackMessage = slackMessageArgumentCaptor.getValue(); String expectedPayload = mapper.writeValueAsString(expectedSlackEvent); String actualPayload = mapper.writeValueAsString(actualSlackMessage); assertEquals(expectedPayload, actualPayload); }
@Override protected void sendNotification (ChaosNotification chaosNotification) throws IOException { SlackMessage slackMessage = SlackMessage.builder() .withAttachment(createAttachmentFromChaosNotification(chaosNotification)) .build(); sendSlackMessage(slackMessage); }
SlackNotifications extends BufferedNotificationMethod { @Override protected void sendNotification (ChaosNotification chaosNotification) throws IOException { SlackMessage slackMessage = SlackMessage.builder() .withAttachment(createAttachmentFromChaosNotification(chaosNotification)) .build(); sendSlackMessage(slackMessage); } }
SlackNotifications extends BufferedNotificationMethod { @Override protected void sendNotification (ChaosNotification chaosNotification) throws IOException { SlackMessage slackMessage = SlackMessage.builder() .withAttachment(createAttachmentFromChaosNotification(chaosNotification)) .build(); sendSlackMessage(slackMessage); } @Autowired  SlackNotifications(@Value("${slack_webhookuri}") @NotNull String webhookUri); }
SlackNotifications extends BufferedNotificationMethod { @Override protected void sendNotification (ChaosNotification chaosNotification) throws IOException { SlackMessage slackMessage = SlackMessage.builder() .withAttachment(createAttachmentFromChaosNotification(chaosNotification)) .build(); sendSlackMessage(slackMessage); } @Autowired  SlackNotifications(@Value("${slack_webhookuri}") @NotNull String webhookUri); @Override void logNotification(ChaosNotification notification); }
SlackNotifications extends BufferedNotificationMethod { @Override protected void sendNotification (ChaosNotification chaosNotification) throws IOException { SlackMessage slackMessage = SlackMessage.builder() .withAttachment(createAttachmentFromChaosNotification(chaosNotification)) .build(); sendSlackMessage(slackMessage); } @Autowired  SlackNotifications(@Value("${slack_webhookuri}") @NotNull String webhookUri); @Override void logNotification(ChaosNotification notification);  }