try { checkoutWorkspace.revert("directory", true); fail("should not be able to revert missing folder"); } catch (SVNException e) {  }
final int[] status = new int[] {0}; checkoutWorkspace.addWorkspaceListener(new ISVNWorkspaceListener() { public void updated(String path, int contentsStatus, int propertiesStatus, long revision) { } public void committed(String path, int kind) { } public void modified(String path, int kind) { status[0] = kind; } }); checkoutWorkspace.revert("directory", true); assertEquals("should not be able to revert missing folder", status[0], SVNStatus.NOT_REVERTED);
    public void testRevert() throws Throwable {        File jsvn = AllTests.createPlayground();        ISVNWorkspace checkoutWorkspace = createWorkspace(jsvn);                checkoutWorkspace.checkout(SVNRepositoryLocation.parseURL(getRepositoryURL()),ISVNWorkspace.HEAD,false);        File dir = new File(jsvn, "directory");        // add subfolder, commit        File subDir = createDirectory(dir, "subfolder");        File file = createFile(new File(subDir, "file.txt"), "contents");        checkoutWorkspace.add("directory/subfolder", true, true);        checkoutWorkspace.commit("folder and file added");                AllTests.deleteAll(dir);        assertFalse(dir.exists());        assertFalse(subDir.exists());        assertFalse(file.exists());        // should be reported as missing!        SVNStatus dirStatus = checkoutWorkspace.status("directory", false);        assertEquals(dirStatus.getContentsStatus(), SVNStatus.MISSING);        assertEquals(dirStatus.getPropertiesStatus(), SVNStatus.NOT_MODIFIED);                // restored by update.        checkoutWorkspace.update("", -1, true);        assertTrue(dir.exists());        assertTrue(subDir.exists());        assertTrue(file.exists());        dirStatus = checkoutWorkspace.status("directory", false);        assertEquals(dirStatus.getContentsStatus(), SVNStatus.NOT_MODIFIED);        assertEquals(dirStatus.getPropertiesStatus(), SVNStatus.NOT_MODIFIED);                // restored by revert?        AllTests.deleteAll(dir);        assertFalse(dir.exists());        assertFalse(subDir.exists());        assertFalse(file.exists());                try {            checkoutWorkspace.revert("directory", true);            fail("should not be able to revert missing folder");        } catch (SVNException e) {            // ok.        }        assertFalse(dir.exists());        assertFalse(subDir.exists());        assertFalse(file.exists());        // do update.        checkoutWorkspace.update(ISVNWorkspace.HEAD);        assertTrue(dir.exists());        assertTrue(subDir.exists());        assertTrue(file.exists());                // add folder, then revert.        dir = createDirectory(jsvn, "folder");        file = createFile(new File(dir, "file.txt"), "contents");        checkoutWorkspace.add("folder", true, true);        assertTrue(dir.exists());        assertTrue(file.exists());        dirStatus = checkoutWorkspace.status("folder", false);        assertEquals(dirStatus.getContentsStatus(), SVNStatus.ADDED);                checkoutWorkspace.revert("", true);        dirStatus = checkoutWorkspace.status("folder", false);                assertEquals(dirStatus.getContentsStatus(), SVNStatus.UNVERSIONED);                assertTrue(file.exists());        assertTrue(dir.exists());                checkoutWorkspace.copy("testFile.txt", "directory/copyFile.txt", true);        checkoutWorkspace.revert("", true);        dirStatus = checkoutWorkspace.status("directory/copyFile.txt", false);        assertEquals(dirStatus.getContentsStatus(), SVNStatus.UNVERSIONED);        dirStatus = checkoutWorkspace.status("testFile.txt", false);        assertEquals(dirStatus.getContentsStatus(), SVNStatus.NOT_MODIFIED);    }