@Test
public void createWritesItemSource() throws IOException, PoolResourceException {

    // given
    ItemSourcePool mockedPool = mock(ItemSourcePool.class);
    ByteBuf byteBuf = createDefaultTestByteBuf();
    ItemSource<ByteBuf> bufferedItemSource = new ByteBufItemSource(byteBuf, source -> {});
    when(mockedPool.getPooled()).thenReturn(bufferedItemSource);
    PooledItemSourceFactory pooledItemSourceFactory = new PooledItemSourceFactory(mockedPool);
    LogEvent logEvent = mock(LogEvent.class);
    ObjectWriter objectWriter = spy(new ObjectMapper().writerFor(LogEvent.class));
    // when
    pooledItemSourceFactory.create(logEvent, objectWriter);
    // then
    verify(objectWriter).writeValue(any(OutputStream.class), eq(logEvent));
}