### Question:
DefaultNotificationAccessor implements NotificationAccessor { public PageRequest getPageRequestForNotifications(Integer pageNumber, Integer pageSize, String sortField, String sortOrder) { Integer page = ObjectUtils.defaultIfNull(pageNumber, 0); Integer size = ObjectUtils.defaultIfNull(pageSize, Integer.MAX_VALUE); boolean sortQuery = false; String sortingField = "createdAt"; if (StringUtils.isNotBlank(sortField) && "createdAt".equalsIgnoreCase(sortField) || "provider".equalsIgnoreCase(sortField) || "providerCreationTime".equalsIgnoreCase(sortField) || "notificationType".equalsIgnoreCase(sortField) || "content".equalsIgnoreCase(sortField)) { sortingField = sortField; sortQuery = true; } Sort.Order sortingOrder = Sort.Order.desc(sortingField); if (StringUtils.isNotBlank(sortOrder) && sortQuery && Sort.Direction.ASC.name().equalsIgnoreCase(sortOrder)) { sortingOrder = Sort.Order.asc(sortingField); } return PageRequest.of(page, size, Sort.by(sortingOrder)); } @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 getPageRequestForNotificationsTest() { final int pageNumber = 1; final int pageSize = 1; final String sortField = "content"; String sortOrder = Sort.Direction.ASC.name(); NotificationContentRepository notificationContentRepository = Mockito.mock(NotificationContentRepository.class); AuditEntryRepository auditEntryRepository = Mockito.mock(AuditEntryRepository.class); AuditNotificationRepository auditNotificationRepository = Mockito.mock(AuditNotificationRepository.class); ConfigurationAccessor configurationAccessor = Mockito.mock(ConfigurationAccessor.class); DefaultNotificationAccessor notificationManager = new DefaultNotificationAccessor(notificationContentRepository, auditEntryRepository, auditNotificationRepository, configurationAccessor, null); PageRequest pageRequest = notificationManager.getPageRequestForNotifications(pageNumber, pageSize, sortField, sortOrder); assertEquals(pageNumber, pageRequest.getPageNumber()); assertEquals(pageSize, pageRequest.getPageSize()); }