@Test public void shouldNotFindToken() { TestObserver<RefreshToken> observer = refreshTokenRepository.findByToken("unknown-token").test(); observer.awaitTerminalEvent(); observer.assertComplete(); observer.assertValueCount(0); observer.assertNoErrors(); }
@Override public Maybe<RefreshToken> findByToken(String token) { return Observable .fromPublisher(refreshTokenCollection.find(eq(FIELD_TOKEN, token)).first()) .firstElement() .map(this::convert); }
MongoRefreshTokenRepository extends AbstractOAuth2MongoRepository implements RefreshTokenRepository { @Override public Maybe<RefreshToken> findByToken(String token) { return Observable .fromPublisher(refreshTokenCollection.find(eq(FIELD_TOKEN, token)).first()) .firstElement() .map(this::convert); } }
MongoRefreshTokenRepository extends AbstractOAuth2MongoRepository implements RefreshTokenRepository { @Override public Maybe<RefreshToken> findByToken(String token) { return Observable .fromPublisher(refreshTokenCollection.find(eq(FIELD_TOKEN, token)).first()) .firstElement() .map(this::convert); }  }
MongoRefreshTokenRepository extends AbstractOAuth2MongoRepository implements RefreshTokenRepository { @Override public Maybe<RefreshToken> findByToken(String token) { return Observable .fromPublisher(refreshTokenCollection.find(eq(FIELD_TOKEN, token)).first()) .firstElement() .map(this::convert); }  @PostConstruct void init(); @Override Maybe<RefreshToken> findByToken(String token); @Override Single<RefreshToken> create(RefreshToken refreshToken); @Override Completable bulkWrite(List<RefreshToken> refreshTokens); @Override Completable delete(String token); @Override Completable deleteByUserId(String userId); @Override Completable deleteByDomainIdClientIdAndUserId(String domainId, String clientId, String userId); @Override Completable deleteByDomainIdAndUserId(String domainId, String userId); }
MongoRefreshTokenRepository extends AbstractOAuth2MongoRepository implements RefreshTokenRepository { @Override public Maybe<RefreshToken> findByToken(String token) { return Observable .fromPublisher(refreshTokenCollection.find(eq(FIELD_TOKEN, token)).first()) .firstElement() .map(this::convert); }  @PostConstruct void init(); @Override Maybe<RefreshToken> findByToken(String token); @Override Single<RefreshToken> create(RefreshToken refreshToken); @Override Completable bulkWrite(List<RefreshToken> refreshTokens); @Override Completable delete(String token); @Override Completable deleteByUserId(String userId); @Override Completable deleteByDomainIdClientIdAndUserId(String domainId, String clientId, String userId); @Override Completable deleteByDomainIdAndUserId(String domainId, String userId);  }