MongoAppSessionRepository extends CrudRepositoryBase<AppSession, String> implements AppSessionRepository { @Override public AppSession findOneByActive(String id) { if (id == null) return null; final DBObject dbo = coll.findOne(new BasicDBObject(ImmutableMap.of( "schemaVersion", AppSessionImpl.getDefaultSchemaVersion(), "status", AppSessionStatus.ACTIVE.name(), "_id", id))); log.trace("findOneByActive {} returns {}", id, dbo); return new FromDBObject().apply(dbo); } @Inject  MongoAppSessionRepository(@Value("#{soluvasProps.securityMongoUri}") String mongoUri); @PreDestroy void destroy(); String getMongoUri(); @Override AppSession findOneByActive(String id); @Override S add(final S appSession); @Override S modify(final String id, final S appSession); @Override boolean exists(String id); @Override List<AppSession> findAll(); @Override long count(); @SuppressWarnings("unchecked") @Override S findOne(String id); @Override boolean delete(String id); @Override List<AppSession> findAllByActive(); @Override boolean touch(String id);  }
@Test public void find() { final AppSession appSession = appSessionRepo.findOneByActive("00000000"); assertNotNull(appSession); assertThat(appSession.getAttributes(), empty()); }