RemoteFile implements Serializable { @Override public String toString() { final StringBuilder builder = new StringBuilder(); if(this.isRoot()) { builder.append("/"); } else { final String parentString = this.parent.toString(); builder.append(parentString); if(!parentString.endsWith("/")) { builder.append("/"); } } if(this.name != null) builder.append(this.name); return builder.toString(); } RemoteFile(String name);  RemoteFile(RemoteFile parent, String name); boolean isEmpty(); RemoteFile getParent(); void setParent(RemoteFile parent); String getName(); void setName(String name); boolean isRoot(); boolean isFile(); RemoteFile setFile(boolean file); boolean isFolder(); RemoteFile setFolder(boolean folder); @Override String toString();  }
@Test public void toStringWithOnlyName() { final RemoteFile parent = new RemoteFile("parent"); assertEquals("/parent", parent.toString()); }
@Test public void toStringWithParent() { final RemoteFile parent = new RemoteFile("parent"); final RemoteFile child = new RemoteFile(parent, "child"); assertEquals("/parent/child", child.toString()); }
@Test public void toStringWithParentWithNullName() { final RemoteFile parent = new RemoteFile(null); final RemoteFile child = new RemoteFile(parent, "child"); assertEquals("/child", child.toString()); }
@Test public void toStringForRoot() { final RemoteFile root = new RemoteFile(null); assertEquals("/", root.toString()); }