### Question:
ObjectFactDaoFacade implements ObjectFactDao { @Override public FactCommentRecord storeFactComment(FactRecord fact, FactCommentRecord comment) { if (fact == null || comment == null) return null; saveComment(fact, comment); return comment; } @Inject  ObjectFactDaoFacade(ObjectManager objectManager,
                             FactManager factManager,
                             FactSearchManager factSearchManager,
                             ObjectRecordConverter objectRecordConverter,
                             FactRecordConverter factRecordConverter,
                             FactAclEntryRecordConverter factAclEntryRecordConverter,
                             FactCommentRecordConverter factCommentRecordConverter,
                             Consumer<FactRecord> dcReplicationConsumer); @Override ObjectRecord getObject(UUID id); @Override ObjectRecord getObject(String type, String value); @Override ObjectRecord storeObject(ObjectRecord record); @Override ObjectStatisticsContainer calculateObjectStatistics(ObjectStatisticsCriteria criteria); @Override ResultContainer<ObjectRecord> searchObjects(FactSearchCriteria criteria); @Override FactRecord getFact(UUID id); @Override FactRecord storeFact(FactRecord record); @Override FactRecord refreshFact(FactRecord record); @Override FactRecord retractFact(FactRecord record); @Override ResultContainer<FactRecord> retrieveExistingFacts(FactRecord record); @Override ResultContainer<FactRecord> searchFacts(FactSearchCriteria criteria); @Override FactAclEntryRecord storeFactAclEntry(FactRecord fact, FactAclEntryRecord aclEntry); @Override FactCommentRecord storeFactComment(FactRecord fact, FactCommentRecord comment);  }### Answer:
@Test public void testStoreFactCommentWithNull() { assertNull(dao.storeFactComment(new FactRecord(), null)); assertNull(dao.storeFactComment(null, new FactCommentRecord())); }
@Test public void testStoreFactCommentSavesEntity() { FactRecord fact = new FactRecord().setId(UUID.randomUUID()); FactCommentRecord comment = new FactCommentRecord().setId(UUID.randomUUID()); when(factCommentRecordConverter.toEntity(comment, fact.getId())).thenReturn(new FactCommentEntity()); assertSame(comment, dao.storeFactComment(fact, comment)); verify(factManager).saveFactComment(notNull()); verify(factCommentRecordConverter).toEntity(argThat(r -> r.getId() == comment.getId()), eq(fact.getId())); }
@Test public void testStoreFactCommentSetsId() { FactRecord fact = new FactRecord().setId(UUID.randomUUID()); FactCommentRecord comment = new FactCommentRecord(); when(factCommentRecordConverter.toEntity(comment, fact.getId())).thenReturn(new FactCommentEntity()); assertSame(comment, dao.storeFactComment(fact, comment)); verify(factManager).saveFactComment(notNull()); verify(factCommentRecordConverter).toEntity(argThat(r -> r.getId() != null), eq(fact.getId())); }