@Test
public void lifecycleStopDoesntInteractWithAbstractLayout() {

    // given
    StringAppender mockItemAppender = mock(StringAppender.class);
    when(mockItemAppender.isStopped()).thenAnswer(LifecycleTestHelper.falseOnlyOnce());
    ItemAppenderFactory itemAppenderFactory = new ItemAppenderFactory() {
        @Override
        public ItemAppender createInstance(boolean messageOnly, Layout layout, BatchDelivery batchDelivery) {
            return mockItemAppender;
        }
    };
    AbstractLayout abstractLayout = mock(AbstractLayout.class);
    TestElasticsearchAppender appender = createTestElasticsearchAppender(itemAppenderFactory, abstractLayout);
    // when
    appender.stop(0, TimeUnit.MILLISECONDS);
    // then
    assertTrue(mockingDetails(abstractLayout).getInvocations().size() == 0);
    assertFalse(appender.isStarted());
    assertTrue(appender.isStopped());
}