@Test
void check() {

    assertThat(service.check(alert(Severity.ERROR, "CRITICAL_ERROR", "trace"), LocalDateTime.now()).notify).isTrue();
    assertThat(service.check(alert(Severity.WARN, "SLOW_SQL", "trace"), LocalDateTime.now()).notify).isTrue();
    Alert alert = alert(Severity.ERROR, "ERROR", "trace");
    LocalDateTime date = LocalDateTime.now();
    AlertService.Result result = service.check(alert, date);
    assertThat(result).matches(r -> r.notify && r.alertCountSinceLastSent == -1);
    result = service.check(alert, date.plusMinutes(30));
    assertThat(result).matches(r -> !r.notify);
    result = service.check(alert, date.plusHours(4));
    assertThat(result).matches(r -> r.notify && r.alertCountSinceLastSent == 1);
}