java类javax.net.ssl.KeyStoreBuilderParameters的实例源码

KeyStoreBuilderParametersTest.java 文件源码 项目:conscrypt 阅读 26 收藏 0 点赞 0 评论 0
@Test
public void test_init_Builder_null() {
    // KeyStoreBuilderParameters' constructor didn't check for null until
    // Objects.requireNonNull was added
    assumeObjectsAvailable();
    try {
        new KeyStoreBuilderParameters((Builder) null);
        fail();
    } catch (NullPointerException expected) {
    }
}
KeyStoreBuilderParametersTest.java 文件源码 项目:conscrypt 阅读 25 收藏 0 点赞 0 评论 0
@Test
public void test_init_Builder() {
    TestKeyStore testKeyStore = TestKeyStore.getClient();
    Builder builder = Builder.newInstance(
            testKeyStore.keyStore, new PasswordProtection(testKeyStore.storePassword));
    KeyStoreBuilderParameters ksbp = new KeyStoreBuilderParameters(builder);
    assertNotNull(ksbp);
    assertNotNull(ksbp.getParameters());
    assertEquals(1, ksbp.getParameters().size());
    assertSame(builder, ksbp.getParameters().get(0));
}
KeyStoreBuilderParametersTest.java 文件源码 项目:conscrypt 阅读 34 收藏 0 点赞 0 评论 0
@Test
public void test_init_List_null() {
    try {
        new KeyStoreBuilderParameters((List<Builder>) null);
        fail();
    } catch (NullPointerException expected) {
        // Ignored.
    }
}
KeyStoreBuilderParametersTest.java 文件源码 项目:conscrypt 阅读 25 收藏 0 点赞 0 评论 0
@Test
public void test_init_List() {
    TestKeyStore testKeyStore1 = TestKeyStore.getClient();
    TestKeyStore testKeyStore2 = TestKeyStore.getServer();
    Builder builder1 = Builder.newInstance(
            testKeyStore1.keyStore, new PasswordProtection(testKeyStore1.storePassword));
    Builder builder2 = Builder.newInstance(
            testKeyStore2.keyStore, new PasswordProtection(testKeyStore2.storePassword));

    List<Builder> list = Arrays.asList(builder1, builder2);
    KeyStoreBuilderParameters ksbp = new KeyStoreBuilderParameters(list);
    assertNotNull(ksbp);
    assertNotNull(ksbp.getParameters());
    assertNotSame(list, ksbp.getParameters());
    assertEquals(2, ksbp.getParameters().size());
    assertSame(builder1, ksbp.getParameters().get(0));
    assertSame(builder2, ksbp.getParameters().get(1));

    // confirm result is not modifiable
    try {
        ksbp.getParameters().set(0, builder2);
        fail();
    } catch (UnsupportedOperationException expected) {
        // Ignored.
    }

    // confirm result is a copy of original
    list.set(0, builder2);
    assertSame(builder1, ksbp.getParameters().get(0));
}
KeyStoreBuilderParametersTest.java 文件源码 项目:cn1 阅读 24 收藏 0 点赞 0 评论 0
public final void testKeyStoreBuilderParametersBuilder() {
    try {
        new KeyStoreBuilderParameters((KeyStore.Builder) null);
    } catch (NullPointerException e) {
        // javadoc says this should throw NPE, but it doesn't
        fail("no NPE expected");
    }
}
KeyStoreBuilderParametersTest.java 文件源码 项目:freeVM 阅读 35 收藏 0 点赞 0 评论 0
public final void testKeyStoreBuilderParametersBuilder() {
    try {
        new KeyStoreBuilderParameters((KeyStore.Builder) null);
    } catch (NullPointerException e) {
        // javadoc says this should throw NPE, but it doesn't
        fail("no NPE expected");
    }
}
KeyStoreBuilderParametersTest.java 文件源码 项目:freeVM 阅读 32 收藏 0 点赞 0 评论 0
public final void testKeyStoreBuilderParametersBuilder() {
    // should not throw NullPointerException
    new KeyStoreBuilderParameters((KeyStore.Builder) null);
}


问题


面经


文章

微信
公众号

扫码关注公众号