Search in sources :

Example 1 with Event

use of com.thoughtworks.gocd.elasticagent.ecs.events.Event in project gocd-ecs-elastic-agent by gocd.

the class PluginStatusReportViewTest method assertEventStreamView.

private void assertEventStreamView(String view, String type, List<Event> events) {
    final Document document = Jsoup.parse(view);
    final Elements errorHeaders = document.select(format(".event-stream .%s.event .event-header", type));
    final Elements errorDescriptions = document.select(format(".event-stream .%s.event .event-description", type));
    assertThat(errorHeaders).hasSameSizeAs(errorDescriptions).hasSameSizeAs(events);
    IntStream.range(0, events.size()).forEach(index -> {
        Event error = events.get(index);
        assertThat(errorHeaders.get(index).text()).isEqualTo(error.getMessage());
        assertThat(errorDescriptions.get(index).text()).isEqualTo(error.getDescription());
    });
}
Also used : Event(com.thoughtworks.gocd.elasticagent.ecs.events.Event) Document(org.jsoup.nodes.Document) Elements(org.jsoup.select.Elements)

Aggregations

Event (com.thoughtworks.gocd.elasticagent.ecs.events.Event)1 Document (org.jsoup.nodes.Document)1 Elements (org.jsoup.select.Elements)1