TrustManagerFactory1Test.java 文件源码

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

项目:In-the-Box-Fork 作者:
/**
 * Test for
 * <code>TrustManagerFactory(TrustManagerFactorySpi impl, Provider prov, String algoriyjm) </code>
 * constructor
 * Assertion: created new TrustManagerFactory object
 */
@TestTargetNew(
    level = TestLevel.COMPLETE,
    notes = "",
    method = "TrustManagerFactory",
    args = {javax.net.ssl.TrustManagerFactorySpi.class, java.security.Provider.class, java.lang.String.class}
)
public void test_ConstructorLjavax_net_ssl_TrustManagerFactorySpiLjava_security_ProviderLjava_lang_String()
    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) {
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号