DefaultExtensionRepositoryManager extends AbstractAdvancedSearchableExtensionRepository implements ExtensionRepositoryManager, Initializable { @Override public IterableResult<Extension> search(ExtensionQuery query) throws SearchException { return RepositoryUtils.search(query, this.repositories); }  @Override void initialize(); @Override @Deprecated ExtensionRepository addRepository(ExtensionRepositoryId repositoryId); @Override ExtensionRepository addRepository(ExtensionRepositoryDescriptor repositoryDescriptor); @Override ExtensionRepository addRepository(ExtensionRepositoryDescriptor repositoryDescriptor, int priority); @Override void addRepository(ExtensionRepository repository); @Override void addRepository(ExtensionRepository repository, int priority); @Override void removeRepository(String repositoryId); @Override ExtensionRepository getRepository(String repositoryId); @Override Collection<ExtensionRepository> getRepositories(); @Override Extension resolve(ExtensionId extensionId); @Override Extension resolve(ExtensionDependency extensionDependency); @Override IterableResult<Version> resolveVersions(String id, int offset, int nb); @Override boolean exists(ExtensionId extensionId); @Override IterableResult<Extension> search(ExtensionQuery query); @Override boolean isFilterable(); @Override boolean isSortable();  }
@Test void search() throws SearchException { when(this.mockSearchableRepository1.search("pattern", 0, -1)) .thenReturn(toIterableExtensions(this.extension1, this.extension2)); when(this.mockSearchableRepository2.search("pattern", 0, -1)) .thenReturn(toIterableExtensions(this.extension3, this.extension4)); assertSearch(0, -1, this.extension1, this.extension2, this.extension3, this.extension4); assertSearch(0, 1, this.extension1); assertSearch(1, -1, this.extension2, this.extension3, this.extension4); when(this.mockSearchableRepository1.search("pattern", 0, -1)).thenReturn(toIterableExtensions()); when(this.mockSearchableRepository2.search("pattern", 0, -1)) .thenReturn(toIterableExtensions(this.extension3, this.extension4)); assertSearch(0, -1, this.extension3, this.extension4); assertSearch(0, 1, this.extension3); assertSearch(1, -1, this.extension4); when(this.mockSearchableRepository1.search("pattern", 0, -1)) .thenReturn(toIterableExtensions(this.extension1, this.extension2)); when(this.mockSearchableRepository2.search("pattern", 0, -1)).thenReturn(toIterableExtensions()); assertSearch(0, -1, this.extension1, this.extension2, this.extension3, this.extension4); assertSearch(0, 1, this.extension1); assertSearch(1, -1, this.extension2, this.extension3, this.extension4); }