CommonCertificateVerifier implements CertificateVerifier { @Override public void setTrustedCertSources(final CertificateSource... certSources) { this.trustedCertSources = new ListCertificateSource(); addTrustedCertSources(certSources); } CommonCertificateVerifier();  CommonCertificateVerifier(final boolean simpleCreationOnly);  CommonCertificateVerifier(final List<CertificateSource> trustedCertSources, final CRLSource crlSource, final OCSPSource ocspSource,
			final DataLoader dataLoader); @Override ListCertificateSource getTrustedCertSources(); @Override RevocationSource<OCSP> getOcspSource(); @Override RevocationSource<CRL> getCrlSource(); @Override void setCrlSource(final RevocationSource<CRL> crlSource); @Override void setOcspSource(final RevocationSource<OCSP> ocspSource); @Override @Deprecated void setTrustedCertSource(final CertificateSource trustedCertSource); @Override void setTrustedCertSources(final CertificateSource... certSources); @Override void addTrustedCertSources(final CertificateSource... certSources); @Override void setTrustedCertSources(ListCertificateSource trustedListCertificateSource); @Override ListCertificateSource getAdjunctCertSources(); @Override @Deprecated void setAdjunctCertSource(final CertificateSource adjunctCertSource); @Override void setAdjunctCertSources(final CertificateSource... certSources); @Override void addAdjunctCertSources(final CertificateSource... certSources); @Override void setAdjunctCertSources(ListCertificateSource adjunctListCertificateSource); @Override DataLoader getDataLoader(); @Override void setDataLoader(final DataLoader dataLoader); @Override ListRevocationSource<CRL> getSignatureCRLSource(); @Override void setSignatureCRLSource(final ListRevocationSource<CRL> signatureCRLSource); @Override ListRevocationSource<OCSP> getSignatureOCSPSource(); @Override void setSignatureOCSPSource(final ListRevocationSource<OCSP> signatureOCSPSource); @Override ListCertificateSource getSignatureCertificateSource(); @Override void setSignatureCertificateSource(ListCertificateSource signatureCertificateSource); @Override StatusAlert getAlertOnInvalidTimestamp(); @Override void setAlertOnInvalidTimestamp(StatusAlert alertOnInvalidTimestamp); @Override StatusAlert getAlertOnMissingRevocationData(); @Override void setAlertOnMissingRevocationData(StatusAlert alertOnMissingRevocationData); @Override StatusAlert getAlertOnUncoveredPOE(); @Override void setAlertOnUncoveredPOE(StatusAlert alertOnUncoveredPOE); @Override StatusAlert getAlertOnRevokedCertificate(); @Override void setAlertOnRevokedCertificate(StatusAlert alertOnRevokedCertificate); @Override StatusAlert getAlertOnNoRevocationAfterBestSignatureTime(); @Override void setAlertOnNoRevocationAfterBestSignatureTime(StatusAlert alertOnNoRevocationAfterBestSignatureTime); @Override boolean isCheckRevocationForUntrustedChains(); @Override void setCheckRevocationForUntrustedChains(boolean checkRevocationForUntrustedChains); @Override void setDefaultDigestAlgorithm(DigestAlgorithm digestAlgorithm); @Override DigestAlgorithm getDefaultDigestAlgorithm();  }
@Test public void testNotTrustedCertificateSource() { CommonCertificateVerifier ccv = new CommonCertificateVerifier(); CommonCertificateSource commonCertificateSource = new CommonCertificateSource(); Exception exception = assertThrows(DSSException.class, () -> ccv.setTrustedCertSources(commonCertificateSource)); assertEquals("The certificateSource with type [OTHER] is not allowed in the trustedCertSources. Please, " + "use CertificateSource with a type TRUSTED_STORE or TRUSTED_LIST.", exception.getMessage()); CommonTrustedCertificateSource commonTrustedCertificateSource = new CommonTrustedCertificateSource(); exception = assertThrows(DSSException.class, () -> ccv.setTrustedCertSources(commonTrustedCertificateSource, commonCertificateSource)); assertEquals("The certificateSource with type [OTHER] is not allowed in the trustedCertSources. Please, " + "use CertificateSource with a type TRUSTED_STORE or TRUSTED_LIST.", exception.getMessage()); }