@Test
public void nonMessageOnlyLayout() {

    // given
    ItemAppenderFactory factory = new ItemAppenderFactory();
    String formattedIndexName = UUID.randomUUID().toString();
    BatchDelivery batchDelivery = mock(BatchDelivery.class);
    Layout stringBasedLayout = mock(Layout.class);
    ItemAppender itemAppender = factory.createInstance(false, stringBasedLayout, batchDelivery);
    String expectedMessage = UUID.randomUUID().toString();
    when(stringBasedLayout.toSerializable(any(LogEvent.class))).thenReturn(expectedMessage);
    LogEvent logEvent = createDefaultTestLogEvent();
    // when
    itemAppender.append(formattedIndexName, logEvent);
    // then
    assertTrue(itemAppender instanceof StringAppender);
    verify(stringBasedLayout).toSerializable(logEventCaptor.capture());
    assertEquals(logEvent, logEventCaptor.getValue());
    verify(batchDelivery).add(indexNameCaptor.capture(), stringLogCaptor.capture());
    assertEquals(formattedIndexName, indexNameCaptor.getValue());
    assertEquals(expectedMessage, stringLogCaptor.getValue());
}