### Question:
StandardMapWorkspace extends MapWorkspace<NodeType> { @Override @SuppressWarnings( "unchecked" ) public void removeAll() { NodeType newRootNode = (NodeType)getRootNode().withoutChildren().withoutProperties().freeze(); nodesByUuid.clear(); nodesByUuid.put(newRootNode.getUuid(), newRootNode); } StandardMapWorkspace( String name,
                         Map<UUID, NodeType> nodesByUuid,
                         NodeType rootNode );  StandardMapWorkspace( String name,
                         Map<UUID, NodeType> nodesByUuid,
                         StandardMapWorkspace<NodeType> originalToClone ); @Override NodeType getNode( UUID uuid ); @Override NodeType putNode( NodeType node ); @Override NodeType removeNode( UUID uuid ); @Override @SuppressWarnings( "unchecked" ) void removeAll();  }### Answer:
@Test public void shouldRemoveAllNodesExceptTheRootNode() { MapNode[] nodes = addProperty(addNodes(10), "foo", "value1"); MapNode root = addProperty(workspace.getRootNode(), "bar", "value2"); assertThat(store.size(), is(11)); assertStored(root); assertStored(nodes); workspace.removeAll(); assertThat(store.size(), is(1)); assertThat(workspace.getRootNode(), is(sameInstance(store.get(rootUuid)))); assertThat(workspace.getRootNode(), is(not(sameInstance(root)))); assertThat(workspace.getRootNode().getChildren().isEmpty(), is(true)); assertThat(workspace.getRootNode().getProperties().isEmpty(), is(true)); }