@Test public void testFindById() { Organization organization = new Organization(); organization.setName("testName"); Organization organizationCreated = organizationRepository.create(organization).blockingGet(); TestObserver<Organization> obs = organizationRepository.findById(organizationCreated.getId()).test(); obs.awaitTerminalEvent(); obs.assertComplete(); obs.assertNoErrors(); obs.assertValue(o -> o.getId().equals(organizationCreated.getId())); }
@Override public Maybe<Organization> findById(String id) { return Observable.fromPublisher(collection.find(eq(FIELD_ID, id)).first()) .firstElement() .map(this::convert); }
MongoOrganizationRepository extends AbstractManagementMongoRepository implements OrganizationRepository { @Override public Maybe<Organization> findById(String id) { return Observable.fromPublisher(collection.find(eq(FIELD_ID, id)).first()) .firstElement() .map(this::convert); } }
MongoOrganizationRepository extends AbstractManagementMongoRepository implements OrganizationRepository { @Override public Maybe<Organization> findById(String id) { return Observable.fromPublisher(collection.find(eq(FIELD_ID, id)).first()) .firstElement() .map(this::convert); }  }
MongoOrganizationRepository extends AbstractManagementMongoRepository implements OrganizationRepository { @Override public Maybe<Organization> findById(String id) { return Observable.fromPublisher(collection.find(eq(FIELD_ID, id)).first()) .firstElement() .map(this::convert); }  @PostConstruct void init(); @Override Maybe<Organization> findById(String id); @Override Single<Organization> create(Organization organization); @Override Single<Organization> update(Organization organization); @Override Completable delete(String id); @Override Single<Long> count(); }
MongoOrganizationRepository extends AbstractManagementMongoRepository implements OrganizationRepository { @Override public Maybe<Organization> findById(String id) { return Observable.fromPublisher(collection.find(eq(FIELD_ID, id)).first()) .firstElement() .map(this::convert); }  @PostConstruct void init(); @Override Maybe<Organization> findById(String id); @Override Single<Organization> create(Organization organization); @Override Single<Organization> update(Organization organization); @Override Completable delete(String id); @Override Single<Long> count(); static final String FIELD_ID; }