### Question:
AuthorityCheckerImpl implements AuthorityChecker { @Override public void verifyJarSignature(Certificate certificate, Path jarFilePath) throws IOException { try (JarFile jar = new JarFile(jarFilePath.toFile())) { JarVerifier verifier = new JarVerifier(jar); verifier.verify((X509Certificate) certificate); } } AuthorityCheckerImpl(Certificate caCertificate);  AuthorityCheckerImpl(String caCertificateUrl, String certificateSuffix, String intermediateCertificateName, String... certificatePrefixes);  AuthorityCheckerImpl(Certificate rootCertificate, String certificateSuffix, String intermediateCertificateName,
                                String... certificatePrefixes);  AuthorityCheckerImpl(String caCertificateUrl); String getCertificateSuffix(); void setCertificateSuffix(String certificateSuffix); String[] getCertificatePrefixes(); void setCertificatePrefixes(String[] certificatePrefixes); @Override boolean verifyCertificates(String certificateDirectory); @Override void verifyJarSignature(Certificate certificate, Path jarFilePath); @Override boolean verifyJarSignature(String certificateDirectory, Path jarFilePath);  }### Answer:
@Test public void testVerifyJar() throws Exception { Path jarFilePath = Files.createTempFile("apl-test", ".jar"); try { OutputStream jarOutputStream = Files.newOutputStream(jarFilePath); Certificate certificate = UpdaterUtil.readCertificate(("certs/1_2.crt")); PrivateKey key = RSAUtil.getPrivateKey("certs/1_2.key"); JarGenerator generator = new JarGenerator(jarOutputStream, certificate, key); generator.generate(); generator.close(); jarOutputStream.close(); new AuthorityCheckerImpl(loadRootCert()).verifyJarSignature(certificate, jarFilePath); } finally { Files.deleteIfExists(jarFilePath); } }
@Test public void testVerifyNotSignedJar() throws Exception { Path jarFilePath = Files.createTempFile("apl-test", ".jar"); try { OutputStream jarOutputStream = Files.newOutputStream(jarFilePath); Certificate certificate = UpdaterUtil.readCertificate("certs/1_2.crt"); JarGenerator generator = new JarGenerator(jarOutputStream); generator.generate(); generator.close(); jarOutputStream.close(); assertThrows(RuntimeException.class, () -> new AuthorityCheckerImpl(loadRootCert()).verifyJarSignature(certificate, jarFilePath)); } finally { Files.deleteIfExists(jarFilePath); } }