@Test
public void shouldParseAllEventSources() throws Exception {

    final URL url = getFromClasspath("yaml/event-sources.yaml");
    final List<EventSourceDefinition> eventSourceDefinitions = eventSourcesParser
            .eventSourcesFrom(singletonList(url))
            .collect(toList());
    assertThat(eventSourceDefinitions.size(), is(3));
    final EventSourceDefinition eventSourceDefinition_1 = eventSourceDefinitions.get(0);
    assertThat(eventSourceDefinition_1.getName(), is("default"));
    assertThat(eventSourceDefinition_1.isDefault(), is(true));
    assertThat(eventSourceDefinition_1.getLocation(), is(notNullValue()));
    assertThat(eventSourceDefinition_1.getLocation().getJmsUri(), is("jms:topic:default"));
    assertThat(eventSourceDefinition_1.getLocation().getRestUri(), is(of("http://localhost:8080/default/event-source-api/rest")));
    assertThat(eventSourceDefinition_1.getLocation().getDataSource(), is(of("java:/app/default/DS.eventstore")));
    final EventSourceDefinition eventSourceDefinition_2 = eventSourceDefinitions.get(1);
    assertThat(eventSourceDefinition_2.getName(), is("no-data-source"));
    assertThat(eventSourceDefinition_2.isDefault(), is(false));
    assertThat(eventSourceDefinition_2.getLocation(), is(notNullValue()));
    assertThat(eventSourceDefinition_2.getLocation().getJmsUri(), is("jms:topic:no.data.source"));
    assertThat(eventSourceDefinition_2.getLocation().getRestUri(), is(of("http://localhost:8080/no-data-source/event-source-api/rest")));
    assertThat(eventSourceDefinition_2.getLocation().getDataSource(), is(empty()));
    final EventSourceDefinition eventSourceDefinition_3 = eventSourceDefinitions.get(2);
    assertThat(eventSourceDefinition_3.getName(), is("no-data-source-or-rest-uri"));
    assertThat(eventSourceDefinition_3.isDefault(), is(false));
    assertThat(eventSourceDefinition_3.getLocation(), is(notNullValue()));
    assertThat(eventSourceDefinition_3.getLocation().getJmsUri(), is("jms:topic:no.data.source.or.rest.uri"));
    assertThat(eventSourceDefinition_3.getLocation().getRestUri(), is(empty()));
    assertThat(eventSourceDefinition_3.getLocation().getDataSource(), is(empty()));
}