### Question:
SearchableRepositorySource implements RepositorySource { public RepositorySourceCapabilities getCapabilities() { return new RepositorySourceCapabilities(this.delegate.getCapabilities()) { @Override public boolean supportsQueries() { return true; } @Override public boolean supportsSearches() { return true; } }; } SearchableRepositorySource( RepositorySource wrapped,
                                       SearchEngine searchEngine,
                                       ExecutorService executorService,
                                       boolean executeAsynchronously,
                                       boolean updateIndexesAsynchronously );  SearchableRepositorySource( RepositorySource wrapped,
                                       SearchEngine searchEngine ); String getName(); void close(); RepositorySourceCapabilities getCapabilities(); RepositoryConnection getConnection(); int getRetryLimit(); void initialize( final RepositoryContext context ); void setRetryLimit( int limit ); Reference getReference();  }### Answer:
@Test public void shouldReturnCapabilitiesThatMatchSourceCapabilitiesExceptWithSearchableAndQueryable() { searchable = newSynchronousSearchable(); RepositorySourceCapabilities sourceCapabilities = wrapped.getCapabilities(); RepositorySourceCapabilities searchableCapabilities = searchable.getCapabilities(); assertThat(searchableCapabilities.supportsCreatingWorkspaces(), is(sourceCapabilities.supportsCreatingWorkspaces())); assertThat(searchableCapabilities.supportsEvents(), is(sourceCapabilities.supportsEvents())); assertThat(searchableCapabilities.supportsLocks(), is(sourceCapabilities.supportsLocks())); assertThat(searchableCapabilities.supportsReferences(), is(sourceCapabilities.supportsReferences())); assertThat(searchableCapabilities.supportsSameNameSiblings(), is(sourceCapabilities.supportsSameNameSiblings())); assertThat(searchableCapabilities.supportsUpdates(), is(sourceCapabilities.supportsUpdates())); assertThat(searchableCapabilities.supportsQueries(), is(true)); assertThat(searchableCapabilities.supportsSearches(), is(true)); }
@Test public void shouldSendSearchRequestToSearchEngine() throws Exception { assertThatSourceIsNotSearchable(wrapped); loadContentInto(wrapped, "aircraft.xml"); searchable = newSynchronousSearchable(); assertThat(searchable.getCapabilities().supportsSearches(), is(true)); QueryResults results = Graph.create(searchable, context).search("Boeing", 100, 1); assertThat(results, is(notNullValue())); }
@Test public void shouldSendQueryRequestToSearchEngine() throws Exception { assertThatSourceIsNotSearchable(wrapped); loadContentInto(wrapped, "aircraft.xml"); searchable = newSynchronousSearchable(); assertThat(searchable.getCapabilities().supportsQueries(), is(true)); QueryResults results = Graph.create(searchable, context) .query(sql.parseQuery("SELECT * FROM t1", typeSystem), schemata) .execute(); assertThat(results, is(notNullValue())); }