@Test(expected = CertificateException.class)
public void shouldRethrowCertificateExceptionOnCheckServerTrusted() throws Exception {

    // underlying trust manager should throw runtime exception
    Mockito.doThrow(new RuntimeException()).when(trustManager)
            .checkServerTrusted(Mockito.any(X509Certificate[].class), Mockito.anyString());
    underTest.checkServerTrusted(null, null);
}