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.events.observable;
17:
18: import junit.framework.Test;
19: import junit.framework.TestSuite;
20:
21: import org.apache.commons.collections.Bag;
22: import org.apache.commons.collections.bag.AbstractTestSortedBag;
23: import org.apache.commons.collections.bag.TreeBag;
24:
25: /**
26: * Extension of {@link TestSortedBag} for exercising the
27: * {@link ObservedSortedBag} implementation.
28: *
29: * @since Commons Events 1.0
30: * @version $Revision: 155443 $ $Date: 2005-02-26 06:19:51 -0700 (Sat, 26 Feb 2005) $
31: *
32: * @author Stephen Colebourne
33: */
34: public class TestObservableSortedBag extends AbstractTestSortedBag
35: implements ObservedTestHelper.ObservedFactory {
36:
37: public TestObservableSortedBag(String testName) {
38: super (testName);
39: }
40:
41: public static Test suite() {
42: return new TestSuite(TestObservableSortedBag.class);
43: }
44:
45: public static void main(String args[]) {
46: String[] testCaseName = { TestObservableSortedBag.class
47: .getName() };
48: junit.textui.TestRunner.main(testCaseName);
49: }
50:
51: //-----------------------------------------------------------------------
52: public Bag makeBag() {
53: return ObservableSortedBag.decorate(new TreeBag(),
54: ObservedTestHelper.LISTENER);
55: }
56:
57: //-----------------------------------------------------------------------
58: public void testObservedSortedBag() {
59: ObservedTestHelper.bulkTestObservedSortedBag(this );
60: }
61:
62: //-----------------------------------------------------------------------
63: public ObservableCollection createObservedCollection() {
64: return ObservableSortedBag.decorate(new TreeBag());
65: }
66:
67: public ObservableCollection createObservedCollection(Object listener) {
68: return ObservableSortedBag.decorate(new TreeBag(), listener);
69: }
70:
71: }
|