CertificateFetcher { public static PublicKey fetchServerPublicKey(Config config) { X509CertificateObject cert; try { Certificate fetchedServerCertificate = fetchServerCertificate(config); if (fetchedServerCertificate != null && fetchedServerCertificate.getLength() > 0) { cert = new X509CertificateObject(fetchedServerCertificate.getCertificateAt(0)); return cert.getPublicKey(); } } catch (CertificateParsingException ex) { throw new WorkflowExecutionException("Could not get public key from server certificate", ex); } return null; } private  CertificateFetcher(); static PublicKey fetchServerPublicKey(Config config); static Certificate fetchServerCertificate(Config config);  }
@Test @Category(IntegrationTests.class) public void testFetchServerPublicKey() { PublicKey actual = CertificateFetcher.fetchServerPublicKey(config); assertNotNull(actual); assertEquals(expectedPublicKey, actual); }