TestCollectionBeanContext.java 文件源码

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

项目:freeVM 作者:
/**
 * @see java.beans.beancontext.BeanContextSupport#retainAll(Collection)
 * @see java.beans.beancontext.BeanContextSupport#iterator()
 */
public Result testContainsAllBeanContext()throws Exception {

    bean = new BeanContextChildSupport();
    beanWithContext = new BeanWithBeanContext();
    subContext = new BeanContextSupport();

    vector = new Vector();

    // Adding the components
    context.add(bean);
    context.add(beanWithContext);
    context.add(subContext);

    // Adding the components from bean context to Vector
    for (int i = 0; i < context.size(); i++) {
        vector.add(context.iterator().next());
    }

    // It's verified that objects in the specified Vector are children of this bean context 
    if (context.containsAll(vector)) {
        return passed();
    } else {
        return failed("testCollectionContainsAll() - failed ");
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号