@Test
public void throwsWhenResizePolicyDoesNotResize() throws PoolResourceException {

    // given
    ResizePolicy resizePolicy = mock(ResizePolicy.class);
    when(resizePolicy.increase(any())).thenReturn(false);
    ByteBufPooledObjectOps pooledObjectOps = new ByteBufPooledObjectOps(
            byteBufAllocator,
            DEFAULT_TEST_ITEM_SIZE_IN_BYTES) {
    };
    GenericItemSourcePool<ByteBuf> pool = spy(new GenericItemSourcePool<>(
            DEFAULT_TEST_ITEM_POOL_NAME,
            pooledObjectOps,
            resizePolicy,
            0,
            false,
            DEFAULT_TEST_MONITOR_TASK_INTERVAL,
            0
    ));
    expectedException.expect(PoolResourceException.class);
    expectedException.expectMessage("Unable to resize. Creation of ItemSource was unsuccessful");
    // when
    pool.getPooled();
}