@Test void findAllAsStreamNoFetch() { when(delegateRepository.getEntityType()).thenReturn(entityType); Entity entity0 = mock(Entity.class); @SuppressWarnings("unchecked") Query<Entity> query = mock(Query.class); Stream<Entity> entities = Stream.of(entity0); when(delegateRepository.findAll(query)).thenReturn(entities); when(entityManager.resolveReferences(entityType, entities, null)).thenReturn(entities); Stream<Entity> expectedEntities = entityReferenceResolverDecorator.findAll(query); assertEquals(singletonList(entity0), expectedEntities.collect(toList())); }
@Override public Stream<Entity> findAll(Query<Entity> q) { Stream<Entity> entities = delegate().findAll(q); return resolveEntityReferences(entities, q.getFetch()); }
EntityReferenceResolverDecorator extends AbstractRepositoryDecorator<Entity> { @Override public Stream<Entity> findAll(Query<Entity> q) { Stream<Entity> entities = delegate().findAll(q); return resolveEntityReferences(entities, q.getFetch()); } }
EntityReferenceResolverDecorator extends AbstractRepositoryDecorator<Entity> { @Override public Stream<Entity> findAll(Query<Entity> q) { Stream<Entity> entities = delegate().findAll(q); return resolveEntityReferences(entities, q.getFetch()); } EntityReferenceResolverDecorator(
      Repository<Entity> delegateRepository, EntityManager entityManager); }
EntityReferenceResolverDecorator extends AbstractRepositoryDecorator<Entity> { @Override public Stream<Entity> findAll(Query<Entity> q) { Stream<Entity> entities = delegate().findAll(q); return resolveEntityReferences(entities, q.getFetch()); } EntityReferenceResolverDecorator(
      Repository<Entity> delegateRepository, EntityManager entityManager); @Override Stream<Entity> findAll(Query<Entity> q); @Override Entity findOne(Query<Entity> q); @Override Iterator<Entity> iterator(); @Override void forEachBatched(Fetch fetch, Consumer<List<Entity>> consumer, int batchSize); @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); }
EntityReferenceResolverDecorator extends AbstractRepositoryDecorator<Entity> { @Override public Stream<Entity> findAll(Query<Entity> q) { Stream<Entity> entities = delegate().findAll(q); return resolveEntityReferences(entities, q.getFetch()); } EntityReferenceResolverDecorator(
      Repository<Entity> delegateRepository, EntityManager entityManager); @Override Stream<Entity> findAll(Query<Entity> q); @Override Entity findOne(Query<Entity> q); @Override Iterator<Entity> iterator(); @Override void forEachBatched(Fetch fetch, Consumer<List<Entity>> consumer, int batchSize); @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);  }