### Question:
FactManager implements LifecycleAspect { public FactTypeEntity saveFactType(FactTypeEntity type) { if (type == null) return null; FactTypeEntity existing = getFactType(type.getName()); if (existing != null && !Objects.equals(existing.getId(), type.getId()) && Objects.equals(existing.getName(), type.getName())) { throw new IllegalArgumentException(String.format("FactType with name = %s already exists.", type.getName())); } factTypeDao.save(type); factTypeByIdCache.invalidate(type.getId()); factTypeByNameCache.invalidate(type.getName()); return type; } @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(expected = IllegalArgumentException.class) public void testSaveFactTypeWithSameNameThrowsException() { getFactManager().saveFactType(createFactType("factType")); getFactManager().saveFactType(createFactType("factType")); }
@Test public void testSaveFactTypeReturnsSameEntity() { FactTypeEntity entity = createFactType(); assertSame(entity, getFactManager().saveFactType(entity)); }
@Test public void testSaveFactTypeReturnsNullOnNullInput() { assertNull(getFactManager().saveFactType(null)); }