### Question:
SSLContextFactory { public SSLContext create(String x509Certificates, String rsaPrivateKey) throws GeneralSecurityException, IOException { assertHasText(x509Certificates, "x509Certificate is required"); assertHasText(rsaPrivateKey, "rsaPrivateKey is required"); SSLContext sslContext = createDefaultSSLContext(); PrivateKey privateKey = getPrivateKeyFromString(rsaPrivateKey); Certificate[] certificateChain = getCertificatesFromString(x509Certificates); KeyStore keystore = initializeKeyStore(privateKey, certificateChain); KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance("SunX509"); keyManagerFactory.init(keystore, noPassword); sslContext.init(keyManagerFactory.getKeyManagers(), null, null); return sslContext; } private  SSLContextFactory(); static SSLContextFactory getInstance(); SSLContext create(String x509Certificates, String rsaPrivateKey);  }### Answer:
@Test public void create_throwsOnNullValues() { assertThatThrownBy(() -> { cut.create(null, rsaPrivateKey); }).isInstanceOf(IllegalArgumentException.class).hasMessageStartingWith("x509Certificate"); assertThatThrownBy(() -> { cut.create(certificates, null); }).isInstanceOf(IllegalArgumentException.class).hasMessageStartingWith("rsaPrivateKey"); }
@Test public void create() throws GeneralSecurityException, IOException { assertThat(cut.create(certificates, rsaPrivateKey), is(notNullValue())); }