commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pascalschumac...@apache.org
Subject [lang] deprecate SystemUtils#LINE_SEPARATOR in favor of java.lang.System#lineSeparator
Date Fri, 20 Jan 2017 16:42:00 GMT
Repository: commons-lang
Updated Branches:
  refs/heads/master aab4018d8 -> d0e2bfc46


deprecate SystemUtils#LINE_SEPARATOR in favor of java.lang.System#lineSeparator


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

Branch: refs/heads/master
Commit: d0e2bfc46659025e6262b2e5de984a8359c9dada
Parents: aab4018
Author: pascalschumacher <pascalschumacher@gmx.net>
Authored: Fri Jan 20 17:40:38 2017 +0100
Committer: pascalschumacher <pascalschumacher@gmx.net>
Committed: Fri Jan 20 17:41:03 2017 +0100

----------------------------------------------------------------------
 .../org/apache/commons/lang3/SystemUtils.java   |  2 +
 .../MultilineRecursiveToStringStyle.java        | 13 ++--
 .../commons/lang3/builder/ToStringStyle.java    |  5 +-
 .../commons/lang3/exception/ExceptionUtils.java |  4 +-
 .../apache/commons/lang3/text/StrBuilder.java   |  3 +-
 .../apache/commons/lang3/text/WordUtils.java    |  3 +-
 .../lang3/builder/JsonToStringStyleTest.java    | 13 ++--
 .../builder/MultiLineToStringStyleTest.java     | 69 ++++++++++----------
 .../MultilineRecursiveToStringStyleTest.java    |  3 +-
 .../lang3/text/StrBuilderAppendInsertTest.java  |  4 +-
 .../commons/lang3/text/WordUtilsTest.java       |  5 +-
 11 files changed, 58 insertions(+), 66 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-lang/blob/d0e2bfc4/src/main/java/org/apache/commons/lang3/SystemUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/SystemUtils.java b/src/main/java/org/apache/commons/lang3/SystemUtils.java
