@Test
public void appenderUsesProvidedLayoutWhenMessageOnlyIsSetToFalse() {

    // given
    Layout layout = PowerMockito.mock(Layout.class);
    ElasticsearchAppender.Builder builder = ElasticsearchAppenderTest.createTestElasticsearchAppenderBuilder();
    builder.withMessageOnly(false);
    builder.withLayout(layout);
    LogEvent logEvent = mock(LogEvent.class);
    ElasticsearchAppender appender = builder.build();
    // when
    appender.append(logEvent);
    // then
    ArgumentCaptor<LogEvent> captor = ArgumentCaptor.forClass(LogEvent.class);
    verify(layout, times(1)).toSerializable(captor.capture());
    assertEquals(logEvent, captor.getValue());
}