### Question:
FederatedWorkspace { public boolean contains( String sourceName, String workspaceName ) { List<Projection> projections = this.projectionsBySourceName.get(sourceName); if (projections != null) { for (Projection projection : projections) { if (projection.getWorkspaceName().equals(workspaceName)) return true; } } return false; } FederatedWorkspace( RepositoryContext repositoryContext,
                               String sourceName,
                               String workspaceName,
                               Iterable<Projection> projections,
                               CachePolicy cachePolicy ); RepositoryContext getRepositoryContext(); String getSourceName(); String getName(); CachePolicy getCachePolicy(); Problems getProblems(); List<Projection> getProjections(); boolean contains( String sourceName,
                             String workspaceName ); ProjectedNode project( ExecutionContext context,
                                  Location location,
                                  boolean requiresUpdate ); @Override int hashCode(); @Override boolean equals( Object obj );  }### Answer:
@Test public void shouldCorrectlyDetermineContainmentBySourceAndWorkspaceName() { assertThat(workspace.contains("source1", "workspace1"), is(true)); assertThat(workspace.contains("source2", "workspace2"), is(true)); assertThat(workspace.contains("source2", "workspace4"), is(true)); assertThat(workspace.contains("source3", "workspace3"), is(true)); }
@Test public void shouldCorrectlyDetermineNonContainmentOfCaseSensitiveSourceNotInProjections() { assertThat(workspace.contains("source x", "workspace3"), is(false)); assertThat(workspace.contains("Source1", "workspace3"), is(false)); assertThat(workspace.contains("", "workspace3"), is(false)); }
@Test public void shouldCorrectlyDetermineNonContainmentOfCaseSensitiveWorkspaceNotInProjections() { assertThat(workspace.contains("source1", "Workspace1"), is(false)); assertThat(workspace.contains("source1", "workspace 1"), is(false)); assertThat(workspace.contains("source1", "no workspace"), is(false)); }