### Question:
ForkRequestProcessor extends RequestProcessor { protected final FederatedWorkspace getWorkspace( Request request, String workspaceName ) { try { return repository.getWorkspace(workspaceName); } catch (InvalidWorkspaceException e) { request.setError(e); } catch (Throwable e) { request.setError(e); } return null; } ForkRequestProcessor( FederatedRepository repository,
                                 ExecutionContext context,
                                 DateTime now,
                                 Queue<FederatedRequest> federatedRequestQueue ); void await(); @Override void process( VerifyNodeExistsRequest request ); @Override void process( ReadNodeRequest request ); @Override void process( ReadAllChildrenRequest request ); @Override void process( ReadBlockOfChildrenRequest request ); @Override void process( ReadNextBlockOfChildrenRequest request ); @Override void process( ReadAllPropertiesRequest request ); @Override void process( ReadPropertyRequest request ); @Override void process( ReadBranchRequest request ); @Override void process( CreateNodeRequest request ); @Override void process( RemovePropertyRequest request ); @Override void process( UpdatePropertiesRequest request ); @Override void process( UpdateValuesRequest request ); @Override void process( SetPropertyRequest request ); @Override void process( DeleteChildrenRequest request ); @Override void process( DeleteBranchRequest request ); @Override void process( CopyBranchRequest request ); @Override void process( CloneBranchRequest request ); @Override void process( MoveBranchRequest request ); @Override void process( RenameNodeRequest request ); @Override void process( LockBranchRequest request ); @Override void process( UnlockBranchRequest request ); @Override void process( VerifyWorkspaceRequest request ); @Override void process( GetWorkspacesRequest request ); @Override void process( CreateWorkspaceRequest request ); @Override void process( CloneWorkspaceRequest request ); @Override void process( DestroyWorkspaceRequest request ); @Override void process( AccessQueryRequest request ); @Override void process( FullTextSearchRequest request ); @Override void close();  }### Answer:
@Test public void shouldFindFederatedWorkspaceByName() { ReadNodeRequest request = new ReadNodeRequest(location("/some"), this.workspace.getName()); FederatedWorkspace workspace = processor.getWorkspace(request, request.inWorkspace()); assertThat(workspace, is(sameInstance(this.workspace))); }
@Test public void shouldRecordErrorOnRequestIfFederatedWorkspaceCouldNotBeFoundByName() { ReadNodeRequest request = new ReadNodeRequest(location("/some"), nonExistantWorkspaceName); FederatedWorkspace workspace = processor.getWorkspace(request, request.inWorkspace()); assertThat(workspace, is(nullValue())); assertThat(request.hasError(), is(true)); assertThat(request.getError(), is(instanceOf(InvalidWorkspaceException.class))); }