@Test public void testCreateDeleteFolderDirectly() throws IOException{ MockFile folder = new MockFile("foo"+File.separator+"hello"); Assert.assertFalse(folder.exists()); boolean created = folder.mkdir(); Assert.assertFalse(created); Assert.assertFalse(folder.exists()); created = folder.mkdirs(); Assert.assertTrue(created); Assert.assertTrue(folder.exists()); MockFile file = new MockFile(folder.getAbsoluteFile()+File.separator+"evo"); created = file.createNewFile(); Assert.assertTrue(created); Assert.assertTrue(file.exists()); boolean deleted = folder.delete(); Assert.assertFalse(deleted); Assert.assertTrue(folder.exists()); deleted = file.delete(); Assert.assertTrue(deleted); Assert.assertFalse(file.exists()); deleted = folder.delete(); Assert.assertTrue(deleted); Assert.assertFalse(folder.exists()); }
public boolean exists(String rawPath) { return findFSObject(rawPath) != null; }
VirtualFileSystem { public boolean exists(String rawPath) { return findFSObject(rawPath) != null; } }
VirtualFileSystem { public boolean exists(String rawPath) { return findFSObject(rawPath) != null; } private  VirtualFileSystem(); }
VirtualFileSystem { public boolean exists(String rawPath) { return findFSObject(rawPath) != null; } private  VirtualFileSystem(); static VirtualFileSystem getInstance(); void resetSingleton(); void addLeakingResource(LeakingResource resource); File getRealTmpFile(); void throwSimuledIOExceptionIfNeeded(String path); boolean isClassSupposedToThrowIOException(String path); boolean setShouldThrowIOException(EvoSuiteFile file); boolean setShouldAllThrowIOExceptions(); void init(); static String getWorkingDirPath(); static String getDefaultParent(); Set<String> getAccessedFiles(); String createTempFile(String prefix, String suffix, File directory); boolean exists(String rawPath); FSObject findFSObject(String rawPath); boolean deleteFSObject(String rawPath); boolean createFile(String rawPath); boolean rename(String source, String destination); boolean createFolder(String rawPath); }
VirtualFileSystem { public boolean exists(String rawPath) { return findFSObject(rawPath) != null; } private  VirtualFileSystem(); static VirtualFileSystem getInstance(); void resetSingleton(); void addLeakingResource(LeakingResource resource); File getRealTmpFile(); void throwSimuledIOExceptionIfNeeded(String path); boolean isClassSupposedToThrowIOException(String path); boolean setShouldThrowIOException(EvoSuiteFile file); boolean setShouldAllThrowIOExceptions(); void init(); static String getWorkingDirPath(); static String getDefaultParent(); Set<String> getAccessedFiles(); String createTempFile(String prefix, String suffix, File directory); boolean exists(String rawPath); FSObject findFSObject(String rawPath); boolean deleteFSObject(String rawPath); boolean createFile(String rawPath); boolean rename(String source, String destination); boolean createFolder(String rawPath);  }