001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.commons.collections.primitives.adapters; 018 019import java.io.Serializable; 020import java.util.AbstractList; 021import java.util.ArrayList; 022 023import junit.framework.Test; 024import junit.framework.TestSuite; 025 026import org.apache.commons.collections.BulkTest; 027import org.apache.commons.collections.primitives.DoubleList; 028import org.apache.commons.collections.primitives.TestDoubleList; 029 030/** 031 * @version $Revision: 480451 $ $Date: 2006-11-29 02:45:08 -0500 (Wed, 29 Nov 2006) $ 032 * @author Rodney Waldhoff 033 */ 034public class TestListDoubleList extends TestDoubleList { 035 036 // conventional 037 // ------------------------------------------------------------------------ 038 039 public TestListDoubleList(String testName) { 040 super(testName); 041 } 042 043 public static Test suite() { 044 TestSuite suite = BulkTest.makeSuite(TestListDoubleList.class); 045 return suite; 046 } 047 048 // collections testing framework 049 // ------------------------------------------------------------------------ 050 051 /** 052 * @see org.apache.commons.collections.primitives.TestDoubleList#makeEmptyDoubleList() 053 */ 054 protected DoubleList makeEmptyDoubleList() { 055 return new ListDoubleList(new ArrayList()); 056 } 057 058 public String[] ignoredTests() { 059 // sublists are not serializable 060 return new String[] { 061 "TestListDoubleList.bulkTestSubList.testFullListSerialization", 062 "TestListDoubleList.bulkTestSubList.testEmptyListSerialization", 063 "TestListDoubleList.bulkTestSubList.testCanonicalEmptyCollectionExists", 064 "TestListDoubleList.bulkTestSubList.testCanonicalFullCollectionExists", 065 "TestListDoubleList.bulkTestSubList.testEmptyListCompatibility", 066 "TestListDoubleList.bulkTestSubList.testFullListCompatibility", 067 "TestListDoubleList.bulkTestSubList.testSerializeDeserializeThenCompare", 068 "TestListDoubleList.bulkTestSubList.testSimpleSerialization" 069 }; 070 } 071 072 // tests 073 // ------------------------------------------------------------------------ 074 075 /** @TODO need to add serialized form to cvs */ 076 public void testCanonicalEmptyCollectionExists() { 077 // XXX FIX ME XXX 078 // need to add a serialized form to cvs 079 } 080 081 public void testCanonicalFullCollectionExists() { 082 // XXX FIX ME XXX 083 // need to add a serialized form to cvs 084 } 085 086 public void testEmptyListCompatibility() { 087 // XXX FIX ME XXX 088 // need to add a serialized form to cvs 089 } 090 091 public void testFullListCompatibility() { 092 // XXX FIX ME XXX 093 // need to add a serialized form to cvs 094 } 095 public void testWrapNull() { 096 assertNull(ListDoubleList.wrap(null)); 097 } 098 099 public void testWrapSerializable() { 100 DoubleList list = ListDoubleList.wrap(new ArrayList()); 101 assertNotNull(list); 102 assertTrue(list instanceof Serializable); 103 } 104 105 public void testWrapNonSerializable() { 106 DoubleList list = ListDoubleList.wrap(new AbstractList() { 107 public Object get(int i) { throw new IndexOutOfBoundsException(); } 108 public int size() { return 0; } 109 }); 110 assertNotNull(list); 111 assertTrue(!(list instanceof Serializable)); 112 } 113 114}