KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > collections > buffer > TestSynchronizedBuffer


1 /*
2  * Copyright 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.buffer;
17
18 import java.util.Arrays JavaDoc;
19 import java.util.Collection JavaDoc;
20
21 import junit.framework.Test;
22 import junit.framework.TestSuite;
23
24 import org.apache.commons.collections.ArrayStack;
25 import org.apache.commons.collections.Buffer;
26 import org.apache.commons.collections.collection.AbstractTestCollection;
27
28 /**
29  * Extension of {@link AbstractTestCollection} for exercising the
30  * {@link SynchronizedBuffer} implementation.
31  *
32  * @since Commons Collections 3.1
33  * @version $Revision: 1.1 $ $Date: 2004/06/02 22:05:54 $
34  *
35  * @author Phil Steitz
36  * @author Stephen Colebourne
37  */

38 public class TestSynchronizedBuffer extends AbstractTestCollection {
39     
40     public TestSynchronizedBuffer(String JavaDoc testName) {
41         super(testName);
42     }
43     
44     public static Test suite() {
45         return new TestSuite(TestSynchronizedBuffer.class);
46     }
47     
48     public static void main(String JavaDoc args[]) {
49         String JavaDoc[] testCaseName = { TestSynchronizedBuffer.class.getName()};
50         junit.textui.TestRunner.main(testCaseName);
51     }
52
53     //-----------------------------------------------------------------------
54
public Collection JavaDoc makeCollection() {
55         return SynchronizedBuffer.decorate(new UnboundedFifoBuffer());
56     }
57     
58     public Collection JavaDoc makeFullCollection() {
59         Buffer buffer = new UnboundedFifoBuffer();
60         buffer.addAll(Arrays.asList(getFullElements()));
61         return SynchronizedBuffer.decorate(buffer);
62     }
63     
64     public Collection JavaDoc makeConfirmedCollection() {
65         ArrayStack list = new ArrayStack();
66         return list;
67     }
68
69     public Collection JavaDoc makeConfirmedFullCollection() {
70         ArrayStack list = new ArrayStack();
71         list.addAll(Arrays.asList(getFullElements()));
72         return list;
73     }
74
75     public boolean isNullSupported() {
76         return false;
77     }
78     
79     public String JavaDoc getCompatibilityVersion() {
80         return "3.1";
81     }
82
83 // public void testCreate() throws Exception {
84
// resetEmpty();
85
// writeExternalFormToDisk((java.io.Serializable) collection, "D:/dev/collections/data/test/SynchronizedBuffer.emptyCollection.version3.1.obj");
86
// resetFull();
87
// writeExternalFormToDisk((java.io.Serializable) collection, "D:/dev/collections/data/test/SynchronizedBuffer.fullCollection.version3.1.obj");
88
// }
89

90 }
91
Popular Tags