commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject [lang] Break up testIdentityToStringStringBuilder into multiple test methods.
Date Fri, 10 Nov 2017 18:47:41 GMT
Repository: commons-lang
Updated Branches:
  refs/heads/master 4f928504e -> 22c304715


Break up testIdentityToStringStringBuilder into multiple test methods.

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

Branch: refs/heads/master
Commit: 22c30471564c730b02f5f7cedec28fcfe5749fc6
Parents: 4f92850
Author: Gary Gregory <ggregory@apache.org>
Authored: Fri Nov 10 11:47:35 2017 -0700
Committer: Gary Gregory <ggregory@apache.org>
Committed: Fri Nov 10 11:47:35 2017 -0700

----------------------------------------------------------------------
 .../apache/commons/lang3/ObjectUtilsTest.java   | 32 +++++++++++++++++---
 1 file changed, 27 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-lang/blob/22c30471/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java b/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java
index d42b93a..445e5e2 100644
--- a/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java
@@ -192,11 +192,27 @@ public class ObjectUtilsTest {
     }
 
     @Test
-    public void testIdentityToStringStringBuilder() {
+    public void testIdentityToStringObjectNull() {
         assertNull(ObjectUtils.identityToString(null));
+    }
+    
+    @Test
+    public void testIdentityToStringInteger() {
+        final Integer i = Integer.valueOf(90);
+        final String expected = "java.lang.Integer@" + Integer.toHexString(System.identityHashCode(i));
+
+        assertEquals(expected, ObjectUtils.identityToString(i));
+    }
+    
+    @Test
+    public void testIdentityToStringString() {
         assertEquals(
-            "java.lang.String@" + Integer.toHexString(System.identityHashCode(FOO)),
-            ObjectUtils.identityToString(FOO));
+                "java.lang.String@" + Integer.toHexString(System.identityHashCode(FOO)),
+                ObjectUtils.identityToString(FOO));
+    }
+    
+    @Test
+    public void testIdentityToStringStringBuilder() {
         final Integer i = Integer.valueOf(90);
         final String expected = "java.lang.Integer@" + Integer.toHexString(System.identityHashCode(i));
 
@@ -205,15 +221,21 @@ public class ObjectUtilsTest {
         final StringBuilder builder = new StringBuilder();
         ObjectUtils.identityToString(builder, i);
         assertEquals(expected, builder.toString());
+    }
 
+    @Test
+    public void testIdentityToStringStringBuilderNullValue() {
         try {
-            ObjectUtils.identityToString((StringBuilder)null, "tmp");
+            ObjectUtils.identityToString(new StringBuilder(), null);
             fail("NullPointerException expected");
         } catch(final NullPointerException npe) {
         }
+    }
 
+    @Test
+    public  void testIdentityToStringStringBuilderNullStringBuilder() {
         try {
-            ObjectUtils.identityToString(new StringBuilder(), null);
+            ObjectUtils.identityToString((StringBuilder)null, "tmp");
             fail("NullPointerException expected");
         } catch(final NullPointerException npe) {
         }


Mime
View raw message