AlertService { String color(Severity severity, LocalDateTime now) { int week = now.get(IsoFields.WEEK_OF_WEEK_BASED_YEAR); int colorIndex = severity == Severity.WARN ? 0 : 1; return colors[colorIndex][(week - 1) % 2]; } AlertService(AlertConfig config); void process(Alert alert);  }
@Test void color() { LocalDateTime date = LocalDateTime.of(2020, 1, 1, 0, 0, 0); assertThat(service.color(Severity.WARN, date)).isEqualTo("#ff5c33"); assertThat(service.color(Severity.WARN, date.plusWeeks(1))).isEqualTo("#ff9933"); assertThat(service.color(Severity.ERROR, date)).isEqualTo("#a30101"); assertThat(service.color(Severity.ERROR, date.plusWeeks(1))).isEqualTo("#e62a00"); }