CommonCertificateSource implements CertificateSource { public CommonCertificateSource() { } CommonCertificateSource(); @Override CertificateToken addCertificate(final CertificateToken certificateToAdd); @Override boolean isKnown(CertificateToken token); @Override List<CertificateToken> getCertificates(); @Override List<CertificateSourceEntity> getEntities(); @Override Set<CertificateToken> getByPublicKey(PublicKey publicKey); @Override Set<CertificateToken> getBySki(byte[] ski); @Override Set<CertificateToken> getBySubject(X500PrincipalHelper subject); @Override Set<CertificateToken> getByCertificateIdentifier(CertificateIdentifier certificateIdentifier); int getNumberOfCertificates(); int getNumberOfEntities(); @Override CertificateSourceType getCertificateSourceType(); @Override boolean isTrusted(CertificateToken certificateToken); @Override boolean isAllSelfSigned();  }
@Test public void commonCertificateSource() { CommonCertificateSource ccc = new CommonCertificateSource(); assertFalse(ccc.isKnown(CERT)); assertFalse(ccc.isTrusted(CERT)); CertificateToken adddedCert = ccc.addCertificate(CERT); assertEquals(CERT, adddedCert); assertNotNull(ccc.getCertificates()); assertEquals(CertificateSourceType.OTHER, ccc.getCertificateSourceType()); assertEquals(1, ccc.getNumberOfCertificates()); assertEquals(1, ccc.getNumberOfEntities()); assertTrue(ccc.isKnown(CERT)); assertFalse(ccc.isTrusted(CERT)); ccc.reset(); assertFalse(ccc.isKnown(CERT)); assertFalse(ccc.isTrusted(CERT)); assertEquals(0, ccc.getNumberOfCertificates()); assertEquals(0, ccc.getNumberOfEntities()); }