QueryService { public QueryResponseWrapper query(String db, Query toQuery) throws IndexParseException, FieldNotIndexedException { ParsedQuery parsedQuery = ParsedQueryFactory.getParsedQuery(db, toQuery, queries.getSession()); return queries.query(parsedQuery); } QueryService(DatabaseRepository databaseRepository, TableRepository tableRepository, QueryRepository queryRepository); QueryResponseWrapper query(String db, Query toQuery); QueryResponseWrapper query(Query toQuery, int limit, long offset); boolean checkDatabase(Identifier id); boolean checkTable(Identifier id);  }
@Test public void testQuery() throws IndexParseException, FieldNotIndexedException { logger.debug("query"); Document doc = Fixtures.createTestDocument(); DocumentRepositoryImpl docRepo = new DocumentRepositoryImpl(f.getSession()); docRepo.create(doc); List<Document> result = instance.query(Fixtures.DB, Fixtures.createTestQuery()); assertNotNull(result); assertTrue(!result.isEmpty()); assertTrue(result.size() == 1); Document res = result.get(0); assertNotNull(res); assertNotNull(res.getCreatedAt()); assertNotNull(res.getUpdatedAt()); assertNotNull(res.getUuid()); assertNotNull(res.getId()); assertNotNull(res.getObject()); BSONObject expected = doc.getObject(); BSONObject actual = res.getObject(); assertEquals(expected, actual); }