### Question:
CachingRepository implements Repository { @Override public CompletableFuture<Map<String, Entry<?>>> find(Revision revision, String pathPattern, Map<FindOption<?>, ?> options) { requireNonNull(revision, "revision"); requireNonNull(pathPattern, "pathPattern"); requireNonNull(options, "options"); final Revision normalizedRevision = normalizeNow(revision); return cache.get(new CacheableFindCall(repo, normalizedRevision, pathPattern, options)); } CachingRepository(Repository repo, RepositoryCache cache); @Override long creationTimeMillis(); @Override Author author(); @Override CompletableFuture<Entry<T>> getOrNull(Revision revision, Query<T> query); @Override CompletableFuture<Map<String, Entry<?>>> find(Revision revision, String pathPattern,
                                                         Map<FindOption<?>, ?> options); @Override CompletableFuture<List<Commit>> history(Revision from, Revision to,
                                                   String pathPattern, int maxCommits); @Override CompletableFuture<Change<?>> diff(Revision from, Revision to, Query<?> query); @Override CompletableFuture<Map<String, Change<?>>> diff(Revision from, Revision to, String pathPattern); @Override CompletableFuture<Revision> findLatestRevision(Revision lastKnownRevision, String pathPattern); @Override CompletableFuture<Revision> watch(Revision lastKnownRevision, String pathPattern); @Override Project parent(); @Override String name(); @Override Revision normalizeNow(Revision revision); @Override RevisionRange normalizeNow(Revision from, Revision to); @Override CompletableFuture<Map<String, Change<?>>> previewDiff(Revision baseRevision,
                                                                 Iterable<Change<?>> changes); @Override CompletableFuture<Revision> commit(Revision baseRevision, long commitTimeMillis,
                                              Author author, String summary, String detail, Markup markup,
                                              Iterable<Change<?>> changes); @Override CompletableFuture<MergedEntry<T>> mergeFiles(Revision revision, MergeQuery<T> query); @Override String toString();  }### Answer:
@Test void find() { final Repository repo = setMockNames(newCachingRepo()); final Map<String, Entry<?>> entries = ImmutableMap.of("/baz.txt", Entry.ofText(new Revision(10), "/baz.txt", "qux")); doReturn(new Revision(10)).when(delegateRepo).normalizeNow(new Revision(10)); doReturn(new Revision(10)).when(delegateRepo).normalizeNow(HEAD); when(delegateRepo.find(any(), any(), any())).thenReturn(completedFuture(entries)); assertThat(repo.find(HEAD, "/**", ImmutableMap.of()).join()).isEqualTo(entries); verify(delegateRepo).find(new Revision(10), "/**", ImmutableMap.of()); verifyNoMoreInteractions(delegateRepo); clearInvocations(delegateRepo); assertThat(repo.find(HEAD, "/**", ImmutableMap.of()).join()).isEqualTo(entries); assertThat(repo.find(new Revision(10), "/**", ImmutableMap.of()).join()).isEqualTo(entries); verify(delegateRepo, never()).find(any(), any(), any()); verifyNoMoreInteractions(delegateRepo); }