### Question:
FactManager implements LifecycleAspect { public FactEntity retractFact(UUID id) { FactEntity fact = getFact(id); if (fact == null) throw new IllegalArgumentException(String.format("Fact with id = %s does not exist.", id)); factDao.save(fact.addFlag(FactEntity.Flag.RetractedHint)); return fact; } @Inject  FactManager(ClusterManager clusterManager); @Override void startComponent(); @Override void stopComponent(); FactTypeEntity getFactType(UUID id); FactTypeEntity getFactType(String name); List<FactTypeEntity> fetchFactTypes(); FactTypeEntity saveFactType(FactTypeEntity type); FactEntity getFact(UUID id); Iterator<FactEntity> getFacts(List<UUID> id); FactEntity saveFact(FactEntity fact); FactEntity refreshFact(UUID id); FactEntity retractFact(UUID id); List<FactAclEntity> fetchFactAcl(UUID id); FactAclEntity saveFactAclEntry(FactAclEntity entry); List<FactCommentEntity> fetchFactComments(UUID id); FactCommentEntity saveFactComment(FactCommentEntity comment); List<MetaFactBindingEntity> fetchMetaFactBindings(UUID id); MetaFactBindingEntity saveMetaFactBinding(MetaFactBindingEntity binding);  }### Answer:
@Test public void testRetractFact() { FactEntity fact = createAndSaveFact(); assertEquals(Collections.emptySet(), getFactManager().getFact(fact.getId()).getFlags()); FactEntity retractedFact = getFactManager().retractFact(fact.getId()); assertEquals(fact.getId(), retractedFact.getId()); assertEquals(Collections.singleton(FactEntity.Flag.RetractedHint), retractedFact.getFlags()); assertEquals(Collections.singleton(FactEntity.Flag.RetractedHint), getFactManager().getFact(fact.getId()).getFlags()); }
@Test(expected = IllegalArgumentException.class) public void testRetractFactWithNonExistingFact() { getFactManager().retractFact(UUID.randomUUID()); }