### Question:
RemoveWorkspaceAction { public boolean remove(Server server) throws IOException, InterruptedException { Workspaces workspaces = server.getWorkspaces(); if (workspaces.exists(workspaceName)) { Workspace workspace = workspaces.getWorkspace(workspaceName); workspaces.deleteWorkspace(workspace); return true; } return false; } RemoveWorkspaceAction(String workspaceName); boolean remove(Server server);  }### Answer:
@Test public void assertNoSuchWorkspaceNameDoesNothing() throws Exception { when(server.getWorkspaces()).thenReturn(workspaces); when(workspaces.exists(anyString())).thenReturn(false); RemoveWorkspaceAction action = new RemoveWorkspaceAction("workspace"); assertThat(action.remove(server), is(false)); verify(server).getWorkspaces(); verify(workspaces).exists("workspace"); verifyNoMoreInteractions(workspace); verifyNoMoreInteractions(workspaces); verifyNoMoreInteractions(server); }
@Test public void assertWorkspaceIsDeleted() throws Exception { when(server.getWorkspaces()).thenReturn(workspaces); when(workspaces.exists(anyString())).thenReturn(true); when(workspaces.getWorkspace(anyString())).thenReturn(workspace); RemoveWorkspaceAction action = new RemoveWorkspaceAction("workspace"); assertThat(action.remove(server), is(true)); verify(server).getWorkspaces(); verify(workspaces).exists("workspace"); verify(workspaces).getWorkspace("workspace"); verify(workspaces).deleteWorkspace(workspace); verifyNoMoreInteractions(workspace); verifyNoMoreInteractions(workspaces); verifyNoMoreInteractions(server); }