DefaultCertificateManager implements CertificateManager { public synchronized void add(KeyPair keyPair, X509Certificate certificate) { add(keyPair, new X509Certificate[]{certificate}); } DefaultCertificateManager();  DefaultCertificateManager(KeyPair keyPair, X509Certificate certificate);  DefaultCertificateManager(KeyPair keyPair, X509Certificate[] certificateChain); synchronized void add(KeyPair keyPair, X509Certificate certificate); synchronized void add(KeyPair keyPair, X509Certificate[] certificateChain); synchronized void remove(ByteString thumbprint); synchronized void replace(ByteString thumbprint, KeyPair keyPair, X509Certificate[] certificateChain); @Override synchronized Optional<KeyPair> getKeyPair(ByteString thumbprint); @Override synchronized Optional<X509Certificate> getCertificate(ByteString thumbprint); @Override synchronized Optional<X509Certificate[]> getCertificateChain(ByteString thumbprint); @Override synchronized Set<KeyPair> getKeyPairs(); @Override synchronized Set<X509Certificate> getCertificates();  }
@Test public void testNullPrivateKeyOrCertificateFails() { expectThrows( Exception.class, () -> new DefaultCertificateManager((KeyPair) null, (X509Certificate) null) ); expectThrows( Exception.class, () -> new DefaultCertificateManager().add(null, (X509Certificate) null) ); }