getpropertiestest.java

来自「在Struts2中的jar包xwork的源代码.版本为2.0.7」· Java 代码 · 共 40 行

JAVA
40
字号
/* * Created on Jan 23, 2006 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */package com.opensymphony.xwork2.util;import java.util.ArrayList;import java.util.Collection;import java.util.HashSet;import junit.framework.TestCase;/** * @author Gabe * * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */public class GetPropertiesTest extends TestCase {    public void testGetCollectionProperties()  {        doGetCollectionPropertiesTest(new ArrayList());        doGetCollectionPropertiesTest(new HashSet());            }        public void doGetCollectionPropertiesTest(Collection c) {        ValueStack vs = ValueStackFactory.getFactory().createValueStack();        Foo foo = new Foo();        foo.setBarCollection(c);        vs.push(foo);        assertEquals(Boolean.TRUE, vs.findValue("barCollection.isEmpty"));        assertEquals(Boolean.TRUE, vs.findValue("barCollection.empty"));        assertEquals(new Integer(0), vs.findValue("barCollection.size"));        assertTrue(vs.findValue("barCollection.iterator") instanceof java.util.Iterator);    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?