scolebourne 2003/10/05 14:17:40 Modified: collections/src/test/org/apache/commons/collections TestListUtils.java TestMapUtils.java TestLRUMap.java TestIteratorUtils.java TestHashBag.java TestMultiKey.java TestMultiHashMap.java TestLinkedList.java Log: Update licence and version Revision Changes Path 1.14 +5 -6 jakarta-commons/collections/src/test/org/apache/commons/collections/TestListUtils.java Index: TestListUtils.java =================================================================== RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestListUtils.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- TestListUtils.java 2 Oct 2003 22:14:29 -0000 1.13 +++ TestListUtils.java 5 Oct 2003 21:17:39 -0000 1.14 @@ -1,13 +1,10 @@ /* * $Header$ - * $Revision$ - * $Date$ - * * ==================================================================== * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999-2001 The Apache Software Foundation. All rights + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,7 +33,7 @@ * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. + * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES @@ -71,6 +68,8 @@ /** * Tests for ListUtils. + * + * @version $Revision$ $Date$ * * @author Stephen Colebourne * @author Neil O'Toole 1.17 +4 -4 jakarta-commons/collections/src/test/org/apache/commons/collections/TestMapUtils.java Index: TestMapUtils.java =================================================================== RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestMapUtils.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- TestMapUtils.java 2 Oct 2003 23:01:09 -0000 1.16 +++ TestMapUtils.java 5 Oct 2003 21:17:40 -0000 1.17 @@ -4,7 +4,7 @@ * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999-2003 The Apache Software Foundation. All rights + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,7 +33,7 @@ * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. + * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 1.25 +10 -12 jakarta-commons/collections/src/test/org/apache/commons/collections/TestLRUMap.java Index: TestLRUMap.java =================================================================== RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestLRUMap.java,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- TestLRUMap.java 31 Aug 2003 17:28:43 -0000 1.24 +++ TestLRUMap.java 5 Oct 2003 21:17:40 -0000 1.25 @@ -1,13 +1,10 @@ /* * $Header$ - * $Revision$ - * $Date$ - * * ==================================================================== * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999-2001 The Apache Software Foundation. All rights + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,7 +33,7 @@ * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. + * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES @@ -58,7 +55,6 @@ * <http://www.apache.org/>. * */ - package org.apache.commons.collections; import java.util.ArrayList; @@ -70,13 +66,15 @@ import junit.framework.Test; /** + * Tests LRUMap. + * + * @version $Revision$ $Date$ * - * @author <a href="mailto:[EMAIL PROTECTED]">James Strachan</a> - * @author <a href="mailto:[EMAIL PROTECTED]">Morgan Delagrange</a> - * @version $Id$ + * @author James Strachan + * @author Morgan Delagrange */ -public class TestLRUMap extends TestSequencedHashMap -{ +public class TestLRUMap extends TestSequencedHashMap { + public TestLRUMap(String testName) { super(testName); } 1.7 +8 -3 jakarta-commons/collections/src/test/org/apache/commons/collections/TestIteratorUtils.java Index: TestIteratorUtils.java =================================================================== RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestIteratorUtils.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- TestIteratorUtils.java 29 Sep 2003 03:56:12 -0000 1.6 +++ TestIteratorUtils.java 5 Oct 2003 21:17:40 -0000 1.7 @@ -4,7 +4,7 @@ * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999-2003 The Apache Software Foundation. All rights + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -68,8 +68,13 @@ import org.apache.commons.collections.iterators.ResetableIterator; import org.apache.commons.collections.iterators.ResetableListIterator; + /** - * Tests for IteratorUtils. + * Tests for IteratorUtils. + * + * @version $Revision$ $Date$ + * + * @author Unknown */ public class TestIteratorUtils extends BulkTest { 1.6 +3 -2 jakarta-commons/collections/src/test/org/apache/commons/collections/TestHashBag.java Index: TestHashBag.java =================================================================== RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestHashBag.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- TestHashBag.java 2 Oct 2003 22:35:31 -0000 1.5 +++ TestHashBag.java 5 Oct 2003 21:17:40 -0000 1.6 @@ -63,9 +63,10 @@ /** * Extension of [EMAIL PROTECTED] TestBag} for exercising the [EMAIL PROTECTED] HashBag} * implementation. + * + * @version $Revision$ $Date$ * * @author Chuck Burdick - * @version $Id$ */ public class TestHashBag extends AbstractTestBag { 1.3 +19 -14 jakarta-commons/collections/src/test/org/apache/commons/collections/TestMultiKey.java Index: TestMultiKey.java =================================================================== RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestMultiKey.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- TestMultiKey.java 31 Aug 2003 17:28:43 -0000 1.2 +++ TestMultiKey.java 5 Oct 2003 21:17:40 -0000 1.3 @@ -1,7 +1,10 @@ -/* ==================================================================== +/* + * $Header$ + * ==================================================================== + * * The Apache Software License, Version 1.1 * - * Copyright (c) 2003 The Apache Software Foundation. All rights + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -16,21 +19,21 @@ * the documentation and/or other materials provided with the * distribution. * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgement: + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowledgement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgement may appear in the software itself, * if and wherever such third-party acknowledgements normally appear. * - * 4. The names "Apache" and "Apache Software Foundation" and - * "Apache Turbine" must not be used to endorse or promote products - * derived from this software without prior written permission. For - * written permission, please contact [EMAIL PROTECTED] - * - * 5. Products derived from this software may not be called "Apache", - * "Apache Turbine", nor may "Apache" appear in their name, without - * prior written permission of the Apache Software Foundation. + * 4. The names "The Jakarta Project", "Commons", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact [EMAIL PROTECTED] + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES @@ -50,6 +53,7 @@ * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. + * */ package org.apache.commons.collections; @@ -61,8 +65,9 @@ import junit.framework.TestSuite; /** - * Unit tests - * [EMAIL PROTECTED] org.apache.commons.collections.MultiKey}. + * Unit tests for [EMAIL PROTECTED] org.apache.commons.collections.MultiKey}. + * + * @version $Revision$ $Date$ * * @author Stephen Colebourne */ 1.13 +73 -86 jakarta-commons/collections/src/test/org/apache/commons/collections/TestMultiHashMap.java Index: TestMultiHashMap.java =================================================================== RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestMultiHashMap.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- TestMultiHashMap.java 2 Oct 2003 23:01:10 -0000 1.12 +++ TestMultiHashMap.java 5 Oct 2003 21:17:40 -0000 1.13 @@ -1,13 +1,10 @@ /* * $Header$ - * $Revision$ - * $Date$ - * * ==================================================================== * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999-2001 The Apache Software Foundation. All rights + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,7 +33,7 @@ * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. + * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES @@ -58,7 +55,6 @@ * <http://www.apache.org/>. * */ - package org.apache.commons.collections; import java.util.Collection; @@ -68,26 +64,25 @@ import junit.framework.Test; import junit.framework.TestSuite; - /** * Unit Tests for <code>MultiHashMap</code>. + * + * @version $Revision$ $Date$ * + * @author Unknown */ -public class TestMultiHashMap extends AbstractTestMap -{ - public TestMultiHashMap(String testName) - { +public class TestMultiHashMap extends AbstractTestMap { + + public TestMultiHashMap(String testName) { super(testName); } - public static Test suite() - { + public static Test suite() { return new TestSuite(TestMultiHashMap.class); } - public static void main(String args[]) - { - String[] testCaseName = { TestMultiHashMap.class.getName() }; + public static void main(String args[]) { + String[] testCaseName = { TestMultiHashMap.class.getName()}; junit.textui.TestRunner.main(testCaseName); } @@ -103,52 +98,46 @@ //---------------------------- // Tests //---------------------------- - public void testPutNGet() - { + public void testPutNGet() { MultiHashMap map = new MultiHashMap(); - loadMap( map ); - checkMap( map ); - - assertTrue( map.get(new Integer(99)) == null ); - + loadMap(map); + checkMap(map); + + assertTrue(map.get(new Integer(99)) == null); + map.clear(); - assertTrue( map.size() == 0 ); + assertTrue(map.size() == 0); } - - public void testContainsValue() - { + + public void testContainsValue() { MultiHashMap map = new MultiHashMap(); - loadMap( map ); - - assertTrue( map.containsValue( "uno" ) ); - assertTrue( map.containsValue( "quatro" ) ); - assertTrue( map.containsValue( "two" ) ); - - assertTrue( ! map.containsValue( "uggaBugga" ) ); - + loadMap(map); + + assertTrue(map.containsValue("uno")); + assertTrue(map.containsValue("quatro")); + assertTrue(map.containsValue("two")); + + assertTrue(!map.containsValue("uggaBugga")); + map.clear(); } - public void testValues() - { + public void testValues() { MultiHashMap map = new MultiHashMap(); - loadMap( map ); - + loadMap(map); + Collection vals = map.values(); - assertTrue( vals.size() == getFullSize() ); - + assertTrue(vals.size() == getFullSize()); + map.clear(); } - - static private class MapPair - { - MapPair( int key, String val ) - { - mKey = new Integer( key ); + static private class MapPair { + MapPair(int key, String val) { + mKey = new Integer(key); mValue = val; } - + Integer mKey = null; String mValue = null; } @@ -162,68 +151,66 @@ {new MapPair(4,"four"), new MapPair(4,"quatro")} }; - private void loadMap( MultiHashMap map ) - { + private void loadMap(MultiHashMap map) { // Set up so that we load the keys "randomly" // (i.e. we don't want to load int row-order, so that all like keys // load together. We want to mix it up...) - + int numRows = sMapPairs.length; int maxCols = 0; - for( int ii=0; ii < sMapPairs.length; ii++ ){ - if ( sMapPairs[ii].length > maxCols ) + for (int ii = 0; ii < sMapPairs.length; ii++) { + if (sMapPairs[ii].length > maxCols) { maxCols = sMapPairs[ii].length; + } } - for( int ii=0; ii < maxCols; ii++ ){ - for( int jj=0; jj < numRows; jj++ ){ - if ( ii < sMapPairs[jj].length ) { - map.put( sMapPairs[jj][ii].mKey, sMapPairs[jj][ii].mValue); + for (int ii = 0; ii < maxCols; ii++) { + for (int jj = 0; jj < numRows; jj++) { + if (ii < sMapPairs[jj].length) { + map.put(sMapPairs[jj][ii].mKey, sMapPairs[jj][ii].mValue); //--------------------------------------------------------- } } } - assertTrue( map.size() == sMapPairs.length ); + assertTrue(map.size() == sMapPairs.length); } - private void checkMap( MultiHashMap map ) - { - for( int ii=0; ii < sMapPairs.length; ii++ ){ - checkKeyList( map, ii ); + private void checkMap(MultiHashMap map) { + for (int ii = 0; ii < sMapPairs.length; ii++) { + checkKeyList(map, ii); } } - - private void checkKeyList( MultiHashMap map, int index ) - { - assertTrue( index < sMapPairs.length ); - Integer key = sMapPairs[index][0].mKey ; - - Object obj = map.get( key ); + + private void checkKeyList(MultiHashMap map, int index) { + assertTrue(index < sMapPairs.length); + Integer key = sMapPairs[index][0].mKey; + + Object obj = map.get(key); //-------------------------- - - assertTrue( obj != null ); - assertTrue( obj instanceof Collection ); - Collection keyList = (Collection)obj; - - assertTrue( keyList.size() == sMapPairs[index].length ); + + assertTrue(obj != null); + assertTrue(obj instanceof Collection); + Collection keyList = (Collection) obj; + + assertTrue(keyList.size() == sMapPairs[index].length); Iterator iter = keyList.iterator(); - while ( iter.hasNext() ) { + while (iter.hasNext()) { Object oval = iter.next(); - assertTrue( oval != null ); - assertTrue( oval instanceof String ); - String val = (String)oval; + assertTrue(oval != null); + assertTrue(oval instanceof String); + String val = (String) oval; boolean foundIt = false; - for( int ii=0; ii < sMapPairs[index].length; ii++ ){ - if( val.equals( sMapPairs[index][ii].mValue ) ) + for (int ii = 0; ii < sMapPairs[index].length; ii++) { + if (val.equals(sMapPairs[index][ii].mValue)) { foundIt = true; + } } - assertTrue( foundIt ); + assertTrue(foundIt); } } - public int getFullSize() - { + public int getFullSize() { int len = 0; - for( int ii=0; ii < sMapPairs.length; ii++ ){ + for (int ii = 0; ii < sMapPairs.length; ii++) { len += sMapPairs[ii].length; } return len; 1.5 +6 -10 jakarta-commons/collections/src/test/org/apache/commons/collections/TestLinkedList.java Index: TestLinkedList.java =================================================================== RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestLinkedList.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- TestLinkedList.java 2 Oct 2003 22:14:29 -0000 1.4 +++ TestLinkedList.java 5 Oct 2003 21:17:40 -0000 1.5 @@ -1,13 +1,10 @@ /* * $Header$ - * $Revision$ - * $Date$ - * * ==================================================================== * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999-2001 The Apache Software Foundation. All rights + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,7 +33,7 @@ * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. + * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES @@ -58,7 +55,6 @@ * <http://www.apache.org/>. * */ - package org.apache.commons.collections; import java.util.Arrays; @@ -67,7 +63,6 @@ import java.util.List; import java.util.NoSuchElementException; - /** * Tests base [EMAIL PROTECTED] java.util.LinkedList} methods and contracts. * <p> @@ -77,9 +72,10 @@ * If your [EMAIL PROTECTED] LinkedList} fails one of these tests by design, * you may still use this base set of cases. Simply override the * test case (method) your [EMAIL PROTECTED] List} fails. + * + * @version $Revision$ $Date$ * - * @author <a href="mailto:[EMAIL PROTECTED]">Rich Dougherty</a> - * @version $Id$ + * @author Rich Dougherty */ public abstract class TestLinkedList extends AbstractTestList {
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]