@Test
public void testGenerateX509CertificateWithExpiry() {

    int certExpiryMins = 60;
    try (KeyStoreCertSigner keyStoreCertSigner = new KeyStoreCertSigner(CA_CERT, CA_KEY, 43200)) {
        String certPem = keyStoreCertSigner.generateX509Certificate(CLIENT_CSR_PEM, null, certExpiryMins);
        X509Certificate cert = Crypto.loadX509Certificate(certPem);
        long certExpiry = Duration.between(cert.getNotBefore().toInstant(), cert.getNotAfter().toInstant()).toMinutes();
        // assertion
        Assert.assertEquals(cert.getIssuerX500Principal().getName(), "CN=Sample Self Signed Intermediate CA,O=Athenz,C=US");
        Assert.assertEquals(cert.getSubjectX500Principal().getName(), "CN=sys.auth.zts,O=Athenz,C=US");
        Assert.assertEquals(certExpiry, 60);
    }
}