public Certificate getCertificate(Long id) {
        Optional<Certificate> cert = certificateRepository.findById(id);
        if (!cert.isPresent()) {
            throw new NotFoundException("Could not find certificate with id: " + id);
        }
        return cert.get();
    }
@Test
    public void certificateNotFound() {
        Optional<Certificate> certificateOptional = Optional.empty();
        when(certificateRepositoryMock.findById(anyLong())).thenReturn(certificateOptional);

        assertThrows(NotFoundException.class, () -> {
            certificateServiceMock.getCertificate(anyLong());
        });
    }