KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > collections > set > TestUnmodifiableSet


1 /*
2  * Copyright 2003-2004 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.commons.collections.set;
17
18 import java.util.Arrays JavaDoc;
19 import java.util.HashSet JavaDoc;
20 import java.util.Set JavaDoc;
21
22 import junit.framework.Test;
23
24 import org.apache.commons.collections.BulkTest;
25
26 /**
27  * Extension of {@link AbstractTestSet} for exercising the
28  * {@link UnmodifiableSet} implementation.
29  *
30  * @since Commons Collections 3.0
31  * @version $Revision: 1.4 $ $Date: 2004/06/02 22:12:14 $
32  *
33  * @author Phil Steitz
34  */

35 public class TestUnmodifiableSet extends AbstractTestSet{
36     
37     public TestUnmodifiableSet(String JavaDoc testName) {
38         super(testName);
39     }
40     
41     public static Test suite() {
42         return BulkTest.makeSuite(TestUnmodifiableSet.class);
43     }
44     
45     public static void main(String JavaDoc args[]) {
46         String JavaDoc[] testCaseName = { TestUnmodifiableSet.class.getName()};
47         junit.textui.TestRunner.main(testCaseName);
48     }
49     
50     //-------------------------------------------------------------------
51
public Set JavaDoc makeEmptySet() {
52         return UnmodifiableSet.decorate(new HashSet JavaDoc());
53     }
54     
55     public Set JavaDoc makeFullSet() {
56         HashSet JavaDoc set = new HashSet JavaDoc();
57         set.addAll(Arrays.asList(getFullElements()));
58         return UnmodifiableSet.decorate(set);
59     }
60     
61     public boolean isAddSupported() {
62         return false;
63     }
64     
65     public boolean isRemoveSupported() {
66         return false;
67     }
68
69     public String JavaDoc getCompatibilityVersion() {
70         return "3.1";
71     }
72
73 // public void testCreate() throws Exception {
74
// resetEmpty();
75
// writeExternalFormToDisk((java.io.Serializable) collection, "D:/dev/collections/data/test/UnmodifiableSet.emptyCollection.version3.1.obj");
76
// resetFull();
77
// writeExternalFormToDisk((java.io.Serializable) collection, "D:/dev/collections/data/test/UnmodifiableSet.fullCollection.version3.1.obj");
78
// }
79

80 }
81
Popular Tags