KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > ozoneDB > DxLib > SetTest


1 // You can redistribute this software and/or modify it under the terms of
2
// the Ozone Library License version 1 published by ozone-db.org.
3
//
4
// The original code and portions created by SMB are
5
// Copyright (C) 1997-@year@ by SMB GmbH. All rights reserved.
6
//
7
// $Id$
8

9 package test.ozoneDB.DxLib;
10
11 import org.ozoneDB.DxLib.DxSet;
12 import org.ozoneDB.DxLib.DxHashSet;
13 import org.ozoneDB.DxLib.DxTreeSet;
14
15 /**
16  *
17  *
18  * @author <a HREF="http://www.softwarebuero.de/">SMB</a>
19  * @version $Revision$Date$
20  */

21 public class SetTest extends AbstractTest {
22
23
24     public SetTest() {
25         super("testDxSet");
26     }
27
28     public SetTest(String JavaDoc name) {
29         super(name);
30     }
31
32     public void testDxSet() throws Exception JavaDoc {
33         Class JavaDoc[] setFactories = {DxHashSet.class, DxTreeSet.class};
34
35         // retainsAll
36
for (int i = 0; i < setFactories.length; i++) {
37             retainsAll((DxSet) setFactories[i].newInstance(), CollectionTest.newDxStrings());
38         }
39     }
40
41     /**
42      */

43     public void retainsAll(DxSet set, Object JavaDoc[] objs) throws Exception JavaDoc {
44         set.addAll(objs);
45         DxSet set2 = (DxSet) set.clone();
46         startTimer(set.getClass().getName(), "retainsAll");
47
48         set.retainAll(set2);
49         assertEquals(set, set2);
50         assertTrue(set.count() > 0);
51
52         set2.clear();
53         set.retainAll(set2);
54         assertTrue(set.isEmpty());
55
56         stopTimer();
57     }
58
59 }
60
Popular Tags