@Test void testFindOneByIdFetch() { EntityType entityType = mock(EntityType.class); when(delegateRepository.getEntityType()).thenReturn(entityType); Object entityId = mock(Object.class); Fetch fetch = mock(Fetch.class); Entity entity = mock(Entity.class); when(l1Cache.get(entityType, entityId, fetch)).thenReturn(Optional.of(CacheHit.of(entity))); assertEquals(entity, l1CacheRepositoryDecorator.findOneById(entityId, fetch)); verifyNoMoreInteractions(l1Cache, delegateRepository); }
@Override public Entity findOneById(Object id) { return useCache() ? findOneByIdWithCache(id, null) : delegate().findOneById(id); }
L1CacheRepositoryDecorator extends AbstractRepositoryDecorator<Entity> { @Override public Entity findOneById(Object id) { return useCache() ? findOneByIdWithCache(id, null) : delegate().findOneById(id); } }
L1CacheRepositoryDecorator extends AbstractRepositoryDecorator<Entity> { @Override public Entity findOneById(Object id) { return useCache() ? findOneByIdWithCache(id, null) : delegate().findOneById(id); } L1CacheRepositoryDecorator(
      Repository<Entity> delegateRepository, L1Cache l1Cache, L1CacheJanitor l1CacheJanitor); }
L1CacheRepositoryDecorator extends AbstractRepositoryDecorator<Entity> { @Override public Entity findOneById(Object id) { return useCache() ? findOneByIdWithCache(id, null) : delegate().findOneById(id); } L1CacheRepositoryDecorator(
      Repository<Entity> delegateRepository, L1Cache l1Cache, L1CacheJanitor l1CacheJanitor); @Override void add(Entity entity); @Override Integer add(Stream<Entity> entities); @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 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(); }
L1CacheRepositoryDecorator extends AbstractRepositoryDecorator<Entity> { @Override public Entity findOneById(Object id) { return useCache() ? findOneByIdWithCache(id, null) : delegate().findOneById(id); } L1CacheRepositoryDecorator(
      Repository<Entity> delegateRepository, L1Cache l1Cache, L1CacheJanitor l1CacheJanitor); @Override void add(Entity entity); @Override Integer add(Stream<Entity> entities); @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 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();  }