### Question:
DefaultAuditAccessor implements AuditAccessor { @Override public Optional<Long> findMatchingAuditId(Long notificationId, UUID commonDistributionId) { return auditEntryRepository.findMatchingAudit(notificationId, commonDistributionId).map(AuditEntryEntity::getId); } @Autowired  DefaultAuditAccessor(AuditEntryRepository auditEntryRepository, AuditNotificationRepository auditNotificationRepository, ConfigurationAccessor configurationAccessor,
        DefaultNotificationAccessor notificationAccessor, ContentConverter contentConverter); @Override Optional<Long> findMatchingAuditId(Long notificationId, UUID commonDistributionId); @Override @Transactional Optional<AuditJobStatusModel> findFirstByJobId(UUID jobId); @Override @Transactional AuditEntryPageModel getPageOfAuditEntries(Integer pageNumber, Integer pageSize, String searchTerm, String sortField, String sortOrder, boolean onlyShowSentNotifications,
        Function<AlertNotificationModel, AuditEntryModel> notificationToAuditEntryConverter); @Override @Transactional Map<Long, Long> createAuditEntry(Map<Long, Long> existingNotificationIdToAuditId, UUID jobId, MessageContentGroup contentGroup); @Override @Transactional void setAuditEntrySuccess(Collection<Long> auditEntryIds); @Override @Transactional void setAuditEntryFailure(Collection<Long> auditEntryIds, String errorMessage, Throwable t); @Override @Transactional AuditEntryModel convertToAuditEntryModelFromNotification(AlertNotificationModel notificationContentEntry);  }### Answer:
@Test public void findMatchingAuditIdTest() { AuditEntryRepository auditEntryRepository = Mockito.mock(AuditEntryRepository.class); Mockito.when(auditEntryRepository.findMatchingAudit(Mockito.anyLong(), Mockito.any(UUID.class))).thenReturn(Optional.empty()); DefaultAuditAccessor auditUtility = new DefaultAuditAccessor(auditEntryRepository, null, null, null, null); Optional<Long> nullValue = auditUtility.findMatchingAuditId(1L, UUID.randomUUID()); assertFalse(nullValue.isPresent()); AuditEntryEntity auditEntryEntity = new AuditEntryEntity(null, null, null, null, null, null); Long expectedLong = 2L; auditEntryEntity.setId(expectedLong); Mockito.when(auditEntryRepository.findMatchingAudit(Mockito.anyLong(), Mockito.any(UUID.class))).thenReturn(Optional.of(auditEntryEntity)); Optional<Long> actualValue = auditUtility.findMatchingAuditId(expectedLong, UUID.randomUUID()); assertTrue(actualValue.isPresent()); assertEquals(expectedLong, actualValue.get()); }