Example usage for java.security GeneralSecurityException getClass

List of usage examples for java.security GeneralSecurityException getClass

Introduction

In this page you can find the example usage for java.security GeneralSecurityException getClass.

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:org.jasig.cas.adaptors.x509.authentication.handler.support.AbstractCRLRevocationCheckerTests.java

/**
 * Test method for {@link AbstractCRLRevocationChecker#check(X509Certificate)}.
 *///from   w w w.  ja v  a 2  s  .c o  m
@Test
public void testCheck() {
    try {
        for (X509Certificate cert : this.certificates) {
            getChecker().check(cert);
        }
        if (this.expected != null) {
            Assert.fail("Expected exception of type " + this.expected.getClass());
        }
    } catch (final GeneralSecurityException e) {
        if (this.expected == null) {
            e.printStackTrace();
            Assert.fail("Revocation check failed unexpectedly with exception: " + e);
        } else {
            final Class<?> expectedClass = this.expected.getClass();
            final Class<?> actualClass = e.getClass();
            Assert.assertTrue(
                    String.format("Expected exception of type %s but got %s", expectedClass, actualClass),
                    expectedClass.isAssignableFrom(actualClass));
        }
    }
}