SpaceListManager implements Runnable { public void run() { while (!complete) { for (String spaceName : spaces) { while (!retrieveSpaceList(spaceName)) { sleep(1000); } } shutdown(); } } SpaceListManager(ContentStore contentStore,
                            File contentDir,
                            List<String> spaces,
                            boolean overwrite,
                            int threads); void run(); void shutdown(); boolean isComplete();  }
@Test public void testCountFilesCreated() throws Exception { List<String> emptyList = Collections.emptyList(); ContentStore contentStore = EasyMock.createMock(ContentStore.class); EasyMock.expect(contentStore.getStorageProviderType()).andReturn("mock-provider").times(3); EasyMock.expect(contentStore.getSpaceContents("space1")).andReturn(emptyList.iterator()); EasyMock.expect(contentStore.getSpaceContents("space2")).andReturn(emptyList.iterator()); EasyMock.expect(contentStore.getSpaceContents("space3")).andReturn(emptyList.iterator()); EasyMock.replay(contentStore); List<String> spaces = new ArrayList<String>(); spaces.add("space1"); spaces.add("space2"); spaces.add("space3"); SpaceListManager mgr = new SpaceListManager(contentStore, tempDir, spaces, true, 1); mgr.run(); assertTrue(tempDir.exists()); assertEquals(spaces.size(), tempDir.listFiles().length); }