@Test
public void testValidateCertificateBinding() {

    final DefaultOAuthJwtAccessTokenValidator validator = this.baseValidator;
    final OAuthJwtAccessToken mock = Mockito.spy(baseJwt);
    Mockito.doReturn(null).when(mock).getCertificateThumbprint();
    // null JWT thumbprint, null expected certificate thumbprint
    assertDoesNotThrow.accept(new ThrowingRunnable() {
        public void run() throws Throwable {
            validator.validateCertificateBinding(mock, (String) null);
        }
    });
    // null JWT thumbprint ONLY
    assertThrowable.accept(new ThrowingRunnable() {
        public void run() throws Throwable {
            validator.validateCertificateBinding(mock, "certificate_thumbprint");
        }
    }, "client certificate thumbprint (certificate_thumbprint) not match: got=null");
    Mockito.doReturn("certificate_thumbprint").when(mock).getCertificateThumbprint();
    // null expected certificate thumbprint ONLY
    assertThrowable.accept(new ThrowingRunnable() {
        public void run() throws Throwable {
            validator.validateCertificateBinding(mock, (String) null);
        }
    }, "client certificate thumbprint (null) not match: got=certificate_thumbprint");
    // not match
    assertThrowable.accept(new ThrowingRunnable() {
        public void run() throws Throwable {
            validator.validateCertificateBinding(mock, "not_match");
        }
    }, "client certificate thumbprint (not_match) not match: got=certificate_thumbprint");
    // match
    assertDoesNotThrow.accept(new ThrowingRunnable() {
        public void run() throws Throwable {
            validator.validateCertificateBinding(mock, new String("certificate_thumbprint")); // for coverage
        }
    });
}