Update licence and version
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@131244 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7621d6e135
commit
2e1a8cb3f2
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestHashBag.java,v 1.5 2003/10/02 22:35:31 scolebourne Exp $
|
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestHashBag.java,v 1.6 2003/10/05 21:17:40 scolebourne Exp $
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*
|
*
|
||||||
* The Apache Software License, Version 1.1
|
* The Apache Software License, Version 1.1
|
||||||
|
@ -63,9 +63,10 @@ import junit.framework.TestSuite;
|
||||||
/**
|
/**
|
||||||
* Extension of {@link TestBag} for exercising the {@link HashBag}
|
* Extension of {@link TestBag} for exercising the {@link HashBag}
|
||||||
* implementation.
|
* implementation.
|
||||||
|
*
|
||||||
|
* @version $Revision: 1.6 $ $Date: 2003/10/05 21:17:40 $
|
||||||
*
|
*
|
||||||
* @author Chuck Burdick
|
* @author Chuck Burdick
|
||||||
* @version $Id: TestHashBag.java,v 1.5 2003/10/02 22:35:31 scolebourne Exp $
|
|
||||||
*/
|
*/
|
||||||
public class TestHashBag extends AbstractTestBag {
|
public class TestHashBag extends AbstractTestBag {
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestIteratorUtils.java,v 1.6 2003/09/29 03:56:12 psteitz Exp $
|
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestIteratorUtils.java,v 1.7 2003/10/05 21:17:40 scolebourne Exp $
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*
|
*
|
||||||
* The Apache Software License, Version 1.1
|
* 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.
|
* reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -68,8 +68,13 @@ import junit.framework.Test;
|
||||||
|
|
||||||
import org.apache.commons.collections.iterators.ResetableIterator;
|
import org.apache.commons.collections.iterators.ResetableIterator;
|
||||||
import org.apache.commons.collections.iterators.ResetableListIterator;
|
import org.apache.commons.collections.iterators.ResetableListIterator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for IteratorUtils.
|
* Tests for IteratorUtils.
|
||||||
|
*
|
||||||
|
* @version $Revision: 1.7 $ $Date: 2003/10/05 21:17:40 $
|
||||||
|
*
|
||||||
|
* @author Unknown
|
||||||
*/
|
*/
|
||||||
public class TestIteratorUtils extends BulkTest {
|
public class TestIteratorUtils extends BulkTest {
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestLRUMap.java,v 1.24 2003/08/31 17:28:43 scolebourne Exp $
|
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestLRUMap.java,v 1.25 2003/10/05 21:17:40 scolebourne Exp $
|
||||||
* $Revision: 1.24 $
|
|
||||||
* $Date: 2003/08/31 17:28:43 $
|
|
||||||
*
|
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*
|
*
|
||||||
* The Apache Software License, Version 1.1
|
* 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.
|
* reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* 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"
|
* 5. Products derived from this software may not be called "Apache"
|
||||||
* nor may "Apache" appear in their names without prior written
|
* 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
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||||
|
@ -58,7 +55,6 @@
|
||||||
* <http://www.apache.org/>.
|
* <http://www.apache.org/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.apache.commons.collections;
|
package org.apache.commons.collections;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -70,13 +66,15 @@ import java.util.Set;
|
||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Tests LRUMap.
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
|
* @version $Revision: 1.25 $ $Date: 2003/10/05 21:17:40 $
|
||||||
* @author <a href="mailto:morgand@apache.org">Morgan Delagrange</a>
|
*
|
||||||
* @version $Id: TestLRUMap.java,v 1.24 2003/08/31 17:28:43 scolebourne Exp $
|
* @author James Strachan
|
||||||
|
* @author Morgan Delagrange
|
||||||
*/
|
*/
|
||||||
public class TestLRUMap extends TestSequencedHashMap
|
public class TestLRUMap extends TestSequencedHashMap {
|
||||||
{
|
|
||||||
public TestLRUMap(String testName) {
|
public TestLRUMap(String testName) {
|
||||||
super(testName);
|
super(testName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestLinkedList.java,v 1.4 2003/10/02 22:14:29 scolebourne Exp $
|
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestLinkedList.java,v 1.5 2003/10/05 21:17:40 scolebourne Exp $
|
||||||
* $Revision: 1.4 $
|
|
||||||
* $Date: 2003/10/02 22:14:29 $
|
|
||||||
*
|
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*
|
*
|
||||||
* The Apache Software License, Version 1.1
|
* 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.
|
* reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* 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"
|
* 5. Products derived from this software may not be called "Apache"
|
||||||
* nor may "Apache" appear in their names without prior written
|
* 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
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||||
|
@ -58,7 +55,6 @@
|
||||||
* <http://www.apache.org/>.
|
* <http://www.apache.org/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.apache.commons.collections;
|
package org.apache.commons.collections;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -67,7 +63,6 @@ import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests base {@link java.util.LinkedList} methods and contracts.
|
* Tests base {@link java.util.LinkedList} methods and contracts.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -77,9 +72,10 @@ import java.util.NoSuchElementException;
|
||||||
* If your {@link LinkedList} fails one of these tests by design,
|
* If your {@link LinkedList} fails one of these tests by design,
|
||||||
* you may still use this base set of cases. Simply override the
|
* you may still use this base set of cases. Simply override the
|
||||||
* test case (method) your {@link List} fails.
|
* test case (method) your {@link List} fails.
|
||||||
|
*
|
||||||
|
* @version $Revision: 1.5 $ $Date: 2003/10/05 21:17:40 $
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:rich@rd.gen.nz">Rich Dougherty</a>
|
* @author Rich Dougherty
|
||||||
* @version $Id: TestLinkedList.java,v 1.4 2003/10/02 22:14:29 scolebourne Exp $
|
|
||||||
*/
|
*/
|
||||||
public abstract class TestLinkedList extends AbstractTestList {
|
public abstract class TestLinkedList extends AbstractTestList {
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestListUtils.java,v 1.13 2003/10/02 22:14:29 scolebourne Exp $
|
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestListUtils.java,v 1.14 2003/10/05 21:17:39 scolebourne Exp $
|
||||||
* $Revision: 1.13 $
|
|
||||||
* $Date: 2003/10/02 22:14:29 $
|
|
||||||
*
|
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*
|
*
|
||||||
* The Apache Software License, Version 1.1
|
* 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.
|
* reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* 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"
|
* 5. Products derived from this software may not be called "Apache"
|
||||||
* nor may "Apache" appear in their names without prior written
|
* 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
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||||
|
@ -72,6 +69,8 @@ import org.apache.commons.collections.decorators.PredicatedList;
|
||||||
/**
|
/**
|
||||||
* Tests for ListUtils.
|
* Tests for ListUtils.
|
||||||
*
|
*
|
||||||
|
* @version $Revision: 1.14 $ $Date: 2003/10/05 21:17:39 $
|
||||||
|
*
|
||||||
* @author Stephen Colebourne
|
* @author Stephen Colebourne
|
||||||
* @author Neil O'Toole
|
* @author Neil O'Toole
|
||||||
* @author Matthew Hawthorne
|
* @author Matthew Hawthorne
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestMapUtils.java,v 1.16 2003/10/02 23:01:09 scolebourne Exp $
|
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestMapUtils.java,v 1.17 2003/10/05 21:17:40 scolebourne Exp $
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*
|
*
|
||||||
* The Apache Software License, Version 1.1
|
* 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.
|
* reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* 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"
|
* 5. Products derived from this software may not be called "Apache"
|
||||||
* nor may "Apache" appear in their names without prior written
|
* 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
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||||
|
@ -76,7 +76,7 @@ import org.apache.commons.collections.decorators.PredicatedMap;
|
||||||
/**
|
/**
|
||||||
* Tests for MapUtils.
|
* Tests for MapUtils.
|
||||||
*
|
*
|
||||||
* @version $Revision: 1.16 $ $Date: 2003/10/02 23:01:09 $
|
* @version $Revision: 1.17 $ $Date: 2003/10/05 21:17:40 $
|
||||||
*
|
*
|
||||||
* @author Stephen Colebourne
|
* @author Stephen Colebourne
|
||||||
* @author Arun Mammen Thomas
|
* @author Arun Mammen Thomas
|
||||||
|
|
|
@ -1,13 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestMultiHashMap.java,v 1.12 2003/10/02 23:01:10 scolebourne Exp $
|
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestMultiHashMap.java,v 1.13 2003/10/05 21:17:40 scolebourne Exp $
|
||||||
* $Revision: 1.12 $
|
|
||||||
* $Date: 2003/10/02 23:01:10 $
|
|
||||||
*
|
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*
|
*
|
||||||
* The Apache Software License, Version 1.1
|
* 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.
|
* reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* 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"
|
* 5. Products derived from this software may not be called "Apache"
|
||||||
* nor may "Apache" appear in their names without prior written
|
* 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
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||||
|
@ -58,7 +55,6 @@
|
||||||
* <http://www.apache.org/>.
|
* <http://www.apache.org/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.apache.commons.collections;
|
package org.apache.commons.collections;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
@ -68,26 +64,25 @@ import java.util.Map;
|
||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
import junit.framework.TestSuite;
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unit Tests for <code>MultiHashMap</code>.
|
* Unit Tests for <code>MultiHashMap</code>.
|
||||||
|
*
|
||||||
|
* @version $Revision: 1.13 $ $Date: 2003/10/05 21:17:40 $
|
||||||
*
|
*
|
||||||
|
* @author Unknown
|
||||||
*/
|
*/
|
||||||
public class TestMultiHashMap extends AbstractTestMap
|
public class TestMultiHashMap extends AbstractTestMap {
|
||||||
{
|
|
||||||
public TestMultiHashMap(String testName)
|
public TestMultiHashMap(String testName) {
|
||||||
{
|
|
||||||
super(testName);
|
super(testName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Test suite()
|
public static Test suite() {
|
||||||
{
|
|
||||||
return new TestSuite(TestMultiHashMap.class);
|
return new TestSuite(TestMultiHashMap.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String args[])
|
public static void main(String args[]) {
|
||||||
{
|
String[] testCaseName = { TestMultiHashMap.class.getName()};
|
||||||
String[] testCaseName = { TestMultiHashMap.class.getName() };
|
|
||||||
junit.textui.TestRunner.main(testCaseName);
|
junit.textui.TestRunner.main(testCaseName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,52 +98,46 @@ public class TestMultiHashMap extends AbstractTestMap
|
||||||
//----------------------------
|
//----------------------------
|
||||||
// Tests
|
// Tests
|
||||||
//----------------------------
|
//----------------------------
|
||||||
public void testPutNGet()
|
public void testPutNGet() {
|
||||||
{
|
|
||||||
MultiHashMap map = new MultiHashMap();
|
MultiHashMap map = new MultiHashMap();
|
||||||
loadMap( map );
|
loadMap(map);
|
||||||
checkMap( map );
|
checkMap(map);
|
||||||
|
|
||||||
assertTrue( map.get(new Integer(99)) == null );
|
assertTrue(map.get(new Integer(99)) == null);
|
||||||
|
|
||||||
map.clear();
|
map.clear();
|
||||||
assertTrue( map.size() == 0 );
|
assertTrue(map.size() == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testContainsValue()
|
public void testContainsValue() {
|
||||||
{
|
|
||||||
MultiHashMap map = new MultiHashMap();
|
MultiHashMap map = new MultiHashMap();
|
||||||
loadMap( map );
|
loadMap(map);
|
||||||
|
|
||||||
assertTrue( map.containsValue( "uno" ) );
|
assertTrue(map.containsValue("uno"));
|
||||||
assertTrue( map.containsValue( "quatro" ) );
|
assertTrue(map.containsValue("quatro"));
|
||||||
assertTrue( map.containsValue( "two" ) );
|
assertTrue(map.containsValue("two"));
|
||||||
|
|
||||||
assertTrue( ! map.containsValue( "uggaBugga" ) );
|
assertTrue(!map.containsValue("uggaBugga"));
|
||||||
|
|
||||||
map.clear();
|
map.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testValues()
|
public void testValues() {
|
||||||
{
|
|
||||||
MultiHashMap map = new MultiHashMap();
|
MultiHashMap map = new MultiHashMap();
|
||||||
loadMap( map );
|
loadMap(map);
|
||||||
|
|
||||||
Collection vals = map.values();
|
Collection vals = map.values();
|
||||||
assertTrue( vals.size() == getFullSize() );
|
assertTrue(vals.size() == getFullSize());
|
||||||
|
|
||||||
map.clear();
|
map.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static private class MapPair {
|
||||||
static private class MapPair
|
MapPair(int key, String val) {
|
||||||
{
|
mKey = new Integer(key);
|
||||||
MapPair( int key, String val )
|
|
||||||
{
|
|
||||||
mKey = new Integer( key );
|
|
||||||
mValue = val;
|
mValue = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
Integer mKey = null;
|
Integer mKey = null;
|
||||||
String mValue = null;
|
String mValue = null;
|
||||||
}
|
}
|
||||||
|
@ -162,68 +151,66 @@ public class TestMultiHashMap extends AbstractTestMap
|
||||||
{new MapPair(4,"four"), new MapPair(4,"quatro")}
|
{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"
|
// 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
|
// (i.e. we don't want to load int row-order, so that all like keys
|
||||||
// load together. We want to mix it up...)
|
// load together. We want to mix it up...)
|
||||||
|
|
||||||
int numRows = sMapPairs.length;
|
int numRows = sMapPairs.length;
|
||||||
int maxCols = 0;
|
int maxCols = 0;
|
||||||
for( int ii=0; ii < sMapPairs.length; ii++ ){
|
for (int ii = 0; ii < sMapPairs.length; ii++) {
|
||||||
if ( sMapPairs[ii].length > maxCols )
|
if (sMapPairs[ii].length > maxCols) {
|
||||||
maxCols = sMapPairs[ii].length;
|
maxCols = sMapPairs[ii].length;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for( int ii=0; ii < maxCols; ii++ ){
|
for (int ii = 0; ii < maxCols; ii++) {
|
||||||
for( int jj=0; jj < numRows; jj++ ){
|
for (int jj = 0; jj < numRows; jj++) {
|
||||||
if ( ii < sMapPairs[jj].length ) {
|
if (ii < sMapPairs[jj].length) {
|
||||||
map.put( sMapPairs[jj][ii].mKey, sMapPairs[jj][ii].mValue);
|
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 )
|
private void checkMap(MultiHashMap map) {
|
||||||
{
|
for (int ii = 0; ii < sMapPairs.length; ii++) {
|
||||||
for( int ii=0; ii < sMapPairs.length; ii++ ){
|
checkKeyList(map, ii);
|
||||||
checkKeyList( map, ii );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkKeyList( MultiHashMap map, int index )
|
private void checkKeyList(MultiHashMap map, int index) {
|
||||||
{
|
assertTrue(index < sMapPairs.length);
|
||||||
assertTrue( index < sMapPairs.length );
|
Integer key = sMapPairs[index][0].mKey;
|
||||||
Integer key = sMapPairs[index][0].mKey ;
|
|
||||||
|
Object obj = map.get(key);
|
||||||
Object obj = map.get( key );
|
|
||||||
//--------------------------
|
//--------------------------
|
||||||
|
|
||||||
assertTrue( obj != null );
|
assertTrue(obj != null);
|
||||||
assertTrue( obj instanceof Collection );
|
assertTrue(obj instanceof Collection);
|
||||||
Collection keyList = (Collection)obj;
|
Collection keyList = (Collection) obj;
|
||||||
|
|
||||||
assertTrue( keyList.size() == sMapPairs[index].length );
|
assertTrue(keyList.size() == sMapPairs[index].length);
|
||||||
Iterator iter = keyList.iterator();
|
Iterator iter = keyList.iterator();
|
||||||
while ( iter.hasNext() ) {
|
while (iter.hasNext()) {
|
||||||
Object oval = iter.next();
|
Object oval = iter.next();
|
||||||
assertTrue( oval != null );
|
assertTrue(oval != null);
|
||||||
assertTrue( oval instanceof String );
|
assertTrue(oval instanceof String);
|
||||||
String val = (String)oval;
|
String val = (String) oval;
|
||||||
boolean foundIt = false;
|
boolean foundIt = false;
|
||||||
for( int ii=0; ii < sMapPairs[index].length; ii++ ){
|
for (int ii = 0; ii < sMapPairs[index].length; ii++) {
|
||||||
if( val.equals( sMapPairs[index][ii].mValue ) )
|
if (val.equals(sMapPairs[index][ii].mValue)) {
|
||||||
foundIt = true;
|
foundIt = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
assertTrue( foundIt );
|
assertTrue(foundIt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFullSize()
|
public int getFullSize() {
|
||||||
{
|
|
||||||
int len = 0;
|
int len = 0;
|
||||||
for( int ii=0; ii < sMapPairs.length; ii++ ){
|
for (int ii = 0; ii < sMapPairs.length; ii++) {
|
||||||
len += sMapPairs[ii].length;
|
len += sMapPairs[ii].length;
|
||||||
}
|
}
|
||||||
return len;
|
return len;
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
/* ====================================================================
|
/*
|
||||||
|
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/TestMultiKey.java,v 1.3 2003/10/05 21:17:40 scolebourne Exp $
|
||||||
|
* ====================================================================
|
||||||
|
*
|
||||||
* The Apache Software License, Version 1.1
|
* 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.
|
* reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -16,21 +19,21 @@
|
||||||
* the documentation and/or other materials provided with the
|
* the documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
*
|
*
|
||||||
* 3. The end-user documentation included with the redistribution,
|
* 3. The end-user documentation included with the redistribution, if
|
||||||
* if any, must include the following acknowledgement:
|
* any, must include the following acknowledgement:
|
||||||
* "This product includes software developed by the
|
* "This product includes software developed by the
|
||||||
* Apache Software Foundation (http://www.apache.org/)."
|
* Apache Software Foundation (http://www.apache.org/)."
|
||||||
* Alternately, this acknowledgement may appear in the software itself,
|
* Alternately, this acknowledgement may appear in the software itself,
|
||||||
* if and wherever such third-party acknowledgements normally appear.
|
* if and wherever such third-party acknowledgements normally appear.
|
||||||
*
|
*
|
||||||
* 4. The names "Apache" and "Apache Software Foundation" and
|
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
|
||||||
* "Apache Turbine" must not be used to endorse or promote products
|
* Foundation" must not be used to endorse or promote products derived
|
||||||
* derived from this software without prior written permission. For
|
* from this software without prior written permission. For written
|
||||||
* written permission, please contact apache@apache.org.
|
* permission, please contact apache@apache.org.
|
||||||
*
|
*
|
||||||
* 5. Products derived from this software may not be called "Apache",
|
* 5. Products derived from this software may not be called "Apache"
|
||||||
* "Apache Turbine", nor may "Apache" appear in their name, without
|
* nor may "Apache" appear in their names without prior written
|
||||||
* prior written permission of the Apache Software Foundation.
|
* permission of the Apache Software Foundation.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||||
|
@ -50,6 +53,7 @@
|
||||||
* individuals on behalf of the Apache Software Foundation. For more
|
* individuals on behalf of the Apache Software Foundation. For more
|
||||||
* information on the Apache Software Foundation, please see
|
* information on the Apache Software Foundation, please see
|
||||||
* <http://www.apache.org/>.
|
* <http://www.apache.org/>.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
package org.apache.commons.collections;
|
package org.apache.commons.collections;
|
||||||
|
|
||||||
|
@ -61,8 +65,9 @@ import junit.framework.TestCase;
|
||||||
import junit.framework.TestSuite;
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unit tests
|
* Unit tests for {@link org.apache.commons.collections.MultiKey}.
|
||||||
* {@link org.apache.commons.collections.MultiKey}.
|
*
|
||||||
|
* @version $Revision: 1.3 $ $Date: 2003/10/05 21:17:40 $
|
||||||
*
|
*
|
||||||
* @author Stephen Colebourne
|
* @author Stephen Colebourne
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue