### Question:
FactTypeRequestResolver { public FactTypeEntity fetchExistingFactType(UUID id) throws ObjectNotFoundException { FactTypeEntity entity = factManager.getFactType(id); if (entity == null) { throw new ObjectNotFoundException(String.format("FactType with id = %s does not exist.", id), "fact.type.not.exist", "id", ObjectUtils.ifNotNull(id, Object::toString, "NULL")); } return entity; } @Inject  FactTypeRequestResolver(FactManager factManager); FactTypeEntity fetchExistingFactType(UUID id); FactTypeEntity resolveFactType(String type); FactTypeEntity resolveRetractionFactType();  }### Answer:
@Test public void testFetchFactType() throws Exception { UUID id = UUID.randomUUID(); FactTypeEntity entity = new FactTypeEntity(); when(factManager.getFactType(id)).thenReturn(entity); assertSame(entity, resolver.fetchExistingFactType(id)); }
@Test public void testFetchFactTypeNotFound() { UUID id = UUID.randomUUID(); assertThrows(ObjectNotFoundException.class, () -> resolver.fetchExistingFactType(id)); verify(factManager).getFactType(id); }