### Question:
OrganizationByIdResponseResolver implements Function<UUID, Organization> { @Override public Organization apply(UUID id) { if (id == null) return null; return responseCache.computeIfAbsent(id, this::resolveUncached); } @Inject  OrganizationByIdResponseResolver(OrganizationResolver organizationResolver, Map<UUID, Organization> responseCache); @Override Organization apply(UUID id);  }### Answer:
@Test public void testConvertCachedOrganization() { UUID id = UUID.randomUUID(); Organization model = Organization.builder().build(); responseCache.put(id, model); assertSame(model, converter.apply(id)); verifyNoInteractions(organizationResolver); }
@Test public void testConvertUncachedOrganization() { UUID id = UUID.randomUUID(); Organization model = Organization.builder().build(); when(organizationResolver.resolveOrganization(id)).thenReturn(model); assertSame(model, converter.apply(id)); verify(organizationResolver).resolveOrganization(id); }
@Test public void testConvertUncachedOrganizationNotAvailable() { UUID id = UUID.randomUUID(); Organization model = converter.apply(id); assertNotNull(model); assertEquals(id, model.getId()); assertEquals("N/A", model.getName()); verify(organizationResolver).resolveOrganization(id); }
@Test public void testConvertNullReturnsNull() { assertNull(converter.apply(null)); }