### Question:
DefaultNotificationAccessor implements NotificationAccessor { @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED) public Page<AlertNotificationModel> findAllWithSearch(String searchTerm, PageRequest pageRequest, boolean onlyShowSentNotifications) { String lcSearchTerm = searchTerm.toLowerCase(Locale.ENGLISH); Page<NotificationEntity> matchingNotifications; if (onlyShowSentNotifications) { matchingNotifications = notificationContentRepository.findMatchingSentNotification(lcSearchTerm, pageRequest); } else { matchingNotifications = notificationContentRepository.findMatchingNotification(lcSearchTerm, pageRequest); } return matchingNotifications.map(this::toModel); } @Autowired  DefaultNotificationAccessor(NotificationContentRepository notificationContentRepository, AuditEntryRepository auditEntryRepository, AuditNotificationRepository auditNotificationRepository,
        ConfigurationAccessor configurationAccessor, EventManager eventManager); @Override List<AlertNotificationModel> saveAllNotifications(Collection<AlertNotificationModel> notifications); @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED) Page<AlertNotificationModel> findAll(PageRequest pageRequest, boolean onlyShowSentNotifications); @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED) Page<AlertNotificationModel> findAllWithSearch(String searchTerm, PageRequest pageRequest, boolean onlyShowSentNotifications); @Override @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED) List<AlertNotificationModel> findByIds(List<Long> notificationIds); @Override @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED) Optional<AlertNotificationModel> findById(Long notificationId); @Override @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED) List<AlertNotificationModel> findByCreatedAtBetween(OffsetDateTime startDate, OffsetDateTime endDate); @Override @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED) List<AlertNotificationModel> findByCreatedAtBefore(OffsetDateTime date); @Override List<AlertNotificationModel> findByCreatedAtBeforeDayOffset(int dayOffset); @Override void deleteNotificationList(List<AlertNotificationModel> notifications); @Override void deleteNotification(AlertNotificationModel notification); PageRequest getPageRequestForNotifications(Integer pageNumber, Integer pageSize, String sortField, String sortOrder);  }### Answer:
@Test public void findAllWithSearchTest() throws Exception { final String searchTerm = "searchTerm-test"; PageRequest pageRequest = PageRequest.of(0, 10); NotificationEntity notificationEntity = new NotificationEntity(id, DateUtils.createCurrentDateTimestamp(), provider, providerConfigId, DateUtils.createCurrentDateTimestamp(), notificationType, content); Page<NotificationEntity> notificationEntityPage = new PageImpl<>(List.of(notificationEntity)); ConfigurationModel configurationModel = createConfigurationModel(); NotificationContentRepository notificationContentRepository = Mockito.mock(NotificationContentRepository.class); ConfigurationAccessor configurationAccessor = Mockito.mock(ConfigurationAccessor.class); Mockito.when(notificationContentRepository.findMatchingSentNotification(Mockito.any(), Mockito.any())).thenReturn(notificationEntityPage); Mockito.when(configurationAccessor.getConfigurationById(Mockito.any())).thenReturn(Optional.of(configurationModel)); Mockito.when(notificationContentRepository.findMatchingNotification(Mockito.any(), Mockito.any())).thenReturn(notificationEntityPage); DefaultNotificationAccessor notificationManager = new DefaultNotificationAccessor(notificationContentRepository, null, null, configurationAccessor, null); Page<AlertNotificationModel> alertNotificationModelPage = notificationManager.findAllWithSearch(searchTerm, pageRequest, Boolean.TRUE); Page<AlertNotificationModel> alertNotificationModelPageShowNotificationsFalse = notificationManager.findAllWithSearch(searchTerm, pageRequest, Boolean.FALSE); assertEquals(1, alertNotificationModelPage.getTotalPages()); AlertNotificationModel testAlertNotificationModel = alertNotificationModelPage.getContent().get(0); testExpectedAlertNotificationModel(expectedAlertNotificationModel, testAlertNotificationModel); assertEquals(1, alertNotificationModelPageShowNotificationsFalse.getTotalPages()); AlertNotificationModel testAlertNotificationModel2 = alertNotificationModelPageShowNotificationsFalse.getContent().get(0); testExpectedAlertNotificationModel(expectedAlertNotificationModel, testAlertNotificationModel2); }