SignatureAndHashAlgorithmDelegate extends Delegate { @Override public void applyDelegate(Config config) { if (signatureAndHashAlgorithms != null) { config.setAddSignatureAndHashAlgorithmsExtension(true); config.setDefaultClientSupportedSignatureAndHashAlgorithms(signatureAndHashAlgorithms); config.setDefaultServerSupportedSignatureAndHashAlgorithms(signatureAndHashAlgorithms); config.setDefaultSelectedSignatureAndHashAlgorithm(signatureAndHashAlgorithms.get(0)); } } SignatureAndHashAlgorithmDelegate(); List<SignatureAndHashAlgorithm> getSignatureAndHashAlgorithms(); void setSignatureAndHashAlgorithms(List<SignatureAndHashAlgorithm> signatureAndHashAlgorithms); @Override void applyDelegate(Config config);  }
@Test public void testApplyDelegate() { Config config = Config.createConfig(); args = new String[2]; args[0] = "-signature_hash_algo"; args[1] = "RSA_SHA512,DSA_SHA512"; delegate.setSignatureAndHashAlgorithms(null); jcommander.parse(args); config.setAddSignatureAndHashAlgorithmsExtension(false); assertFalse(config.isAddSignatureAndHashAlgrorithmsExtension()); delegate.applyDelegate(config); assertTrue(config.isAddSignatureAndHashAlgrorithmsExtension()); assertTrue(config.getDefaultClientSupportedSignatureAndHashAlgorithms().contains( SignatureAndHashAlgorithm.RSA_SHA512)); assertTrue(config.getDefaultClientSupportedSignatureAndHashAlgorithms().contains( SignatureAndHashAlgorithm.DSA_SHA512)); }
@Test public void testNothingSetNothingChanges() { Config config = Config.createConfig(); Config config2 = Config.createConfig(); delegate.applyDelegate(config); assertTrue(EqualsBuilder.reflectionEquals(config, config2, "keyStore", "ourCertificate")); }