01: /*
02: * Copyright 2003-2004 The Apache Software Foundation
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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;
19: import java.util.HashSet;
20: import java.util.Set;
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: 155406 $ $Date: 2005-02-26 12:55:26 +0000 (Sat, 26 Feb 2005) $
32: *
33: * @author Phil Steitz
34: */
35: public class TestUnmodifiableSet extends AbstractTestSet {
36:
37: public TestUnmodifiableSet(String 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 args[]) {
46: String[] testCaseName = { TestUnmodifiableSet.class.getName() };
47: junit.textui.TestRunner.main(testCaseName);
48: }
49:
50: //-------------------------------------------------------------------
51: public Set makeEmptySet() {
52: return UnmodifiableSet.decorate(new HashSet());
53: }
54:
55: public Set makeFullSet() {
56: HashSet set = new HashSet();
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 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: }
|