From 656312f90a5e59ca0e7a5ae7f17fe941877f3aac Mon Sep 17 00:00:00 2001 From: Henri Yandell Date: Tue, 2 Aug 2011 06:14:17 +0000 Subject: [PATCH] Rearranging the testReflectionHierarchyArrayList test per LANG-727; shouldn't make assumptions about ArrayList now git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1153037 13f79535-47bb-0310-9956-ffa450edef68 --- .../commons/lang3/builder/ToStringBuilderTest.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java b/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java index 5e66b67f8..04d54d0ce 100644 --- a/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java @@ -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 TestCase { public void testReflectionHierarchyArrayList() { List base = new ArrayList(); String baseStr = this.toBaseString(base); - assertEquals(baseStr + "[elementData={,,,,,,,,,},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={,,,,,,,,,}" ) ); + 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(); }