added ReverseComparator test

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130623 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Morgan James Delagrange 2002-03-01 19:06:44 +00:00
parent 663401641b
commit 410d547028
2 changed files with 49 additions and 4 deletions

View File

@ -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.21 2002/03/01 18:36:21 morgand Exp $
* $Revision: 1.21 $
* $Date: 2002/03/01 18:36:21 $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestAll.java,v 1.22 2002/03/01 19:06:44 morgand Exp $
* $Revision: 1.22 $
* $Date: 2002/03/01 19:06:44 $
*
* ====================================================================
*
@ -67,7 +67,7 @@ import junit.framework.*;
/**
* Entry point for all Collections tests.
* @author Rodney Waldhoff
* @version $Id: TestAll.java,v 1.21 2002/03/01 18:36:21 morgand Exp $
* @version $Id: TestAll.java,v 1.22 2002/03/01 19:06:44 morgand Exp $
*/
public class TestAll extends TestCase {
public TestAll(String testName) {
@ -96,6 +96,7 @@ public class TestAll extends TestCase {
suite.addTest(TestHashBag.suite());
suite.addTest(TestLRUMap.suite());
suite.addTest(TestMultiHashMap.suite());
suite.addTest(TestReverseComparator.suite());
suite.addTest(TestSequencedHashMap.suite());
suite.addTest(TestSingletonIterator.suite());
suite.addTest(TestTreeBag.suite());

View File

@ -0,0 +1,44 @@
package org.apache.commons.collections.comparators;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
public class TestReverseComparator extends TestComparator {
public TestReverseComparator(String testName) {
super(testName);
}
public static Test suite() {
return new TestSuite(TestReverseComparator.class);
}
/**
* For the purposes of this test, return a
* ReverseComparator that wraps a ComparableComparator,
* which should produce a backward-ordered list
* identical to the java.util.Collection.reverseOrder()
* Comparator.
*
* @return Comparator that reverses a "natural" order
*/
public Comparator makeComparator() {
return new ReverseComparator(new ComparableComparator());
}
public List getComparableObjectsOrdered() {
List list = new LinkedList();
list.add(new Integer(5));
list.add(new Integer(4));
list.add(new Integer(3));
list.add(new Integer(2));
list.add(new Integer(1));
return list;
}
}