### Question:
FederatedRepository { public FederatedWorkspace getWorkspace( String name ) { if (name == null) { assert defaultWorkspace != null; return defaultWorkspace; } FederatedWorkspace workspace = workspacesByName.get(name); if (workspace == null) { String msg = GraphI18n.workspaceDoesNotExistInFederatedRepository.text(name, getSourceName()); throw new InvalidWorkspaceException(msg); } return workspace; } FederatedRepository( String sourceName,
                                RepositoryConnectionFactory connectionFactory,
                                Iterable<FederatedWorkspace> workspaces,
                                CachePolicy defaultCachePolicy,
                                ExecutorService executor ); String getSourceName(); RepositoryConnectionFactory getConnectionFactory(); FederatedWorkspace getWorkspace( String name ); CachePolicy getDefaultCachePolicy(); ExecutorService getExecutor(); @Override String toString();  }### Answer:
@Test public void shouldFindExistingWorkspaces() { assertThat(repository.getWorkspace("workspace1"), is(sameInstance(workspace1))); assertThat(repository.getWorkspace("workspace2"), is(sameInstance(workspace2))); }
@Test public void shouldFindDefaultWorkspaceIfThereIsOne() { assertThat(repository.getWorkspace(null), is(sameInstance(workspace1))); }
@Test( expected = InvalidWorkspaceException.class ) public void shouldNotFindWorkspaceThatDoesNotExist() { repository.getWorkspace("non-existant"); }