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.collection;
17:
18: import java.util.ArrayList;
19: import java.util.Arrays;
20: import java.util.Collection;
21: import java.util.List;
22:
23: import junit.framework.Test;
24: import junit.framework.TestSuite;
25:
26: /**
27: * Extension of {@link AbstractTestCollection} for exercising the
28: * {@link UnmodifiableCollection} 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: * @author Stephen Colebourne
35: */
36: public class TestUnmodifiableCollection extends AbstractTestCollection {
37:
38: public TestUnmodifiableCollection(String testName) {
39: super (testName);
40: }
41:
42: public static Test suite() {
43: return new TestSuite(TestUnmodifiableCollection.class);
44: }
45:
46: public static void main(String args[]) {
47: String[] testCaseName = { TestUnmodifiableCollection.class
48: .getName() };
49: junit.textui.TestRunner.main(testCaseName);
50: }
51:
52: //-----------------------------------------------------------------------
53: public Collection makeCollection() {
54: return UnmodifiableCollection.decorate(new ArrayList());
55: }
56:
57: public Collection makeFullCollection() {
58: List list = new ArrayList();
59: list.addAll(Arrays.asList(getFullElements()));
60: return UnmodifiableCollection.decorate(list);
61: }
62:
63: public Collection makeConfirmedCollection() {
64: ArrayList list = new ArrayList();
65: return list;
66: }
67:
68: public Collection makeConfirmedFullCollection() {
69: ArrayList list = new ArrayList();
70: list.addAll(Arrays.asList(getFullElements()));
71: return list;
72: }
73:
74: public boolean isAddSupported() {
75: return false;
76: }
77:
78: public boolean isRemoveSupported() {
79: return false;
80: }
81:
82: public String getCompatibilityVersion() {
83: return "3.1";
84: }
85:
86: // public void testCreate() throws Exception {
87: // resetEmpty();
88: // writeExternalFormToDisk((java.io.Serializable) collection, "D:/dev/collections/data/test/UnmodifiableCollection.emptyCollection.version3.1.obj");
89: // resetFull();
90: // writeExternalFormToDisk((java.io.Serializable) collection, "D:/dev/collections/data/test/UnmodifiableCollection.fullCollection.version3.1.obj");
91: // }
92:
93: }
|