AlertService { public void process(Alert alert) { LocalDateTime now = LocalDateTime.now(); Result result = check(alert, now); if (result.notify) { notify(alert, result.alertCountSinceLastSent, now); } } AlertService(AlertConfig config); void process(Alert alert);  }
@Test void processWithIgnoredWarning() { service.process(alert(Severity.WARN, "PATH_NOT_FOUND", "trace")); verifyNoInteractions(slackClient); }
@Test void processWithError() { service.process(alert(Severity.ERROR, "java.lang.NullPointerException", "trace")); verify(slackClient).send(eq("actionErrorChannel"), anyString(), anyString()); }
@Test void processWithProductError() { service.process(alert(Severity.ERROR, "PRODUCT_ERROR", "trace")); verify(slackClient).send(eq("actionErrorChannel"), anyString(), anyString()); verify(slackClient).send(eq("productChannel"), anyString(), anyString()); }
@Test void processWithEventError() { service.process(alert(Severity.ERROR, "EVENT_ERROR", "event")); verify(slackClient).send(eq("eventErrorChannel"), anyString(), anyString()); }