MOAT.java revision 1468
3909N/A * Copyright 2005-2008 Sun Microsystems, Inc. All Rights Reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 2362N/A * CA 95054 USA or visit www.sun.com if you need additional information or 4374N/A * @bug 6207984 6272521 6192552 6269713 6197726 6260652 5073546 4137464 0N/A * 4155650 4216399 4294891 6282555 6318622 6355327 6383475 6420753 0N/A * 6431845 4802633 6570566 6570575 6570631 6570924 6691185 6691215 0N/A * @summary Run many tests on many Collection and Map implementations 0N/A * @author Martin Buchholz 0N/A/* Mother Of All (Collection) Tests 0N/A * Testing of collection classes is often spotty, because many tests 0N/A * need to be performed on many implementations, but the onus on 0N/A * writing the tests falls on the engineer introducing the new 0N/A * The idea of this mega-test is that: 0N/A * An engineer adding a new collection implementation could simply add 0N/A * their new implementation to a list of implementations in this 0N/A * test's main method. Any general purpose Collection<Integer> or 0N/A * Map<Integer,Integer> class is appropriate. 0N/A * An engineer fixing a regression could add their regression test here and 0N/A * simultaneously test all other implementations. 0N/A // Empty collections 0N/A // Singleton collections 0N/A //testImmutableSet(m.entrySet()); 0N/A // 6260652: (coll) Arrays.asList(x).toArray().getClass() 0N/A // should be Object[].class 0N/A //System.out.printf("Serializing %s%n", c.getClass().getName()); 0N/A //---------------------------------------------------------------- 0N/A // If add(null) succeeds, contains(null) & remove(null) should succeed 0N/A //---------------------------------------------------------------- 0N/A // !!!! 5018849: (coll) TreeSet.contains(null) does not agree with Javadoc 0N/A //---------------------------------------------------------------- 0N/A // If add("x") succeeds, contains("x") & remove("x") should succeed 0N/A //---------------------------------------------------------------- 0N/A for (
int i =
0; i <
5; i++)
0N/A for (
int i =
0; i <
5; i++)
0N/A for (
int i =
3; i >=
0; i--)
0N/A for (
int i =
0; i <
5; i++)
0N/A for (
int i =
1; i <
4; i++)
0N/A //---------------------------------------------------------------- 0N/A // 4802633: (coll) AbstractList.addAll(-1,emptyCollection) 0N/A // doesn't throw IndexOutOfBoundsException 0N/A //---------------------------------------------------------------- 0N/A fail(
"Expected IndexOutOfBoundsException not thrown");
0N/A// equal(l instanceof Serializable, 0N/A// l.subList(0,0) instanceof Serializable); 0N/A //System.out.println("add() supported"); 0N/A //---------------------------------------------------------------- 0N/A // The "all" operations should throw NPE when passed null 0N/A //---------------------------------------------------------------- 0N/A fail(
"Expected NullPointerException");
0N/A fail(
"Expected NullPointerException");
0N/A fail(
"Expected NullPointerException");
0N/A fail(
"Expected NullPointerException");
0N/A //---------------------------------------------------------------- 0N/A //---------------------------------------------------------------- 0N/A // We're asking for .equals(...) semantics 0N/A //---------------------------------------------------------------- 0N/A //---------------------------------------------------------------- 0N/A //---------------------------------------------------------------- 0N/A //---------------------------------------------------------------- 0N/A //--------------------- Infrastructure ---------------------------