KickJava   Java API By Example, From Geeks To Geeks.

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


1 package org.bsf.smartValueObject.container;
2
3 import org.bsf.smartValueObject.container.SmartContainer;
4 import org.bsf.smartValueObject.container.SmartSet;
5 import org.bsf.smartValueObject.container.AbstractTestSmartContainer;
6 import org.bsf.smartValueObject.TestVO;
7
8 import java.util.HashSet JavaDoc;
9
10 /**
11  * Testcase for SmartSet.
12  *
13  * @see org.bsf.smartValueObject.container.SmartSet
14  */

15 public class TestSmartSet extends AbstractTestSmartContainer {
16     private SmartSet ss;
17
18     protected SmartContainer createContainer() {
19         ss = new SmartSet(new HashSet JavaDoc(), getVersionable());
20         return ss;
21     }
22
23     protected Object JavaDoc addToContainer(TestVO t) {
24         return ss.add(t) ? t : null;
25     }
26
27     protected Object JavaDoc removeFromContainer(TestVO t) {
28         return ss.remove(t) ? t : null;
29     }
30
31     protected TestVO getOne() {
32         assertTrue(getSize() > 0);
33         return (TestVO) ss.iterator().next();
34     }
35
36     public void testSize() {
37         createMany();
38         assertEquals("Incorrect size", getSize(), ss.size());
39     }
40
41     public void testSizeAfterDelete() {
42         createMany();
43         deleteMany(getSize());
44         testSize();
45     }
46 }
47
Popular Tags