index 8425c5c..f553618 100644
--- a/src/main/java/org/apache/commons/lang3/SystemUtils.java
+++ b/src/main/java/org/apache/commons/lang3/SystemUtils.java
@@ -664,8 +664,10 @@ public class SystemUtils {
      * sync with that System property.
      * </p>
      *
+     * @deprecated Use {@link System#lineSeparator} instead, since it does not require a
privilege check.
      * @since Java 1.1
      */
+    @Deprecated
     public static final String LINE_SEPARATOR = getSystemProperty("line.separator");
 
     /**

http://git-wip-us.apache.org/repos/asf/commons-lang/blob/d0e2bfc4/src/main/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyle.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyle.java
b/src/main/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyle.java
index d1a2ad2..311a698 100644
--- a/src/main/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyle.java
+++ b/src/main/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyle.java
@@ -18,7 +18,6 @@
 package org.apache.commons.lang3.builder;
 
 import org.apache.commons.lang3.ClassUtils;
-import org.apache.commons.lang3.SystemUtils;
 
 /**
  * <p>Works with {@link ToStringBuilder} to create a "deep" <code>toString</code>.
@@ -89,13 +88,13 @@ public class MultilineRecursiveToStringStyle extends RecursiveToStringStyle
{
      * Must be invoked after changing the {@link #spaces} value.
      */
     private void resetIndent() {
-        setArrayStart("{" + SystemUtils.LINE_SEPARATOR + spacer(spaces));
-        setArraySeparator("," + SystemUtils.LINE_SEPARATOR + spacer(spaces));
-        setArrayEnd(SystemUtils.LINE_SEPARATOR + spacer(spaces - indent) + "}");
+        setArrayStart("{" + System.lineSeparator() + spacer(spaces));
+        setArraySeparator("," + System.lineSeparator() + spacer(spaces));
+        setArrayEnd(System.lineSeparator() + spacer(spaces - indent) + "}");
 
-        setContentStart("[" + SystemUtils.LINE_SEPARATOR + spacer(spaces));
-        setFieldSeparator("," + SystemUtils.LINE_SEPARATOR + spacer(spaces));
-        setContentEnd(SystemUtils.LINE_SEPARATOR + spacer(spaces - indent) + "]");
+        setContentStart("[" + System.lineSeparator() + spacer(spaces));
+        setFieldSeparator("," + System.lineSeparator() + spacer(spaces));
+        setContentEnd(System.lineSeparator() + spacer(spaces - indent) + "]");
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/commons-lang/blob/d0e2bfc4/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java b/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java
index 4b3cc53..f4eb64e 100644
--- a/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java
+++ b/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java
@@ -25,7 +25,6 @@ import java.util.WeakHashMap;
 import org.apache.commons.lang3.ClassUtils;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.SystemUtils;
 
 /**
  * <p>Controls <code>String</code> formatting for {@link ToStringBuilder}.
@@ -2294,9 +2293,9 @@ public abstract class ToStringStyle implements Serializable {
         MultiLineToStringStyle() {
             super();
             this.setContentStart("[");
-            this.setFieldSeparator(SystemUtils.LINE_SEPARATOR + "  ");
+            this.setFieldSeparator(System.lineSeparator() + "  ");
             this.setFieldSeparatorAtStart(true);
-            this.setContentEnd(SystemUtils.LINE_SEPARATOR + "]");
+            this.setContentEnd(System.lineSeparator() + "]");
         }
 
         /**

http://git-wip-us.apache.org/repos/asf/commons-lang/blob/d0e2bfc4/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java b/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java
index 70d9bee..b9cfc49 100644
--- a/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java
+++ b/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java
@@ -615,7 +615,7 @@ public class ExceptionUtils {
      * @return an array where each element is a line from the argument
      */
     static String[] getStackFrames(final String stackTrace) {
-        final String linebreak = SystemUtils.LINE_SEPARATOR;
+        final String linebreak = System.lineSeparator();
         final StringTokenizer frames = new StringTokenizer(stackTrace, linebreak);
         final List<String> list = new ArrayList<>();
         while (frames.hasMoreTokens()) {
@@ -638,7 +638,7 @@ public class ExceptionUtils {
      */
     static List<String> getStackFrameList(final Throwable t) {
         final String stackTrace = getStackTrace(t);
-        final String linebreak = SystemUtils.LINE_SEPARATOR;
+        final String linebreak = System.lineSeparator();
         final StringTokenizer frames = new StringTokenizer(stackTrace, linebreak);
         final List<String> list = new ArrayList<>();
         boolean traceStarted = false;

http://git-wip-us.apache.org/repos/asf/commons-lang/blob/d0e2bfc4/src/main/java/org/apache/commons/lang3/text/StrBuilder.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/text/StrBuilder.java b/src/main/java/org/apache/commons/lang3/text/StrBuilder.java
index 5f9aa15..c7691a4 100644
--- a/src/main/java/org/apache/commons/lang3/text/StrBuilder.java
+++ b/src/main/java/org/apache/commons/lang3/text/StrBuilder.java
@@ -27,7 +27,6 @@ import java.util.Objects;
 
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.SystemUtils;
 import org.apache.commons.lang3.builder.Builder;
 
 /**
@@ -477,7 +476,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable,
Build
      */
     public StrBuilder appendNewLine() {
         if (newLine == null)  {
-            append(SystemUtils.LINE_SEPARATOR);
+            append(System.lineSeparator());
             return this;
         }
         return append(newLine);

http://git-wip-us.apache.org/repos/asf/commons-lang/blob/d0e2bfc4/src/main/java/org/apache/commons/lang3/text/WordUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/text/WordUtils.java b/src/main/java/org/apache/commons/lang3/text/WordUtils.java
index 43bc564..0f6f363 100644
--- a/src/main/java/org/apache/commons/lang3/text/WordUtils.java
+++ b/src/main/java/org/apache/commons/lang3/text/WordUtils.java
@@ -21,7 +21,6 @@ import java.util.regex.Pattern;
 
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.SystemUtils;
 
 /**
  * <p>Operations on Strings that contain words.</p>
@@ -270,7 +269,7 @@ public class WordUtils {
             return null;
         }
         if (newLineStr == null) {
-            newLineStr = SystemUtils.LINE_SEPARATOR;
+            newLineStr = System.lineSeparator();
         }
         if (wrapLength < 1) {
             wrapLength = 1;

http://git-wip-us.apache.org/repos/asf/commons-lang/blob/d0e2bfc4/src/test/java/org/apache/commons/lang3/builder/JsonToStringStyleTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/builder/JsonToStringStyleTest.java b/src/test/java/org/apache/commons/lang3/builder/JsonToStringStyleTest.java
index 3543988..580a254 100644
--- a/src/test/java/org/apache/commons/lang3/builder/JsonToStringStyleTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/JsonToStringStyleTest.java
@@ -23,7 +23,6 @@ import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
 
-import org.apache.commons.lang3.SystemUtils;
 import org.apache.commons.lang3.builder.ToStringStyleTest.Person;
 import org.junit.After;
 import org.junit.Before;
@@ -63,25 +62,25 @@ public class JsonToStringStyleTest {
         assertEquals(
                 "{}",
                 new ToStringBuilder(base).appendSuper(
-                        "Integer@8888[" + SystemUtils.LINE_SEPARATOR + "]")
+                        "Integer@8888[" + System.lineSeparator() + "]")
                         .toString());
         assertEquals(
                 "{}",
                 new ToStringBuilder(base).appendSuper(
-                        "Integer@8888[" + SystemUtils.LINE_SEPARATOR + "  null"
-                                + SystemUtils.LINE_SEPARATOR + "]").toString());
+                        "Integer@8888[" + System.lineSeparator() + "  null"
+                                + System.lineSeparator() + "]").toString());
         assertEquals(
                 "{\"a\":\"hello\"}",
                 new ToStringBuilder(base)
                         .appendSuper(
-                                "Integer@8888[" + SystemUtils.LINE_SEPARATOR
+                                "Integer@8888[" + System.lineSeparator()
                                         + "]").append("a", "hello").toString());
         assertEquals(
                 "{\"a\":\"hello\"}",
                 new ToStringBuilder(base)
                         .appendSuper(
-                                "Integer@8888[" + SystemUtils.LINE_SEPARATOR
-                                        + "  null" + SystemUtils.LINE_SEPARATOR
+                                "Integer@8888[" + System.lineSeparator()
+                                        + "  null" + System.lineSeparator()
                                         + "]").append("a", "hello").toString());
         assertEquals("{\"a\":\"hello\"}", new ToStringBuilder(base)
                 .appendSuper(null).append("a", "hello").toString());

http://git-wip-us.apache.org/repos/asf/commons-lang/blob/d0e2bfc4/src/test/java/org/apache/commons/lang3/builder/MultiLineToStringStyleTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/builder/MultiLineToStringStyleTest.java
b/src/test/java/org/apache/commons/lang3/builder/MultiLineToStringStyleTest.java
index 2f85751..8454c5b 100644
--- a/src/test/java/org/apache/commons/lang3/builder/MultiLineToStringStyleTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/MultiLineToStringStyleTest.java
@@ -21,7 +21,6 @@ import static org.junit.Assert.assertEquals;
 import java.util.ArrayList;
 import java.util.HashMap;
 
-import org.apache.commons.lang3.SystemUtils;
 import org.apache.commons.lang3.builder.ToStringStyleTest.Person;
 import org.junit.After;
 import org.junit.Before;
@@ -49,35 +48,35 @@ public class MultiLineToStringStyleTest {
 
     @Test
     public void testBlank() {
-        assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + "]", new ToStringBuilder(base).toString());
+        assertEquals(baseStr + "[" + System.lineSeparator() + "]", new ToStringBuilder(base).toString());
     }
 
     @Test
     public void testAppendSuper() {
-        assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + "]", new ToStringBuilder(base).appendSuper("Integer@8888["
+ SystemUtils.LINE_SEPARATOR + "]").toString());
-        assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + "  <null>" + SystemUtils.LINE_SEPARATOR
+ "]", new ToStringBuilder(base).appendSuper("Integer@8888[" + SystemUtils.LINE_SEPARATOR
+ "  <null>" + SystemUtils.LINE_SEPARATOR + "]").toString());
+        assertEquals(baseStr + "[" + System.lineSeparator() + "]", new ToStringBuilder(base).appendSuper("Integer@8888["
+ System.lineSeparator() + "]").toString());
+        assertEquals(baseStr + "[" + System.lineSeparator() + "  <null>" + System.lineSeparator()
+ "]", new ToStringBuilder(base).appendSuper("Integer@8888[" + System.lineSeparator() + "
 <null>" + System.lineSeparator() + "]").toString());
         
-        assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + "  a=hello" + SystemUtils.LINE_SEPARATOR
+ "]", new ToStringBuilder(base).appendSuper("Integer@8888[" + SystemUtils.LINE_SEPARATOR
+ "]").append("a", "hello").toString());
-        assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + "  <null>" + SystemUtils.LINE_SEPARATOR
+ "  a=hello" + SystemUtils.LINE_SEPARATOR + "]", new ToStringBuilder(base).appendSuper("Integer@8888["
+ SystemUtils.LINE_SEPARATOR + "  <null>" + SystemUtils.LINE_SEPARATOR + "]").append("a",
"hello").toString());
-        assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + "  a=hello" + SystemUtils.LINE_SEPARATOR
+ "]", new ToStringBuilder(base).appendSuper(null).append("a", "hello").toString());
+        assertEquals(baseStr + "[" + System.lineSeparator() + "  a=hello" + System.lineSeparator()
+ "]", new ToStringBuilder(base).appendSuper("Integer@8888[" + System.lineSeparator() + "]").append("a",
"hello").toString());
+        assertEquals(baseStr + "[" + System.lineSeparator() + "  <null>" + System.lineSeparator()
+ "  a=hello" + System.lineSeparator() + "]", new ToStringBuilder(base).appendSuper("Integer@8888["
+ System.lineSeparator() + "  <null>" + System.lineSeparator() + "]").append("a", "hello").toString());
+        assertEquals(baseStr + "[" + System.lineSeparator() + "  a=hello" + System.lineSeparator()
+ "]", new ToStringBuilder(base).appendSuper(null).append("a", "hello").toString());
     }
     
     @Test
     public void testObject() {
         final Integer i3 = Integer.valueOf(3);
         final Integer i4 = Integer.valueOf(4);
-        assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + "  <null>" + SystemUtils.LINE_SEPARATOR
+ "]", new ToStringBuilder(base).append((Object) null).toString());
-        assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + "  3" + SystemUtils.LINE_SEPARATOR
+ "]", new ToStringBuilder(base).append(i3).toString());
-        assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + "  a=<null>" + SystemUtils.LINE_SEPARATOR
+ "]", new ToStringBuilder(base).append("a", (Object) null).toString());
-        assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + "  a=3" + SystemUtils.LINE_SEPARATOR
+ "]", new ToStringBuilder(base).append("a", i3).toString());
-        assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + "  a=3" + SystemUtils.LINE_SEPARATOR
+ "  b=4" + SystemUtils.LINE_SEPARATOR + "]", new ToStringBuilder(base).append("a", i3).append("b",
i4).toString());
-        assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + "  a=<Integer>" +
SystemUtils.LINE_SEPARATOR + "]", new ToStringBuilder(base).append("a", i3, false).toString());
-        assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + "  a=<size=0>" +
SystemUtils.LINE_SEPARATOR + "]", new ToStringBuilder(base).append("a", new ArrayList<>(),
false).toString());
-        assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + "  a=[]" + SystemUtils.LINE_SEPARATOR
+ "]", new ToStringBuilder(base).append("a", new ArrayList<>(), true).toString());
-        assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + "  a=<size=0>" +
SystemUtils.LINE_SEPARATOR + "]", new ToStringBuilder(base).append("a", new HashMap<>(),
false).toString());
-        assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + "  a={}" + SystemUtils.LINE_SEPARATOR
+ "]", new ToStringBuilder(base).append("a", new HashMap<>(), true).toString());
-        assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + "  a=<size=0>" +
SystemUtils.LINE_SEPARATOR + "]", new ToStringBuilder(base).append("a", (Object) new String[0],
false).toString());
-        assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + "  a={}" + SystemUtils.LINE_SEPARATOR
+ "]", new ToStringBuilder(base).append("a", (Object) new String[0], true).toString());
+        assertEquals(baseStr + "[" + System.lineSeparator() + "  <null>" + System.lineSeparator()
+ "]", new ToStringBuilder(base).append((Object) null).toString());
+        assertEquals(baseStr + "[" + System.lineSeparator() + "  3" + System.lineSeparator()
+ "]", new ToStringBuilder(base).append(i3).toString());
+        assertEquals(baseStr + "[" + System.lineSeparator() + "  a=<null>" + System.lineSeparator()
+ "]", new ToStringBuilder(base).append("a", (Object) null).toString());
+        assertEquals(baseStr + "[" + System.lineSeparator() + "  a=3" + System.lineSeparator()
+ "]", new ToStringBuilder(base).append("a", i3).toString());
+        assertEquals(baseStr + "[" + System.lineSeparator() + "  a=3" + System.lineSeparator()
+ "  b=4" + System.lineSeparator() + "]", new ToStringBuilder(base).append("a", i3).append("b",
i4).toString());
+        assertEquals(baseStr + "[" + System.lineSeparator() + "  a=<Integer>" + System.lineSeparator()
+ "]", new ToStringBuilder(base).append("a", i3, false).toString());
+        assertEquals(baseStr + "[" + System.lineSeparator() + "  a=<size=0>" + System.lineSeparator()
+ "]", new ToStringBuilder(base).append("a", new ArrayList<>(), false).toString());
+        assertEquals(baseStr + "[" + System.lineSeparator() + "  a=[]" + System.lineSeparator()
+ "]", new ToStringBuilder(base).append("a", new ArrayList<>(), true).toString());
+        assertEquals(baseStr + "[" + System.lineSeparator() + "  a=<size=0>" + System.lineSeparator()
+ "]", new ToStringBuilder(base).append("a", new HashMap<>(), false).toString());
+        assertEquals(baseStr + "[" + System.lineSeparator() + "  a={}" + System.lineSeparator()
+ "]", new ToStringBuilder(base).append("a", new HashMap<>(), true).toString());
+        assertEquals(baseStr + "[" + System.lineSeparator() + "  a=<size=0>" + System.lineSeparator()
+ "]", new ToStringBuilder(base).append("a", (Object) new String[0], false).toString());
+        assertEquals(baseStr + "[" + System.lineSeparator() + "  a={}" + System.lineSeparator()
+ "]", new ToStringBuilder(base).append("a", (Object) new String[0], true).toString());
     }
 
     @Test
@@ -87,44 +86,44 @@ public class MultiLineToStringStyleTest {
         p.age = 25;
         p.smoker = true;
         final String pBaseStr = p.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(p));
-        assertEquals(pBaseStr + "[" + SystemUtils.LINE_SEPARATOR + "  name=Jane Doe" + SystemUtils.LINE_SEPARATOR
+ "  age=25" + SystemUtils.LINE_SEPARATOR + "  smoker=true" + SystemUtils.LINE_SEPARATOR +
"]", new ToStringBuilder(p).append("name", p.name).append("age", p.age).append("smoker", p.smoker).toString());
+        assertEquals(pBaseStr + "[" + System.lineSeparator() + "  name=Jane Doe" + System.lineSeparator()
+ "  age=25" + System.lineSeparator() + "  smoker=true" + System.lineSeparator() + "]", new
ToStringBuilder(p).append("name", p.name).append("age", p.age).append("smoker", p.smoker).toString());
     }
 
     @Test
     public void testLong() {
-        assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + "  3" + SystemUtils.LINE_SEPARATOR
+ "]", new ToStringBuilder(base).append(3L).toString());
-        assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + "  a=3" + SystemUtils.LINE_SEPARATOR
+ "]", new ToStringBuilder(base).append("a", 3L).toString());
-        assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + "  a=3" + SystemUtils.LINE_SEPARATOR
+ "  b=4" + SystemUtils.LINE_SEPARATOR + "]", new ToStringBuilder(base).append("a", 3L).append("b",
4L).toString());
+        assertEquals(baseStr + "[" + System.lineSeparator() + "  3" + System.lineSeparator()
+ "]", new ToStringBuilder(base).append(3L).toString());
+        assertEquals(baseStr + "[" + System.lineSeparator() + "  a=3" + System.lineSeparator()
+ "]", new ToStringBuilder(base).append("a", 3L).toString());
+        assertEquals(baseStr + "[" + System.lineSeparator() + "  a=3" + System.lineSeparator()
+ "  b=4" + System.lineSeparator() + "]", new ToStringBuilder(base).append("a", 3L).append("b",
4L).toString());
     }
 
     @Test
     public void testObjectArray() {
         Object[] array = new Object[] {null, base, new int[] {3, 6}};
-        assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + "  {<null>,5,{3,6}}"
+ SystemUtils.LINE_SEPARATOR + "]", new ToStringBuilder(base).append(array).toString());
-        assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + "  {<null>,5,{3,6}}"
+ SystemUtils.LINE_SEPARATOR + "]", new ToStringBuilder(base).append((Object) array).toString());
+        assertEquals(baseStr + "[" + System.lineSeparator() + "  {<null>,5,{3,6}}"
+ System.lineSeparator() + "]", new ToStringBuilder(base).append(array).toString());
+        assertEquals(baseStr + "[" + System.lineSeparator() + "  {<null>,5,{3,6}}"
+ System.lineSeparator() + "]", new ToStringBuilder(base).append((Object) array).toString());
         array = null;
-        assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + "  <null>" + SystemUtils.LINE_SEPARATOR
+ "]", new ToStringBuilder(base).append(array).toString());
-        assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + "  <null>" + SystemUtils.LINE_SEPARATOR
+ "]", new ToStringBuilder(base).append((Object) array).toString());
+        assertEquals(baseStr + "[" + System.lineSeparator() + "  <null>" + System.lineSeparator()
+ "]", new ToStringBuilder(base).append(array).toString());
+        assertEquals(baseStr + "[" + System.lineSeparator() + "  <null>" + System.lineSeparator()
+ "]", new ToStringBuilder(base).append((Object) array).toString());
     }
 
     @Test
     public void testLongArray() {
         long[] array = new long[] {1, 2, -3, 4};
-        assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + "  {1,2,-3,4}" + SystemUtils.LINE_SEPARATOR
+ "]", new ToStringBuilder(base).append(array).toString());
-        assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + "  {1,2,-3,4}" + SystemUtils.LINE_SEPARATOR
+ "]", new ToStringBuilder(base).append((Object) array).toString());
+        assertEquals(baseStr + "[" + System.lineSeparator() + "  {1,2,-3,4}" + System.lineSeparator()
+ "]", new ToStringBuilder(base).append(array).toString());
+        assertEquals(baseStr + "[" + System.lineSeparator() + "  {1,2,-3,4}" + System.lineSeparator()
+ "]", new ToStringBuilder(base).append((Object) array).toString());
         array = null;
-        assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + "  <null>" + SystemUtils.LINE_SEPARATOR
+ "]", new ToStringBuilder(base).append(array).toString());
-        assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + "  <null>" + SystemUtils.LINE_SEPARATOR
+ "]", new ToStringBuilder(base).append((Object) array).toString());
+        assertEquals(baseStr + "[" + System.lineSeparator() + "  <null>" + System.lineSeparator()
+ "]", new ToStringBuilder(base).append(array).toString());
+        assertEquals(baseStr + "[" + System.lineSeparator() + "  <null>" + System.lineSeparator()
+ "]", new ToStringBuilder(base).append((Object) array).toString());
     }
 
     @Test
     public void testLongArrayArray() {
         long[][] array = new long[][] {{1, 2}, null, {5}};
-        assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + "  {{1,2},<null>,{5}}"
+ SystemUtils.LINE_SEPARATOR + "]", new ToStringBuilder(base).append(array).toString());
-        assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + "  {{1,2},<null>,{5}}"
+ SystemUtils.LINE_SEPARATOR + "]", new ToStringBuilder(base).append((Object) array).toString());
+        assertEquals(baseStr + "[" + System.lineSeparator() + "  {{1,2},<null>,{5}}"
+ System.lineSeparator() + "]", new ToStringBuilder(base).append(array).toString());
+        assertEquals(baseStr + "[" + System.lineSeparator() + "  {{1,2},<null>,{5}}"
+ System.lineSeparator() + "]", new ToStringBuilder(base).append((Object) array).toString());
         array = null;
-        assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + "  <null>" + SystemUtils.LINE_SEPARATOR
+ "]", new ToStringBuilder(base).append(array).toString());
-        assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + "  <null>" + SystemUtils.LINE_SEPARATOR
+ "]", new ToStringBuilder(base).append((Object) array).toString());
+        assertEquals(baseStr + "[" + System.lineSeparator() + "  <null>" + System.lineSeparator()
+ "]", new ToStringBuilder(base).append(array).toString());
+        assertEquals(baseStr + "[" + System.lineSeparator() + "  <null>" + System.lineSeparator()
+ "]", new ToStringBuilder(base).append((Object) array).toString());
     }
 
 }

http://git-wip-us.apache.org/repos/asf/commons-lang/blob/d0e2bfc4/src/test/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyleTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyleTest.java
b/src/test/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyleTest.java
index 51dfff4..5e74aec 100644
--- a/src/test/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyleTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyleTest.java
@@ -22,14 +22,13 @@ import static org.junit.Assert.*;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.lang3.SystemUtils;
 import org.junit.Test;
 
 /**
  */
 public class MultilineRecursiveToStringStyleTest {
 
-    private final String BR = SystemUtils.LINE_SEPARATOR;
+    private final String BR = System.lineSeparator();
 
     @Test
     public void simpleObject() {

http://git-wip-us.apache.org/repos/asf/commons-lang/blob/d0e2bfc4/src/test/java/org/apache/commons/lang3/text/StrBuilderAppendInsertTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/text/StrBuilderAppendInsertTest.java b/src/test/java/org/apache/commons/lang3/text/StrBuilderAppendInsertTest.java
index 542cddf..d35b2cc 100644
--- a/src/test/java/org/apache/commons/lang3/text/StrBuilderAppendInsertTest.java
+++ b/src/test/java/org/apache/commons/lang3/text/StrBuilderAppendInsertTest.java
@@ -26,15 +26,13 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.Iterator;
 
-import org.apache.commons.lang3.SystemUtils;
-
 /**
  * Unit tests for {@link org.apache.commons.lang3.text.StrBuilder}.
  */
 public class StrBuilderAppendInsertTest {
 
     /** The system line separator. */
-    private static final String SEP = SystemUtils.LINE_SEPARATOR;
+    private static final String SEP = System.lineSeparator();
 
     /** Test subclass of Object, with a toString method. */
     private static final Object FOO = new Object() {

http://git-wip-us.apache.org/repos/asf/commons-lang/blob/d0e2bfc4/src/test/java/org/apache/commons/lang3/text/WordUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/text/WordUtilsTest.java b/src/test/java/org/apache/commons/lang3/text/WordUtilsTest.java
index 05d3b8a..4bdd88c 100644
--- a/src/test/java/org/apache/commons/lang3/text/WordUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/text/WordUtilsTest.java
@@ -21,7 +21,6 @@ import static org.junit.Assert.*;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Modifier;
 
-import org.apache.commons.lang3.SystemUtils;
 import org.junit.Test;
 
 /**
@@ -50,7 +49,7 @@ public class WordUtilsTest {
         assertEquals("", WordUtils.wrap("", -1));
         
         // normal
-        final String systemNewLine = SystemUtils.LINE_SEPARATOR;
+        final String systemNewLine = System.lineSeparator();
         String input = "Here is one line of text that is going to be wrapped after 20 columns.";
         String expected = "Here is one line of" + systemNewLine + "text that is going" 
             + systemNewLine + "to be wrapped after" + systemNewLine + "20 columns.";
@@ -112,7 +111,7 @@ public class WordUtilsTest {
         assertEquals(expected, WordUtils.wrap(input, -1, "\n", false));
 
         // system newline char
-        final String systemNewLine = SystemUtils.LINE_SEPARATOR;
+        final String systemNewLine = System.lineSeparator();
         input = "Here is one line of text that is going to be wrapped after 20 columns.";
         expected = "Here is one line of" + systemNewLine + "text that is going" + systemNewLine

             + "to be wrapped after" + systemNewLine + "20 columns.";


Mime
View raw message