commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djo...@apache.org
Subject [lang] RecursiveToStringStyleTest now uses correct ToStringStyle in tests.
Date Wed, 23 Nov 2016 19:33:39 GMT
Repository: commons-lang
Updated Branches:
  refs/heads/master 2d6dea18b -> 41bc4cd02


RecursiveToStringStyleTest now uses correct ToStringStyle in tests.

Thanks to Dominik Stadler for patch.

Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/41bc4cd0
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/41bc4cd0
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/41bc4cd0

Branch: refs/heads/master
Commit: 41bc4cd029fc486b5570ec344cdeae049bbca860
Parents: 2d6dea1
Author: duncan <duncan@wortharead.com>
Authored: Wed Nov 23 19:32:51 2016 +0000
Committer: duncan <duncan@wortharead.com>
Committed: Wed Nov 23 19:32:51 2016 +0000

----------------------------------------------------------------------
 .../commons/lang3/builder/RecursiveToStringStyleTest.java   | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-lang/blob/41bc4cd0/src/test/java/org/apache/commons/lang3/builder/RecursiveToStringStyleTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/builder/RecursiveToStringStyleTest.java
b/src/test/java/org/apache/commons/lang3/builder/RecursiveToStringStyleTest.java
index bbe7d2b..dbf36c1 100644
--- a/src/test/java/org/apache/commons/lang3/builder/RecursiveToStringStyleTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/RecursiveToStringStyleTest.java
@@ -35,7 +35,7 @@ public class RecursiveToStringStyleTest {
     
     @Before
     public void setUp() throws Exception {
-        ToStringBuilder.setDefaultStyle(ToStringStyle.DEFAULT_STYLE);
+        ToStringBuilder.setDefaultStyle(new RecursiveToStringStyle());
     }
 
     @After
@@ -64,14 +64,17 @@ public class RecursiveToStringStyleTest {
     public void testObject() {
         final Integer i3 = Integer.valueOf(3);
         final Integer i4 = Integer.valueOf(4);
+        final ArrayList<Object> emptyList = new ArrayList<>();
+        
         assertEquals(baseStr + "[<null>]", new ToStringBuilder(base).append((Object)
null).toString());
         assertEquals(baseStr + "[3]", new ToStringBuilder(base).append(i3).toString());
         assertEquals(baseStr + "[a=<null>]", new ToStringBuilder(base).append("a",
(Object) null).toString());
         assertEquals(baseStr + "[a=3]", new ToStringBuilder(base).append("a", i3).toString());
         assertEquals(baseStr + "[a=3,b=4]", new ToStringBuilder(base).append("a", i3).append("b",
i4).toString());
         assertEquals(baseStr + "[a=<Integer>]", new ToStringBuilder(base).append("a",
i3, false).toString());
-        assertEquals(baseStr + "[a=<size=0>]", new ToStringBuilder(base).append("a",
new ArrayList<>(), false).toString());
-        assertEquals(baseStr + "[a=[]]", new ToStringBuilder(base).append("a", new ArrayList<>(),
true).toString());
+        assertEquals(baseStr + "[a=<size=0>]", new ToStringBuilder(base).append("a",
emptyList, false).toString());      
+        assertEquals(baseStr + "[a=java.util.ArrayList@" + Integer.toHexString(System.identityHashCode(emptyList))
+ "{}]",
+                new ToStringBuilder(base).append("a", emptyList, true).toString());
         assertEquals(baseStr + "[a=<size=0>]", new ToStringBuilder(base).append("a",
new HashMap<>(), false).toString());
         assertEquals(baseStr + "[a={}]", new ToStringBuilder(base).append("a", new HashMap<>(),
true).toString());
         assertEquals(baseStr + "[a=<size=0>]", new ToStringBuilder(base).append("a",
(Object) new String[0], false).toString());


Mime
View raw message