### Question:
WorkItemIconCacheImpl implements WorkItemIconCache { @Override public Promise<String> getIcon(String iconPath) { return cachedIcons.computeIfAbsent(iconPath, this::lookupPromise); } @Inject  WorkItemIconCacheImpl(final ResourceContentService resourceContentService); @Override Promise<String> getIcon(String iconPath);  }### Answer:
@Test public void testGetSingleIcon() { Promise<String> promise = cache.getIcon(ICON_1); verify(resourceContentService).get(anyString(), any()); Assertions.assertThat(promise).isNotNull(); }
@Test public void testGetDifferentIcons() { Promise<String> promise1 = cache.getIcon(ICON_1); verify(resourceContentService).get(anyString(), any()); Assertions.assertThat(promise1).isNotNull(); Promise<String> promise2 = cache.getIcon(ICON_2); verify(resourceContentService, times(2)).get(anyString(), any()); Assertions.assertThat(promise2) .isNotNull() .isNotSameAs(promise1); }
@Test public void testGetSameIcon() { Promise<String> promise1 = cache.getIcon(ICON_1); verify(resourceContentService).get(anyString(), any()); Assertions.assertThat(promise1).isNotNull(); Promise<String> promise2 = cache.getIcon(ICON_1); verify(resourceContentService, times(1)).get(anyString(), any()); Assertions.assertThat(promise2) .isNotNull() .isSameAs(promise1); }