### Question:
JsonRestClient implements IRestClient { public Collection<Workspace> getWorkspaces( Repository repository ) throws Exception { assert repository != null; LOGGER.trace("getWorkspaces: repository={0}", repository); RepositoryNode repositoryNode = new RepositoryNode(repository); HttpClientConnection connection = connect(repository.getServer(), repositoryNode.getUrl(), RequestMethod.GET); try { int responseCode = connection.getResponseCode(); if (responseCode == HttpURLConnection.HTTP_OK) { return repositoryNode.getWorkspaces(connection.read()); } LOGGER.error(RestClientI18n.connectionErrorMsg, responseCode, "getWorkspaces"); String msg = RestClientI18n.getWorkspacesFailedMsg.text(repository.getName(), repository.getServer().getName(), responseCode); throw new RuntimeException(msg); } finally { if (connection != null) { LOGGER.trace("getWorkspaces: leaving"); connection.disconnect(); } } }  Collection<Repository> getRepositories( Server server ); @Override Map<String, javax.jcr.nodetype.NodeType> getNodeTypes( Repository repository ); URL getUrl( File file,
                       String path,
                       Workspace workspace ); Collection<Workspace> getWorkspaces( Repository repository ); boolean pathExists( Workspace workspace,
                               String path,
                               File file ); Status publish( Workspace workspace,
                           String path,
                           File file ); Status unpublish( Workspace workspace,
                             String path,
                             File file ); @Override List<QueryRow> query( Workspace workspace,
                                 String language,
                                 String statement ); @Override List<QueryRow> query( Workspace workspace,
                                 String language,
                                 String statement,
                                 int offset,
                                 int limit ); @SuppressWarnings( "unchecked" ) @Override List<QueryRow> query( Workspace workspace,
                                 String language,
                                 String statement,
                                 int offset,
                                 int limit,
                                 Map<String, String> variables ); @SuppressWarnings( "null" ) static void main( String[] args );  }### Answer:
@Test public void shouldGetWorkspaces() throws Exception { Collection<Workspace> workspaces = this.restClient.getWorkspaces(REPOSITORY1); assertThat(workspaces.size(), is(1)); assertThat(workspaces.iterator().next(), is(WORKSPACE1)); }