@Test
public void throwsWhenCreateEmptySourceCantGetPooledElement() throws PoolResourceException {

    // given
    ItemSourcePool mockedPool = mock(ItemSourcePool.class);
    String expectedMessage = UUID.randomUUID().toString();
    when(mockedPool.getPooled()).thenThrow(new PoolResourceException(expectedMessage));
    PooledItemSourceFactory pooledItemSourceFactory = new PooledItemSourceFactory(mockedPool);
    expectedException.expect(IllegalStateException.class);
    expectedException.expectMessage(expectedMessage);
    // when
    pooledItemSourceFactory.createEmptySource();
}