@Override
    protected Collection<X509Certificate> getTrusted() {
        return repository.findTrustedCscaCertificates().stream().map(
                c -> X509Factory.toCertificate(c.getRaw())
        ).collect(Collectors.toList());
    }
@Test
    public void shouldNotLoadCertificateIfNoTrustedInDocumentType() throws CertificateException, IOException {
        final Certificate rdw = loadCertificate("rdw/acc/csca.crt", true);
        final Certificate nik = loadCertificate("nik/tv/csca.crt", false);
        certificateRepo.save(rdw);
        certificateRepo.save(nik);
        certificateRepo.flush();

        final Collection<X509Certificate> trusted = service.getTrusted();
        assertEquals(1, trusted.size());
        assertEquals(rdw.getSubject(),
            X509Factory.toCanonical(trusted.toArray(new X509Certificate[0])[0].getSubjectX500Principal()));
    }