public Page<Certificate> getAllCertificates(int pageIndex, int pageSize) {
        return certificateRepository.findAll(PageRequest.of(pageIndex, pageSize, Sort.by(Sort.Direction.ASC, "activeUntil")));
    }
@Test
    public void getAllCertificates() {
        when(certificateRepositoryMock.findAll(PageRequest.of(1, 10, Sort.by(Sort.Direction.ASC, "activeUntil")))).thenReturn(getPageCertificates());

        Page<Certificate> result = certificateServiceMock.getAllCertificates(1, 10);

        verify(certificateRepositoryMock, times(1)).findAll(PageRequest.of(1, 10, Sort.by(Sort.Direction.ASC, "activeUntil")));
        assertNotNull(result);
        assertEquals(1, result.getTotalPages());
        assertEquals(2, result.getContent().size());
    }