java类java.beans.AppletInitializer的实例源码

BeansTest.java 文件源码 项目:cn1 阅读 26 收藏 0 点赞 0 评论 0
public void testInstantiateClassLoaderStringBeanContextAppletInitializer_Class()
        throws Exception {
    ClassLoader loader = new BinClassLoader();
    BeanContext context = new BeanContextSupport();
    AppletInitializer appInit = new MockAppletInitializer();
    Object bean = Beans.instantiate(loader, MOCK_JAVA_BEAN2, context,
            appInit);

    assertEquals("as_class", (String) bean.getClass().getMethod(
            "getPropertyOne", (Class[]) null).invoke(bean, (Object[]) null));
    assertSame(loader, bean.getClass().getClassLoader());
    assertTrue(context.contains(bean));
}
BeansTest.java 文件源码 项目:cn1 阅读 20 收藏 0 点赞 0 评论 0
public void testInstantiateClassLoaderStringBeanContextAppletInitializer_Ser()
        throws Exception {

    ClassLoader loader = new SerClassLoader();
    BeanContext context = new BeanContextSupport();
    AppletInitializer appInit = new MockAppletInitializer();
    Object bean = Beans.instantiate(loader, MOCK_JAVA_BEAN2, context,
            appInit);

    assertEquals("as_object", (String) bean.getClass().getMethod(
            "getPropertyOne", (Class[]) null).invoke(bean, (Object[]) null));
    assertSame(loader, bean.getClass().getClassLoader());
    assertTrue(context.contains(bean));
}
BeansTest.java 文件源码 项目:cn1 阅读 19 收藏 0 点赞 0 评论 0
public void testInstantiateClassLoaderStringBeanContextAppletInitializer_LoaderNull()
        throws Exception {
    String beanName = "org.apache.harmony.beans.tests.support.mock.MockJavaBean";
    BeanContext context = new BeanContextSupport();
    AppletInitializer appInit = new MockAppletInitializer();

    Object bean = Beans.instantiate(null, beanName, context, appInit);

    assertSame(ClassLoader.getSystemClassLoader(), bean.getClass()
            .getClassLoader());
    assertEquals(beanName, bean.getClass().getName());
    assertTrue(context.contains(bean));
}
BeansTest.java 文件源码 项目:cn1 阅读 20 收藏 0 点赞 0 评论 0
public void testInstantiateClassLoaderStringBeanContextAppletInitializer_BeanNull()
        throws Exception {
    ClassLoader loader = createSpecificClassLoader();
    BeanContext context = new BeanContextSupport();
    AppletInitializer appInit = new MockAppletInitializer();

    try {
        Beans.instantiate(loader, null, context, appInit);
        fail("Should throw NullPointerException.");
    } catch (NullPointerException e) {
    }
}
BeansTest.java 文件源码 项目:cn1 阅读 23 收藏 0 点赞 0 评论 0
public void testInstantiateClassLoaderStringBeanContextAppletInitializer_ContextNull()
        throws Exception {
    ClassLoader loader = createSpecificClassLoader();
    String beanName = "org.apache.harmony.beans.tests.support.mock.MockJavaBean";
    AppletInitializer appInit = new MockAppletInitializer();
    Object bean = Beans.instantiate(loader, beanName, null, appInit);

    assertSame(ClassLoader.getSystemClassLoader(), bean.getClass()
            .getClassLoader());
    assertEquals(beanName, bean.getClass().getName());
}
BeansTest.java 文件源码 项目:freeVM 阅读 20 收藏 0 点赞 0 评论 0
public void testInstantiateClassLoaderStringBeanContextAppletInitializer_Class()
        throws Exception {
    ClassLoader loader = new BinClassLoader();
    BeanContext context = new BeanContextSupport();
    AppletInitializer appInit = new MockAppletInitializer();
    Object bean = Beans.instantiate(loader, MOCK_JAVA_BEAN2, context,
            appInit);

    assertEquals("as_class", (String) bean.getClass().getMethod(
            "getPropertyOne", (Class[]) null).invoke(bean, (Object[]) null));
    assertSame(loader, bean.getClass().getClassLoader());
    assertTrue(context.contains(bean));
}
BeansTest.java 文件源码 项目:freeVM 阅读 20 收藏 0 点赞 0 评论 0
public void testInstantiateClassLoaderStringBeanContextAppletInitializer_Ser()
        throws Exception {

    ClassLoader loader = new SerClassLoader();
    BeanContext context = new BeanContextSupport();
    AppletInitializer appInit = new MockAppletInitializer();
    Object bean = Beans.instantiate(loader, MOCK_JAVA_BEAN2, context,
            appInit);

    assertEquals("as_object", (String) bean.getClass().getMethod(
            "getPropertyOne", (Class[]) null).invoke(bean, (Object[]) null));
    assertSame(loader, bean.getClass().getClassLoader());
    assertTrue(context.contains(bean));
}
BeansTest.java 文件源码 项目:freeVM 阅读 27 收藏 0 点赞 0 评论 0
public void testInstantiateClassLoaderStringBeanContextAppletInitializer_LoaderNull()
        throws Exception {
    String beanName = "org.apache.harmony.beans.tests.support.mock.MockJavaBean";
    BeanContext context = new BeanContextSupport();
    AppletInitializer appInit = new MockAppletInitializer();

    Object bean = Beans.instantiate(null, beanName, context, appInit);

    assertSame(ClassLoader.getSystemClassLoader(), bean.getClass()
            .getClassLoader());
    assertEquals(beanName, bean.getClass().getName());
    assertTrue(context.contains(bean));
}
BeansTest.java 文件源码 项目:freeVM 阅读 19 收藏 0 点赞 0 评论 0
public void testInstantiateClassLoaderStringBeanContextAppletInitializer_BeanNull()
        throws Exception {
    ClassLoader loader = createSpecificClassLoader();
    BeanContext context = new BeanContextSupport();
    AppletInitializer appInit = new MockAppletInitializer();

    try {
        Beans.instantiate(loader, null, context, appInit);
        fail("Should throw NullPointerException.");
    } catch (NullPointerException e) {
    }
}
BeansTest.java 文件源码 项目:freeVM 阅读 24 收藏 0 点赞 0 评论 0
public void testInstantiateClassLoaderStringBeanContextAppletInitializer_ContextNull()
        throws Exception {
    ClassLoader loader = createSpecificClassLoader();
    String beanName = "org.apache.harmony.beans.tests.support.mock.MockJavaBean";
    AppletInitializer appInit = new MockAppletInitializer();
    Object bean = Beans.instantiate(loader, beanName, null, appInit);

    assertSame(ClassLoader.getSystemClassLoader(), bean.getClass()
            .getClassLoader());
    assertEquals(beanName, bean.getClass().getName());
}
BeansTest.java 文件源码 项目:freeVM 阅读 19 收藏 0 点赞 0 评论 0
public void testInstantiateClassLoaderStringBeanContextAppletInitializer_Class()
        throws Exception {
    ClassLoader loader = new BinClassLoader();
    BeanContext context = new BeanContextSupport();
    AppletInitializer appInit = new MockAppletInitializer();
    Object bean = Beans.instantiate(loader, MOCK_JAVA_BEAN2, context,
            appInit);

    assertEquals("as_class", (String) bean.getClass().getMethod(
            "getPropertyOne", (Class[]) null).invoke(bean, (Object[]) null));
    assertSame(loader, bean.getClass().getClassLoader());
    assertTrue(context.contains(bean));
}
BeansTest.java 文件源码 项目:freeVM 阅读 26 收藏 0 点赞 0 评论 0
public void testInstantiateClassLoaderStringBeanContextAppletInitializer_Ser()
        throws Exception {

    ClassLoader loader = new SerClassLoader();
    BeanContext context = new BeanContextSupport();
    AppletInitializer appInit = new MockAppletInitializer();
    Object bean = Beans.instantiate(loader, MOCK_JAVA_BEAN2, context,
            appInit);

    assertEquals("as_object", (String) bean.getClass().getMethod(
            "getPropertyOne", (Class[]) null).invoke(bean, (Object[]) null));
    assertSame(loader, bean.getClass().getClassLoader());
    assertTrue(context.contains(bean));
}
BeansTest.java 文件源码 项目:freeVM 阅读 25 收藏 0 点赞 0 评论 0
public void testInstantiateClassLoaderStringBeanContextAppletInitializer_LoaderNull()
        throws Exception {
    String beanName = "org.apache.harmony.beans.tests.support.mock.MockJavaBean";
    BeanContext context = new BeanContextSupport();
    AppletInitializer appInit = new MockAppletInitializer();

    Object bean = Beans.instantiate(null, beanName, context, appInit);

    assertSame(ClassLoader.getSystemClassLoader(), bean.getClass()
            .getClassLoader());
    assertEquals(beanName, bean.getClass().getName());
    assertTrue(context.contains(bean));
}
BeansTest.java 文件源码 项目:freeVM 阅读 24 收藏 0 点赞 0 评论 0
public void testInstantiateClassLoaderStringBeanContextAppletInitializer_BeanNull()
        throws Exception {
    ClassLoader loader = createSpecificClassLoader();
    BeanContext context = new BeanContextSupport();
    AppletInitializer appInit = new MockAppletInitializer();

    try {
        Beans.instantiate(loader, null, context, appInit);
        fail("Should throw NullPointerException.");
    } catch (NullPointerException e) {
    }
}
BeansTest.java 文件源码 项目:freeVM 阅读 20 收藏 0 点赞 0 评论 0
public void testInstantiateClassLoaderStringBeanContextAppletInitializer_ContextNull()
        throws Exception {
    ClassLoader loader = createSpecificClassLoader();
    String beanName = "org.apache.harmony.beans.tests.support.mock.MockJavaBean";
    AppletInitializer appInit = new MockAppletInitializer();
    Object bean = Beans.instantiate(loader, beanName, null, appInit);

    assertSame(ClassLoader.getSystemClassLoader(), bean.getClass()
            .getClassLoader());
    assertEquals(beanName, bean.getClass().getName());
}


问题


面经


文章

微信
公众号

扫码关注公众号