TrustManagerFactory1Test.java 文件源码

java
阅读 25 收藏 0 点赞 0 评论 0

项目:cn1 作者:
/**
 * Test for
 * <code>TrustManagerFactory(TrustManagerFactorySpi impl, Provider prov, String algoriyjm) </code>
 * constructor
 * Assertion: created new TrustManagerFactory object
 */
public void testTrustManagerFactory10() throws NoSuchAlgorithmException {
    if (!DEFSupported) {
        fail(NotSupportedMsg);
        return;
    }
    TrustManagerFactorySpi spi = new MyTrustManagerFactorySpi(); 
    TrustManagerFactory tmF = new myTrustManagerFactory(spi, defaultProvider,
            defaultAlgorithm);
    assertTrue("Not CertStore object", tmF instanceof TrustManagerFactory);
    assertEquals("Incorrect algorithm", tmF.getAlgorithm(),
            defaultAlgorithm);
    assertEquals("Incorrect provider", tmF.getProvider(), defaultProvider);
    assertNull("Incorrect result", tmF.getTrustManagers());

    tmF = new myTrustManagerFactory(null, null, null);
    assertTrue("Not CertStore object", tmF instanceof TrustManagerFactory);
    assertNull("Provider must be null", tmF.getProvider());
    assertNull("Algorithm must be null", tmF.getAlgorithm());
    try {
        tmF.getTrustManagers();
        fail("NullPointerException must be thrown");
    } catch (NullPointerException e) {
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号