added unit test for LRUMap.removeLRU(), which needs fixing
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130514 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
97f0e7ff26
commit
e71840e0bb
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestAll.java,v 1.14 2002/01/20 04:36:08 craigmcc Exp $
|
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestAll.java,v 1.15 2002/02/13 20:59:12 morgand Exp $
|
||||||
* $Revision: 1.14 $
|
* $Revision: 1.15 $
|
||||||
* $Date: 2002/01/20 04:36:08 $
|
* $Date: 2002/02/13 20:59:12 $
|
||||||
*
|
*
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*
|
*
|
||||||
|
@ -66,7 +66,7 @@ import junit.framework.*;
|
||||||
/**
|
/**
|
||||||
* Entry point for all Collections tests.
|
* Entry point for all Collections tests.
|
||||||
* @author Rodney Waldhoff
|
* @author Rodney Waldhoff
|
||||||
* @version $Id: TestAll.java,v 1.14 2002/01/20 04:36:08 craigmcc Exp $
|
* @version $Id: TestAll.java,v 1.15 2002/02/13 20:59:12 morgand Exp $
|
||||||
*/
|
*/
|
||||||
public class TestAll extends TestCase {
|
public class TestAll extends TestCase {
|
||||||
public TestAll(String testName) {
|
public TestAll(String testName) {
|
||||||
|
@ -96,6 +96,7 @@ public class TestAll extends TestCase {
|
||||||
suite.addTest(TestTreeBag.suite());
|
suite.addTest(TestTreeBag.suite());
|
||||||
suite.addTest(TestTreeMap.suite());
|
suite.addTest(TestTreeMap.suite());
|
||||||
suite.addTest(TestDoubleOrderedMap.suite());
|
suite.addTest(TestDoubleOrderedMap.suite());
|
||||||
|
suite.addTest(TestLRUMap.suite());
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestLRUMap.java,v 1.1 2001/05/06 11:10:36 jstrachan Exp $
|
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestLRUMap.java,v 1.2 2002/02/13 20:59:12 morgand Exp $
|
||||||
* $Revision: 1.1 $
|
* $Revision: 1.2 $
|
||||||
* $Date: 2001/05/06 11:10:36 $
|
* $Date: 2002/02/13 20:59:12 $
|
||||||
*
|
*
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*
|
*
|
||||||
|
@ -69,7 +69,7 @@ import java.util.HashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
|
* @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
|
||||||
* @version $Id: TestLRUMap.java,v 1.1 2001/05/06 11:10:36 jstrachan Exp $
|
* @version $Id: TestLRUMap.java,v 1.2 2002/02/13 20:59:12 morgand Exp $
|
||||||
*/
|
*/
|
||||||
public class TestLRUMap extends TestHashMap
|
public class TestLRUMap extends TestHashMap
|
||||||
{
|
{
|
||||||
|
@ -95,4 +95,16 @@ public class TestLRUMap extends TestHashMap
|
||||||
map = (HashMap) makeMap();
|
map = (HashMap) makeMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testRemoveLRU() {
|
||||||
|
LRUMap map2 = new LRUMap(4);
|
||||||
|
map2.put(new Integer(1),"foo");
|
||||||
|
map2.put(new Integer(2),"foo");
|
||||||
|
map2.put(new Integer(3),"foo");
|
||||||
|
map2.put(new Integer(4),"foo");
|
||||||
|
map2.removeLRU(); // should be Integer(4)
|
||||||
|
|
||||||
|
assertTrue("Second to last value should exist",map2.get(new Integer(3)).equals("foo"));
|
||||||
|
assertTrue("Last value inserted should not exist", map2.get(new Integer(4)) == null);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue