### Question:
FactManager implements LifecycleAspect { public MetaFactBindingEntity saveMetaFactBinding(MetaFactBindingEntity binding) { if (binding == null) return null; if (getFact(binding.getFactID()) == null) throw new IllegalArgumentException(String.format("Fact with id = %s does not exist.", binding.getFactID())); if (factDao.getMetaFactBinding(binding.getFactID(), binding.getMetaFactID()) != null) throw new ImmutableViolationException("It is not allowed to update a MetaFactBinding."); factDao.save(binding); return binding; } @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 testSaveMetaFactBindingReturnsSameEntity() { MetaFactBindingEntity binding = createMetaFactBinding(createAndSaveFact().getId()); assertSame(binding, getFactManager().saveMetaFactBinding(binding)); }
@Test public void testSaveMetaFactBindingReturnsNullOnNullInput() { assertNull(getFactManager().saveMetaFactBinding(null)); }
@Test(expected = IllegalArgumentException.class) public void testSaveMetaFactBindingWithNonExistingFactThrowsException() { getFactManager().saveMetaFactBinding(createMetaFactBinding(UUID.randomUUID())); }
@Test(expected = ImmutableViolationException.class) public void testSaveMetaFactBindingTwiceThrowsException() { MetaFactBindingEntity binding = createMetaFactBinding(createAndSaveFact().getId()); getFactManager().saveMetaFactBinding(binding); getFactManager().saveMetaFactBinding(binding); }