commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwaldh...@apache.org
Subject cvs commit: jakarta-commons/collections/src/test/org/apache/commons/collections TestCollectionUtils.java
Date Thu, 09 Oct 2003 10:39:16 GMT
rwaldhoff    2003/10/09 03:39:16

  Modified:    collections/src/test/org/apache/commons/collections
                        TestCollectionUtils.java
  Log:
  convert "assertTrue(a.equals(b))" to the equivalent but better reported "assertEquals(a,b)"
  
  Revision  Changes    Path
  1.26      +20 -19    jakarta-commons/collections/src/test/org/apache/commons/collections/TestCollectionUtils.java
  
  Index: TestCollectionUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestCollectionUtils.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- TestCollectionUtils.java	5 Oct 2003 21:03:44 -0000	1.25
  +++ TestCollectionUtils.java	9 Oct 2003 10:39:16 -0000	1.26
  @@ -596,12 +596,13 @@
           Map map = new HashMap();
           map.put("zeroKey", "zero");
           map.put("oneKey", "one");
  +
           Object test = CollectionUtils.get(map, 0);
  -        assertTrue(((Map.Entry) test).getKey().equals("zeroKey"));
  -        assertTrue(((Map.Entry) test).getValue().equals("zero"));
  +        assertEquals("zeroKey",((Map.Entry) test).getKey());
  +        assertEquals("zero",((Map.Entry) test).getValue());
           test = CollectionUtils.get(map, 1);
  -        assertTrue(((Map.Entry) test).getKey().equals("oneKey"));
  -        assertTrue(((Map.Entry) test).getValue().equals("one"));
  +        assertEquals("oneKey",((Map.Entry) test).getKey());
  +        assertEquals("one",((Map.Entry) test).getValue());
           
           // Map index out of range
           try {
  @@ -622,20 +623,20 @@
           map2.put("zeroKey", "zero");
           map2.put("oneKey", "one");
           test = CollectionUtils.get(map2, 1);
  -        assertTrue(((Map.Entry) test).getKey().equals("zeroKey"));
  -        assertTrue(((Map.Entry) test).getValue().equals("zero"));
  +        assertEquals("zeroKey",((Map.Entry) test).getKey());
  +        assertEquals("zero",((Map.Entry) test).getValue());
           test = CollectionUtils.get(map2, 0);
  -        assertTrue(((Map.Entry) test).getKey().equals("oneKey"));
  -        assertTrue(((Map.Entry) test).getValue().equals("one"));
  +        assertEquals("oneKey",((Map.Entry) test).getKey());
  +        assertEquals("one",((Map.Entry) test).getValue());
                   
           // List, entry exists
           List list = new ArrayList();
           list.add("zero");
           list.add("one");
           test = CollectionUtils.get(list, 0);
  -        assertTrue(test.equals("zero"));
  +        assertEquals("zero",test);
           test = CollectionUtils.get(list, 1);
  -        assertTrue(test.equals("one"));
  +        assertEquals("one",test);
           
           // list, non-existent entry -- IndexOutOfBoundsException
           try {
  @@ -648,10 +649,10 @@
           // Iterator, entry exists
           Iterator iterator = list.iterator();
           test = CollectionUtils.get(iterator,0);
  -        assertTrue(test.equals("zero"));
  +        assertEquals("zero",test);
           iterator = list.iterator();
           test = CollectionUtils.get(iterator,1);
  -        assertTrue(test.equals("one"));
  +        assertEquals("one",test);
           
           // Iterator, non-existent entry 
           try {
  @@ -666,10 +667,10 @@
           Vector vector = new Vector(list);
           Enumeration enum = vector.elements();
           test = CollectionUtils.get(enum,0);
  -        assertTrue(test.equals("zero"));
  +        assertEquals("zero",test);
           enum = vector.elements();
           test = CollectionUtils.get(enum,1);
  -        assertTrue(test.equals("one"));
  +        assertEquals("one",test);
           
           // Enumerator, non-existent entry 
           try {
  @@ -684,7 +685,7 @@
           Bag bag = new HashBag();
           bag.add("element", 1);
           test = CollectionUtils.get(bag, 0);
  -        assertTrue(test.equals("element"));
  +        assertEquals("element",test);
           
           // Collection, non-existent entry
           try {
  @@ -699,9 +700,9 @@
           objArray[0] = "zero";
           objArray[1] = "one";
           test = CollectionUtils.get(objArray,0);
  -        assertTrue(test.equals("zero"));
  +        assertEquals("zero",test);
           test = CollectionUtils.get(objArray,1);
  -        assertTrue(test.equals("one"));
  +        assertEquals("one",test);
           
           // Object array, non-existent entry -- ArrayIndexOutOfBoundsException
           try {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message