commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bay...@apache.org
Subject svn commit: r1153037 - /commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java
Date Tue, 02 Aug 2011 06:14:17 GMT
Author: bayard
Date: Tue Aug  2 06:14:17 2011
New Revision: 1153037

URL: http://svn.apache.org/viewvc?rev=1153037&view=rev
Log:
Rearranging the testReflectionHierarchyArrayList test per LANG-727; shouldn't make assumptions
about ArrayList now

Modified:
    commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java

Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java?rev=1153037&r1=1153036&r2=1153037&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java
(original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java
Tue Aug  2 06:14:17 2011
@@ -22,6 +22,8 @@ import java.util.List;
 
 import junit.framework.TestCase;
 
+import org.apache.commons.lang3.StringUtils;
+
 /**
  * Unit tests for {@link org.apache.commons.lang3.builder.ToStringBuilder}.
  *
@@ -300,8 +302,15 @@ public class ToStringBuilderTest extends
     public void testReflectionHierarchyArrayList() {
         List<Object> base = new ArrayList<Object>();
         String baseStr = this.toBaseString(base);
-        assertEquals(baseStr + "[elementData={<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>},size=0,modCount=0]",
ToStringBuilder.reflectionToString(base, null, true));
+
+        String result = ToStringBuilder.reflectionToString(base, null, true);
+        assertTrue( StringUtils.startsWith(result, baseStr + "[") );
+        assertTrue( StringUtils.contains(result, "elementData={<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>}"
) );
+        assertTrue( StringUtils.contains(result, "size=0") );
+        assertTrue( StringUtils.contains(result, "modCount=0") );
+        assertTrue( StringUtils.endsWith(result, "]") );
         assertEquals(baseStr + "[size=0]", ToStringBuilder.reflectionToString(base, null,
false));
+
         this.validateNullToStringStyleRegistry();
     }
 



Mime
View raw message