Ejemplo n.º 1
0
 @Test
 public void simpleQuery() throws IOException {
   ServiceLocator locator = container;
   NextRepository repository = locator.resolve(NextRepository.class);
   repository.insert(new Next());
   List<Next> search = repository.search();
   Query<Next> stream = repository.query();
   List<Next> list = stream.list();
   Assert.assertEquals(search.size(), list.size());
 }
Ejemplo n.º 2
0
 @Test
 public void searchWithFilter() throws IOException {
   ServiceLocator locator = container;
   NextRepository repository = locator.resolve(NextRepository.class);
   String uri = repository.insert(new Next());
   int id = Integer.parseInt(uri);
   List<Next> found = repository.search(next -> next.getID() == id);
   Assert.assertEquals(1, found.size());
   Assert.assertEquals(id, found.get(0).getID());
 }
Ejemplo n.º 3
0
 @Test
 public void toStringAndValueOf() throws IOException {
   ServiceLocator locator = container;
   NextRepository repository = locator.resolve(NextRepository.class);
   String uri = repository.insert(new Next());
   int id = Integer.parseInt(uri);
   List<Next> found =
       repository.search(
           it -> String.valueOf(it.getID()).equals(uri) && id == Integer.valueOf(it.getURI()));
   Assert.assertEquals(1, found.size());
   Assert.assertEquals(id, found.get(0).getID());
 }