.withTimestamp(new DateTime())
.withFromType(AlertType.OK)
.withToType(AlertType.ERROR);
List<Alert> alerts = Arrays.asList(alert);
StringBodyCapture bodyCapture = new StringBodyCapture();
clientDriver.addExpectation(
onRequestTo("/api/chat.postMessage")
.withMethod(ClientDriverRequest.Method.POST)
.capturingBodyIn(bodyCapture)
.withHeader("accept", "application/json"),
giveEmptyResponse());
notificationService.sendNotification(check, subscription, alerts);
String content = bodyCapture.getContent();
assertThat(content, Matchers.containsString("token="));
assertThat(content, Matchers.containsString("&channel=target"));
assertThat(content, Matchers.containsString(encode("test-check has entered its ERROR state - [null: 1.0]")));
assertThat(content, Matchers.containsString(encode("/#/checks/123")));