@Test public void addCreatesADifferentIdEachCall() { UUID id1 = instance.add(searchResult); UUID id2 = instance.add(searchResult); assertThat(id1, is(not(id2))); }
public UUID add(SearchResult searchResult) { UUID id = UUID.randomUUID(); cache.put(id, searchResult); searchResult.setId(id); return id; }
SearchStore { public UUID add(SearchResult searchResult) { UUID id = UUID.randomUUID(); cache.put(id, searchResult); searchResult.setId(id); return id; } }
SearchStore { public UUID add(SearchResult searchResult) { UUID id = UUID.randomUUID(); cache.put(id, searchResult); searchResult.setId(id); return id; } SearchStore(Timeout searchResultAvailabilityTime); }
SearchStore { public UUID add(SearchResult searchResult) { UUID id = UUID.randomUUID(); cache.put(id, searchResult); searchResult.setId(id); return id; } SearchStore(Timeout searchResultAvailabilityTime); Optional<SearchResult> getSearchResult(UUID id); UUID add(SearchResult searchResult); }
SearchStore { public UUID add(SearchResult searchResult) { UUID id = UUID.randomUUID(); cache.put(id, searchResult); searchResult.setId(id); return id; } SearchStore(Timeout searchResultAvailabilityTime); Optional<SearchResult> getSearchResult(UUID id); UUID add(SearchResult searchResult);  }