@Test
public void nonMessageOnlyItemSourceLayout() {

    // given
    ItemAppenderFactory factory = new ItemAppenderFactory();
    String formattedIndexName = UUID.randomUUID().toString();
    BatchDelivery batchDelivery = mock(BatchDelivery.class);
    ItemSourceLayout itemSourceLayout = spy(new TestItemSourceLayout());
    ItemSourceAppender itemAppender = factory.createInstance(false, itemSourceLayout, batchDelivery);
    String expectedMessage = UUID.randomUUID().toString();
    ItemSource itemSource = new StringItemSource(expectedMessage);
    when(itemSourceLayout.serialize(any(LogEvent.class))).thenReturn(itemSource);
    LogEvent logEvent = createDefaultTestLogEvent();
    // when
    itemAppender.append(formattedIndexName, logEvent);
    // then
    assertEquals(ItemSourceAppender.class, itemAppender.getClass());
    verify(itemSourceLayout).serialize(logEventCaptor.capture());
    assertEquals(logEvent, logEventCaptor.getValue());
    verify(batchDelivery).add(indexNameCaptor.capture(), itemSourceCaptor.capture());
    assertEquals(formattedIndexName, indexNameCaptor.getValue());
    assertEquals(expectedMessage, itemSourceCaptor.getValue().getSource());
}