@Test
public void logEventSerializationDelegatesToItemSourceFactory() {

    // given
    JacksonJsonLayout.Builder builder = spy(createDefaultTestBuilder());
    LayoutTestItemSourceFactory itemSourceFactory = spy(new LayoutTestItemSourceFactory());
    builder.withItemSourceFactory(itemSourceFactory);
    JacksonJsonLayout layout = builder.build();
    LogEvent logEvent = new Log4jLogEvent();
    // when
    layout.toSerializable(logEvent);
    // then
    verify(itemSourceFactory).create(eq(logEvent), any(ObjectWriter.class));
}