@Test
public void shouldThrowExceptionIfIncorrectJmsUri() throws Exception {

    final URL url = getFromClasspath("yaml/incorrect-event-sources.yaml");
    try {
        eventSourcesParser
                .eventSourcesFrom(singletonList(url))
                .collect(toList());
        fail();
    } catch (final YamlValidationException e) {
        assertThat(e.getCause(), instanceOf(ValidationException.class));
        assertThat(e.getMessage(), containsString("Errors: [#/event_sources/1/location/jms_uri: string [jms:topic:example.event?timeToLive=1000] does not match pattern ^jms:(queue|topic):([a-z|A-Z|-|\\\\.])+$, #/event_sources/0/location/jms_uri: string [jms:topic] does not match pattern ^jms:(queue|topic):([a-z|A-Z|-|\\\\.])+$, #/event_sources/0: required key [name] not found]"));
    }
}