FileDocCategorySizeDatePackage
ContainUtilTest.javaAPI DocExample4326Mon Jul 23 13:26:26 BST 2007org.apache.struts2.util

ContainUtilTest

public class ContainUtilTest extends TestCase
version
$Date: 2006-11-23 12:31:52 -0500 (Thu, 23 Nov 2006) $ $Id: ContainUtilTest.java 478625 2006-11-23 17:31:52Z wsmoak $

Fields Summary
Constructors Summary
Methods Summary
public voidtestComplexList()

        List<MyObject> l = new ArrayList<MyObject>();
        l.add(new MyObject("tm_jee", 20));
        l.add(new MyObject("jenny", 22));

        assertFalse(ContainUtil.contains(l, new MyObject("paul", 50)));
        assertFalse(ContainUtil.contains(l, new MyObject("tm_jee", 44)));
        assertTrue(ContainUtil.contains(l, new MyObject("tm_jee", 20)));
        assertTrue(ContainUtil.contains(l, new MyObject("jenny", 22)));
    
public voidtestComplexMap()

        Set<MyObject> s = new LinkedHashSet<MyObject>();
        s.add(new MyObject("tm_jee", 20));
        s.add(new MyObject("jenny", 22));

        assertFalse(ContainUtil.contains(s, new MyObject("paul", 50)));
        assertFalse(ContainUtil.contains(s, new MyObject("tm_jee", 44)));
        assertTrue(ContainUtil.contains(s, new MyObject("tm_jee", 20)));
        assertTrue(ContainUtil.contains(s, new MyObject("jenny", 22)));
    
public voidtestNull()

        assertFalse(ContainUtil.contains(null, null));
        assertFalse(ContainUtil.contains(new Object(), null));
        assertFalse(ContainUtil.contains(null, new Object()));
    
public voidtestObject()

        assertFalse(ContainUtil.contains("aaa", "bbb"));
        assertFalse(ContainUtil.contains(new MyObject("tm_jee", 22), new MyObject("tmjee", 22)));
        assertTrue(ContainUtil.contains("apple", "apple"));
        assertTrue(ContainUtil.contains(new MyObject("tm_jee", 22), new MyObject("tm_jee", 22)));
    
public voidtestSimpleList()

        List<String> l = new ArrayList<String>();
        l.add("one");
        l.add("two");

        assertFalse(ContainUtil.contains(l, "three"));
        assertTrue(ContainUtil.contains(l, "one"));
        assertTrue(ContainUtil.contains(l, "two"));
    
public voidtestSimpleSet()

        Set<String> s = new LinkedHashSet<String>();
        s.add("one");
        s.add("two");

        assertFalse(ContainUtil.contains(s, "thre"));
        assertTrue(ContainUtil.contains(s, "one"));
        assertTrue(ContainUtil.contains(s, "two"));