public void testAcquireWhenAnEntryIsPooled() throws Exception { BufferedImage image = pool.acquire(dimension); pool.recycle(image); BufferedImage acquired = pool.acquire(dimension); assertSame(acquired, image); }
public void testClean() throws Exception { pool = new BufferedImagePool(-1); BufferedImage image = pool.acquire(dimension); pool.recycle(image); pool.clean(); assertNotSame(image, pool.acquire(dimension)); }
public void testCanRecycleNullWithoutHarm() throws Exception { try { pool.recycle(null); } catch (Exception e) { fail("shouldn't raise exception"); } }
public void testAcquireWhenNoneExists() throws Exception { BufferedImage image = pool.acquire(dimension); assertEquals(100, image.getWidth()); assertEquals(200, image.getHeight()); assertEquals(BufferedImage.TYPE_INT_ARGB, image.getType()); }
public void testEntryDuration() throws Exception { assertEquals(1, pool.getTimeoutSeconds(), 1); }