@Test public void testFindByDomain() throws TechnicalException { Factor factor = new Factor(); factor.setName("testName"); factor.setDomain("testDomain"); factorRepository.create(factor).blockingGet(); TestObserver<Set<Factor>> testObserver = factorRepository.findByDomain("testDomain").test(); testObserver.awaitTerminalEvent(); testObserver.assertComplete(); testObserver.assertNoErrors(); testObserver.assertValue(factors -> factors.size() == 1); }
@Override public Single<Set<Factor>> findByDomain(String domain) { return Observable.fromPublisher(factorsCollection.find(eq(FIELD_DOMAIN, domain))).map(this::convert).collect(HashSet::new, Set::add); }
MongoFactorRepository extends AbstractManagementMongoRepository implements FactorRepository { @Override public Single<Set<Factor>> findByDomain(String domain) { return Observable.fromPublisher(factorsCollection.find(eq(FIELD_DOMAIN, domain))).map(this::convert).collect(HashSet::new, Set::add); } }
MongoFactorRepository extends AbstractManagementMongoRepository implements FactorRepository { @Override public Single<Set<Factor>> findByDomain(String domain) { return Observable.fromPublisher(factorsCollection.find(eq(FIELD_DOMAIN, domain))).map(this::convert).collect(HashSet::new, Set::add); }  }
MongoFactorRepository extends AbstractManagementMongoRepository implements FactorRepository { @Override public Single<Set<Factor>> findByDomain(String domain) { return Observable.fromPublisher(factorsCollection.find(eq(FIELD_DOMAIN, domain))).map(this::convert).collect(HashSet::new, Set::add); }  @PostConstruct void init(); @Override Single<Set<Factor>> findAll(); @Override Single<Set<Factor>> findByDomain(String domain); @Override Maybe<Factor> findByDomainAndFactorType(String domain, String factorType); @Override Maybe<Factor> findById(String factorId); @Override Single<Factor> create(Factor item); @Override Single<Factor> update(Factor item); @Override Completable delete(String id); }
MongoFactorRepository extends AbstractManagementMongoRepository implements FactorRepository { @Override public Single<Set<Factor>> findByDomain(String domain) { return Observable.fromPublisher(factorsCollection.find(eq(FIELD_DOMAIN, domain))).map(this::convert).collect(HashSet::new, Set::add); }  @PostConstruct void init(); @Override Single<Set<Factor>> findAll(); @Override Single<Set<Factor>> findByDomain(String domain); @Override Maybe<Factor> findByDomainAndFactorType(String domain, String factorType); @Override Maybe<Factor> findById(String factorId); @Override Single<Factor> create(Factor item); @Override Single<Factor> update(Factor item); @Override Completable delete(String id);  }