convert "assertTrue(a.equals(b))" to the equivalent but better reported "assertEquals(a,b)"

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@131259 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Rodney Waldhoff 2003-10-09 10:39:16 +00:00
parent 4a1340c1d9
commit 8dbaeed44c
1 changed files with 20 additions and 19 deletions

View File

@ -1,5 +1,5 @@
/* /*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestCollectionUtils.java,v 1.25 2003/10/05 21:03:44 scolebourne Exp $ * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestCollectionUtils.java,v 1.26 2003/10/09 10:39:16 rwaldhoff Exp $
* ==================================================================== * ====================================================================
* *
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
@ -89,7 +89,7 @@ import org.apache.commons.collections.decorators.UnmodifiableCollection;
* @author Stephen Colebourne * @author Stephen Colebourne
* @author Phil Steitz * @author Phil Steitz
* *
* @version $Revision: 1.25 $ $Date: 2003/10/05 21:03:44 $ * @version $Revision: 1.26 $ $Date: 2003/10/09 10:39:16 $
*/ */
public class TestCollectionUtils extends TestCase { public class TestCollectionUtils extends TestCase {
@ -596,12 +596,13 @@ public class TestCollectionUtils extends TestCase {
Map map = new HashMap(); Map map = new HashMap();
map.put("zeroKey", "zero"); map.put("zeroKey", "zero");
map.put("oneKey", "one"); map.put("oneKey", "one");
Object test = CollectionUtils.get(map, 0); Object test = CollectionUtils.get(map, 0);
assertTrue(((Map.Entry) test).getKey().equals("zeroKey")); assertEquals("zeroKey",((Map.Entry) test).getKey());
assertTrue(((Map.Entry) test).getValue().equals("zero")); assertEquals("zero",((Map.Entry) test).getValue());
test = CollectionUtils.get(map, 1); test = CollectionUtils.get(map, 1);
assertTrue(((Map.Entry) test).getKey().equals("oneKey")); assertEquals("oneKey",((Map.Entry) test).getKey());
assertTrue(((Map.Entry) test).getValue().equals("one")); assertEquals("one",((Map.Entry) test).getValue());
// Map index out of range // Map index out of range
try { try {
@ -622,20 +623,20 @@ public class TestCollectionUtils extends TestCase {
map2.put("zeroKey", "zero"); map2.put("zeroKey", "zero");
map2.put("oneKey", "one"); map2.put("oneKey", "one");
test = CollectionUtils.get(map2, 1); test = CollectionUtils.get(map2, 1);
assertTrue(((Map.Entry) test).getKey().equals("zeroKey")); assertEquals("zeroKey",((Map.Entry) test).getKey());
assertTrue(((Map.Entry) test).getValue().equals("zero")); assertEquals("zero",((Map.Entry) test).getValue());
test = CollectionUtils.get(map2, 0); test = CollectionUtils.get(map2, 0);
assertTrue(((Map.Entry) test).getKey().equals("oneKey")); assertEquals("oneKey",((Map.Entry) test).getKey());
assertTrue(((Map.Entry) test).getValue().equals("one")); assertEquals("one",((Map.Entry) test).getValue());
// List, entry exists // List, entry exists
List list = new ArrayList(); List list = new ArrayList();
list.add("zero"); list.add("zero");
list.add("one"); list.add("one");
test = CollectionUtils.get(list, 0); test = CollectionUtils.get(list, 0);
assertTrue(test.equals("zero")); assertEquals("zero",test);
test = CollectionUtils.get(list, 1); test = CollectionUtils.get(list, 1);
assertTrue(test.equals("one")); assertEquals("one",test);
// list, non-existent entry -- IndexOutOfBoundsException // list, non-existent entry -- IndexOutOfBoundsException
try { try {
@ -648,10 +649,10 @@ public class TestCollectionUtils extends TestCase {
// Iterator, entry exists // Iterator, entry exists
Iterator iterator = list.iterator(); Iterator iterator = list.iterator();
test = CollectionUtils.get(iterator,0); test = CollectionUtils.get(iterator,0);
assertTrue(test.equals("zero")); assertEquals("zero",test);
iterator = list.iterator(); iterator = list.iterator();
test = CollectionUtils.get(iterator,1); test = CollectionUtils.get(iterator,1);
assertTrue(test.equals("one")); assertEquals("one",test);
// Iterator, non-existent entry // Iterator, non-existent entry
try { try {
@ -666,10 +667,10 @@ public class TestCollectionUtils extends TestCase {
Vector vector = new Vector(list); Vector vector = new Vector(list);
Enumeration enum = vector.elements(); Enumeration enum = vector.elements();
test = CollectionUtils.get(enum,0); test = CollectionUtils.get(enum,0);
assertTrue(test.equals("zero")); assertEquals("zero",test);
enum = vector.elements(); enum = vector.elements();
test = CollectionUtils.get(enum,1); test = CollectionUtils.get(enum,1);
assertTrue(test.equals("one")); assertEquals("one",test);
// Enumerator, non-existent entry // Enumerator, non-existent entry
try { try {
@ -684,7 +685,7 @@ public class TestCollectionUtils extends TestCase {
Bag bag = new HashBag(); Bag bag = new HashBag();
bag.add("element", 1); bag.add("element", 1);
test = CollectionUtils.get(bag, 0); test = CollectionUtils.get(bag, 0);
assertTrue(test.equals("element")); assertEquals("element",test);
// Collection, non-existent entry // Collection, non-existent entry
try { try {
@ -699,9 +700,9 @@ public class TestCollectionUtils extends TestCase {
objArray[0] = "zero"; objArray[0] = "zero";
objArray[1] = "one"; objArray[1] = "one";
test = CollectionUtils.get(objArray,0); test = CollectionUtils.get(objArray,0);
assertTrue(test.equals("zero")); assertEquals("zero",test);
test = CollectionUtils.get(objArray,1); test = CollectionUtils.get(objArray,1);
assertTrue(test.equals("one")); assertEquals("one",test);
// Object array, non-existent entry -- ArrayIndexOutOfBoundsException // Object array, non-existent entry -- ArrayIndexOutOfBoundsException
try { try {