@Test void findOneQueryEntity() { when(delegateRepository.getEntityType()).thenReturn(entityType); Fetch fetch = new Fetch(); @SuppressWarnings("unchecked") Query<Entity> q = mock(Query.class); when(q.getFetch()).thenReturn(fetch); Entity entity = mock(Entity.class); when(delegateRepository.findOne(q)).thenReturn(entity); entityReferenceResolverDecorator.findOne(q); verify(delegateRepository, times(1)).findOne(q); verify(entityManager).resolveReferences(entityType, entity, fetch); }
@Override public Entity findOne(Query<Entity> q) { Entity entity = delegate().findOne(q); return entity != null ? resolveEntityReferences(entity, q.getFetch()) : null; }
EntityReferenceResolverDecorator extends AbstractRepositoryDecorator<Entity> { @Override public Entity findOne(Query<Entity> q) { Entity entity = delegate().findOne(q); return entity != null ? resolveEntityReferences(entity, q.getFetch()) : null; } }
EntityReferenceResolverDecorator extends AbstractRepositoryDecorator<Entity> { @Override public Entity findOne(Query<Entity> q) { Entity entity = delegate().findOne(q); return entity != null ? resolveEntityReferences(entity, q.getFetch()) : null; } EntityReferenceResolverDecorator(
      Repository<Entity> delegateRepository, EntityManager entityManager); }
EntityReferenceResolverDecorator extends AbstractRepositoryDecorator<Entity> { @Override public Entity findOne(Query<Entity> q) { Entity entity = delegate().findOne(q); return entity != null ? resolveEntityReferences(entity, q.getFetch()) : null; } 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 Entity findOne(Query<Entity> q) { Entity entity = delegate().findOne(q); return entity != null ? resolveEntityReferences(entity, q.getFetch()) : null; } 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);  }