### Question:
CSVFileManager { public CSVFolder replaceCurrentFolder() throws ServerCommunicationException, InvalidWriteEnablerException, InsufficientPermissionException { try { CSVFolder folder = new CSVFolder(); CSVFolder current = this.getCurrentFolder(); folder.getContents().putAll(current.getContents()); current.getContents().clear(); uploadFolder(current); String currentAlias = this.getAliasOfCurrentFolder(); CSVFolder parent = this.getParentFolder(); if (parent != null) { parent.getContents().remove(currentAlias); uploadFolder(parent); putObjectIntoFolder(folder, parent, currentAlias); this.location.pop(); } else { uploadFolder(folder); } this.location.pop(); if (parent != null) { this.location.push(parent); } this.location.push(folder); return folder; } catch (ImmutableFileExistsException e) { } catch (DuplicateAliasException e) { } catch (IllegalFileNameException e) { } return null; } CSVFileManager(Communication connection);  CSVFileManager(Capability capability, Communication connection); void setRootCapability(Capability capability); CSVObject putObjectIntoFolder(CSVObject object, CSVFolder folder,
			String alias); CSVObject putObjectIntoCurrentFolder(CSVObject object, String alias); CSVFile uploadFile(CSVFile file); CSVFolder uploadFolder(CSVFolder folder); CSVFile downloadFile(CSVFile file); CSVFolder downloadFolder(CSVFolder folder); CSVFolder downloadFolder(String alias, CSVFolder fromFolder); CSVObject downloadObject(CSVObject object); CSVFolder downloadFolder(Capability capability); CSVFolder cd(String alias); CSVFolder getShareFolder(); CSVFolder getCurrentFolder(); CSVFolder getParentFolder(); CSVFolder replaceCurrentFolder(); CSVFolder getRootFolder(); void unlinkAliasFromCurrentFolder(String alias); void unLinkAliasFromFolder(String alias, CSVFolder folder); static final String SHARE_FOLDER; }### Answer:
@Test public void testReplaceCurrentFolder() throws FileNotFoundException, ServerCommunicationException, InvalidWriteEnablerException, ImmutableFileExistsException, DuplicateAliasException, IllegalFileNameException, InsufficientPermissionException, RemoteFileDoesNotExistException, NoSuchAliasException, FailedToVerifySignatureException { CSVFolder old = new CSVFolder(); this.fileManager.putObjectIntoCurrentFolder(old, "alias"); CSVFile file = new CSVFile(new File(this.testfile)); this.fileManager.putObjectIntoFolder(file, old, "afile"); Assert.assertTrue(this.fileManager.getCurrentFolder().getContents() .containsKey("alias")); this.fileManager.cd("alias"); Assert.assertTrue(this.fileManager.getCurrentFolder().getContents() .containsKey("afile")); CSVFolder folder = this.fileManager.replaceCurrentFolder(); Assert.assertArrayEquals(folder.getPublicKeyHash(), this.fileManager .getCurrentFolder().getPublicKeyHash()); Assert.assertEquals("alias", this.fileManager.getAliasOfCurrentFolder()); Assert.assertTrue(this.fileManager.getCurrentFolder().getContents() .containsKey("afile")); this.fileManager.cd(".."); Assert.assertTrue(this.fileManager.getCurrentFolder().getContents() .containsKey("alias")); this.fileManager.cd("alias"); Assert.assertTrue(this.fileManager.getCurrentFolder().getContents() .containsKey("afile")); Assert.assertFalse(this.fileManager.getCurrentFolder().getCapability() .toString().equals(old.getCapability().toString())); CSVFolder newCopyOfOld = this.fileManager.downloadFolder(old .getCapability()); Assert.assertTrue(newCopyOfOld.getContents().size() == 0); }