### Question:
DataFileAccessorPool { public synchronized void disposeUnused() { for (Iterator<Pool> iter = pools.values().iterator(); iter.hasNext();) { Pool pool = iter.next(); if (!pool.isUsed()) { pool.dispose(); iter.remove(); } } } DataFileAccessorPool(Journal dataManager); synchronized int size(); synchronized void disposeUnused(); synchronized void close();  }### Answer:
@Test public void disposeUnused() throws Exception { final Journal journal = context.mock(Journal.class); DataFileAccessorPool underTest = new DataFileAccessorPool(journal); context.checking(new Expectations(){{exactly(1).of(journal).getInflightWrites();}}); DataFile dataFile = new DataFile(new File(temporaryFolder.getRoot(), "aa"), 1); underTest.closeDataFileAccessor(underTest.openDataFileAccessor(dataFile)); assertEquals("one in the pool", 1, underTest.size()); underTest.disposeUnused(); assertEquals("0 in the pool", 0, underTest.size()); context.assertIsSatisfied(); }