@SuppressWarnings("unchecked") @Test void findAllStream() { Object id0 = "id0"; Object id1 = "id1"; Entity entity0 = when(mock(Entity.class).getIdValue()).thenReturn(id0).getMock(); Entity entity1 = when(mock(Entity.class).getIdValue()).thenReturn(id1).getMock(); Stream<Object> entityIds = Stream.of(id0, id1); doReturn(Stream.of(entity0, entity1)) .when(abstractRepository) .findAll(ArgumentMatchers.any(Query.class)); Stream<Entity> expectedEntities = abstractRepository.findAll(entityIds); assertEquals(asList(entity0, entity1), expectedEntities.collect(toList())); }
@Override public Stream<Entity> findAll(Query<Entity> q) { throw new UnsupportedOperationException(); }
AbstractRepository implements Repository<Entity> { @Override public Stream<Entity> findAll(Query<Entity> q) { throw new UnsupportedOperationException(); } }
AbstractRepository implements Repository<Entity> { @Override public Stream<Entity> findAll(Query<Entity> q) { throw new UnsupportedOperationException(); }  }
AbstractRepository implements Repository<Entity> { @Override public Stream<Entity> findAll(Query<Entity> q) { throw new UnsupportedOperationException(); }  @Override String getName(); @Override Set<Operator> getQueryOperators(); Query<Entity> query(); @Override long count(); @Override void close(); @Override long count(Query<Entity> q); @Override Stream<Entity> findAll(Query<Entity> q); @Override Entity findOne(Query<Entity> q); @Override Entity findOneById(Object id); @Override Entity findOneById(Object id, Fetch fetch); @Override Stream<Entity> findAll(Stream<Object> ids); @Override Stream<Entity> findAll(Stream<Object> ids, Fetch fetch); @Override AggregateResult aggregate(AggregateQuery aggregateQuery); @Override void update(Entity entity); @Override void update(Stream<Entity> entities); @Override void delete(Entity entity); @Override void delete(Stream<Entity> entities); @Override void deleteById(Object id); @Override void deleteAll(Stream<Object> ids); @Override void deleteAll(); @Override void add(Entity entity); @Override Integer add(Stream<Entity> entities); @Override void forEachBatched(Fetch fetch, Consumer<List<Entity>> consumer, int batchSize); }
AbstractRepository implements Repository<Entity> { @Override public Stream<Entity> findAll(Query<Entity> q) { throw new UnsupportedOperationException(); }  @Override String getName(); @Override Set<Operator> getQueryOperators(); Query<Entity> query(); @Override long count(); @Override void close(); @Override long count(Query<Entity> q); @Override Stream<Entity> findAll(Query<Entity> q); @Override Entity findOne(Query<Entity> q); @Override Entity findOneById(Object id); @Override Entity findOneById(Object id, Fetch fetch); @Override Stream<Entity> findAll(Stream<Object> ids); @Override Stream<Entity> findAll(Stream<Object> ids, Fetch fetch); @Override AggregateResult aggregate(AggregateQuery aggregateQuery); @Override void update(Entity entity); @Override void update(Stream<Entity> entities); @Override void delete(Entity entity); @Override void delete(Stream<Entity> entities); @Override void deleteById(Object id); @Override void deleteAll(Stream<Object> ids); @Override void deleteAll(); @Override void add(Entity entity); @Override Integer add(Stream<Entity> entities); @Override void forEachBatched(Fetch fetch, Consumer<List<Entity>> consumer, int batchSize);  }