@Test
 public void testIsDir() {
   assertTrue(SimpleGarbageCollector.isDir("/dir1"));
   assertFalse(SimpleGarbageCollector.isDir("file1"));
   assertFalse(SimpleGarbageCollector.isDir("/dir1/file1"));
   assertFalse(SimpleGarbageCollector.isDir(""));
   assertFalse(SimpleGarbageCollector.isDir(null));
 }
 @Test
 public void testMoveToTrash_UsingTrash_VolMgrFailure() throws Exception {
   Path path = createMock(Path.class);
   expect(volMgr.moveToTrash(path)).andThrow(new FileNotFoundException());
   replay(volMgr);
   assertFalse(gc.archiveOrMoveToTrash(path));
   verify(volMgr);
 }
 @Test
 public void testMoveToTrash_UsingTrash() throws Exception {
   Path path = createMock(Path.class);
   expect(volMgr.moveToTrash(path)).andReturn(true);
   replay(volMgr);
   assertTrue(gc.archiveOrMoveToTrash(path));
   verify(volMgr);
 }
  private void testAlmostOutOfMemory(float freeFactor, boolean expected) {
    Runtime runtime = createMock(Runtime.class);
    expect(runtime.totalMemory()).andReturn(1000L);
    expectLastCall().anyTimes();
    expect(runtime.maxMemory()).andReturn(1000L);
    expectLastCall().anyTimes();
    expect(runtime.freeMemory()).andReturn((long) (freeFactor * 1000.0f));
    expectLastCall().anyTimes();
    replay(runtime);

    assertEquals(expected, SimpleGarbageCollector.almostOutOfMemory(runtime));
  }
 @Test
 public void testInit() throws Exception {
   assertSame(volMgr, gc.getVolumeManager());
   assertSame(instance, gc.getInstance());
   assertEquals(credentials, gc.getCredentials());
   assertTrue(gc.isUsingTrash());
   assertEquals(1000L, gc.getStartDelay());
   assertEquals(2, gc.getNumDeleteThreads());
 }
 @Test
 public void testMoveToTrash_NotUsingTrash() throws Exception {
   systemConfig.set(Property.GC_TRASH_IGNORE.getKey(), "true");
   Path path = createMock(Path.class);
   assertFalse(gc.archiveOrMoveToTrash(path));
 }
 @Test
 public void testConstruction() {
   assertSame(opts, gc.getOpts());
   assertNotNull(gc.getStatus(createMock(TInfo.class), createMock(TCredentials.class)));
 }