@Test
public void createFailureIsHandled() throws IOException {

    // given
    StringItemSourceFactory factory = createDefaultTestStringItemSourceFactory();
    LogEvent logEvent = mock(LogEvent.class);
    ObjectWriter objectWriter = spy(new ObjectMapper().writerFor(LogEvent.class));
    doThrow(JsonMappingException.fromUnexpectedIOE(new IOException("test exception"))).when(objectWriter).writeValueAsString(eq(logEvent));
    // when
    ItemSource itemSource = factory.create(logEvent, objectWriter);
    // then
    assertNull(itemSource);
}