@Test public void testFindById() throws TechnicalException { Tag tag = new Tag(); tag.setName("testName"); Tag tagCreated = tagRepository.create(tag).blockingGet(); TestObserver<Tag> testObserver = tagRepository.findById(tagCreated.getId()).test(); testObserver.awaitTerminalEvent(); testObserver.assertComplete(); testObserver.assertNoErrors(); testObserver.assertValue(d -> d.getName().equals("testName")); }
@Override public Maybe<Tag> findById(String id, String organizationId) { return Observable.fromPublisher(tagsCollection.find(and(eq(FIELD_ORGANIZATION_ID, organizationId), eq(FIELD_ID, id))).first()).firstElement().map(this::convert); }
MongoTagRepository extends AbstractManagementMongoRepository implements TagRepository { @Override public Maybe<Tag> findById(String id, String organizationId) { return Observable.fromPublisher(tagsCollection.find(and(eq(FIELD_ORGANIZATION_ID, organizationId), eq(FIELD_ID, id))).first()).firstElement().map(this::convert); } }
MongoTagRepository extends AbstractManagementMongoRepository implements TagRepository { @Override public Maybe<Tag> findById(String id, String organizationId) { return Observable.fromPublisher(tagsCollection.find(and(eq(FIELD_ORGANIZATION_ID, organizationId), eq(FIELD_ID, id))).first()).firstElement().map(this::convert); }  }
MongoTagRepository extends AbstractManagementMongoRepository implements TagRepository { @Override public Maybe<Tag> findById(String id, String organizationId) { return Observable.fromPublisher(tagsCollection.find(and(eq(FIELD_ORGANIZATION_ID, organizationId), eq(FIELD_ID, id))).first()).firstElement().map(this::convert); }  @PostConstruct void init(); @Override Maybe<Tag> findById(String id, String organizationId); @Override Maybe<Tag> findById(String id); @Override Flowable<Tag> findAll(String organizationId); @Override Single<Tag> create(Tag item); @Override Single<Tag> update(Tag item); @Override Completable delete(String id); }
MongoTagRepository extends AbstractManagementMongoRepository implements TagRepository { @Override public Maybe<Tag> findById(String id, String organizationId) { return Observable.fromPublisher(tagsCollection.find(and(eq(FIELD_ORGANIZATION_ID, organizationId), eq(FIELD_ID, id))).first()).firstElement().map(this::convert); }  @PostConstruct void init(); @Override Maybe<Tag> findById(String id, String organizationId); @Override Maybe<Tag> findById(String id); @Override Flowable<Tag> findAll(String organizationId); @Override Single<Tag> create(Tag item); @Override Single<Tag> update(Tag item); @Override Completable delete(String id);  }