@Test
    public void testMismatchedAlgorithm() {
        ServiceTester.test("CertificateFactory")
            .withAlgorithm("X509")
            .run((p, algorithm) -> {
                try {
                    X509Certificate c = certificateFromPEM(p, MISMATCHED_ALGORITHM_CERT);
                    c.verify(c.getPublicKey());
                    fail();
                } catch (CertificateException expected) {
                }
            });
    }
This is a certificate whose keyUsage extension has more than nine bits. The getKeyUsage()
method internally rounds up to nine bits, so this tests what happens when it does not need to
round.
common/src/test/java/org/conscrypt/java/security/cert/X509CertificateTest.java