MongodbHandler implements RepositoryHandler { public void setJongoSupplier(final Supplier<Jongo> s) { this.jongoSupplier = s; } MongodbHandler(final DataBaseConfig config, final DB theDb); void setJongoSupplier(final Supplier<Jongo> s); @Override void store(final DbCredential credential); @Override void addUserRole(final String user, final AvailableRoles role); @Override void removeUserRole(final String user, final AvailableRoles role); @Override DbCredential getCredential(final String user); @Override void store(final DbLicense license); @Override List<String> getLicenseNames(final FiltersHolder filters); @Override List<DbLicense> getAllLicenses(); @Override DbLicense getLicense(final String name); @Override void deleteLicense(final String name); @Override List<DbArtifact> getArtifacts(final FiltersHolder filters); @Override void addLicenseToArtifact(final DbArtifact artifact, final String licenseId); @Override void removeLicenseFromArtifact(final DbArtifact artifact,
                                          final String licenseId,
                                          final LicenseMatcher licenseMatcher); @Override void approveLicense(final DbLicense license, final Boolean approved); @Override void store(final DbArtifact artifact); @Override List<String> getGavcs(final FiltersHolder filters); @Override List<String> getGroupIds(final FiltersHolder filters); @Override List<String> getArtifactVersions(final DbArtifact artifact); @Override DbArtifact getArtifact(final String gavc); @Override DbArtifact getArtifactUsingSHA256(final String sha256); @Override void deleteArtifact(final String gavc); @Override void updateDoNotUse(final DbArtifact artifact, final Boolean doNotUse); @Override void updateDownloadUrl(final DbArtifact artifact, final String downLoadUrl); @Override void updateProvider(final DbArtifact artifact, final String provider); @Override List<DbModule> getAncestors(final DbArtifact artifact, final FiltersHolder filters); @Override void store(final DbModule module); @Override List<String> getModuleNames(final FiltersHolder filters); @Override List<String> getModuleVersions(final String name, final FiltersHolder filters); @Override DbModule getModule(final String moduleId); @Override List<DbModule> getModules(final FiltersHolder filters); @Override void deleteModule(final String moduleId); @Override void promoteModule(final DbModule module); @Override DbModule getRootModuleOf(final String gavc); @Override DbModule getModuleOf(final String gavc); @Override List<String> getOrganizationNames(); @Override DbOrganization getOrganization(String name); @Override void deleteOrganization(String organizationId); @Override void store(DbOrganization organization); @Override void addModulesOrganization(final String corporateGidPrefix, final DbOrganization organization); @Override void removeModulesOrganization(final String corporateGidPrefix, final DbOrganization organization); @Override void removeModulesOrganization(final DbOrganization organization); @Override List<DbOrganization> getAllOrganizations(); @Override void store(final DbProduct dbProduct); @Override DbProduct getProduct(final String name); @Override List<String> getProductNames(); @Override void deleteProduct(String name); @Override Optional<T> getOneByQuery(final String collection,
                                         final String query,
                                         final Class<T> c); List<T> getListByQuery(final String collection,
                                      final String query,
                                      final Class<T> c); @Override void consumeByQuery(final String collectionName,
                                   final String query,
                                   final Class<T> c,
                                   final Consumer<T> consumer); long getResultCount(final String collectionName, final String query); @Override void store(DbComment comment); @Override List<DbComment> getComments(String entityId, String entityType); @Override DbComment getLatestComment(String entityId, String entityType); @Override DbSearch getSearchResult(String searchParam, FiltersHolder filter);  }
@Test public void test() throws UnknownHostException { MongodbHandler sut = new MongodbHandler(mock(DataBaseConfig.class), mock(DB.class)); final Supplier<Jongo> jongoSupplier = prepareJongoSupplier(collectionName, tClass, tInstance); sut.setJongoSupplier(jongoSupplier); actAssert.accept(sut, jongoSupplier.get().getCollection(collectionName)); }