KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > bsf > smartValueObject > container > TestSmartList


1 package org.bsf.smartValueObject.container;
2
3 import org.bsf.smartValueObject.container.SmartContainer;
4 import org.bsf.smartValueObject.container.SmartList;
5 import org.bsf.smartValueObject.container.AbstractTestSmartContainer;
6 import org.bsf.smartValueObject.TestVO;
7
8 import java.util.ArrayList JavaDoc;
9
10 /**
11  *
12  *
13  */

14 public class TestSmartList extends AbstractTestSmartContainer {
15
16     private SmartList sl;
17
18     /**
19      * Creates the container to be tested.
20      * @return the container.
21      */

22     protected SmartContainer createContainer() {
23         sl = new SmartList(new ArrayList JavaDoc(), getVersionable());
24         return sl;
25     }
26
27     /**
28      * Adds an elements to the container under test.
29      * @param t the element to be added.
30      * @return
31      */

32     protected Object JavaDoc addToContainer(TestVO t) {
33         return sl.add(t) ? t : null;
34     }
35
36     /**
37      * Removes an element from the container under test.
38      * @param t the element to be removed.
39      * @return
40      */

41     protected Object JavaDoc removeFromContainer(TestVO t) {
42         return sl.remove(t) ? t : null;
43     }
44
45     /**
46      * Gets a valid VO from the container.
47      * @return a VO.
48      */

49     protected TestVO getOne() {
50         assertTrue("Container is empty", sl.size() > 0);
51         return (TestVO) sl.iterator().next();
52     }
53
54     public void testSomething() {
55
56     }
57 }
58
Popular Tags