deprecate SystemUtils#LINE_SEPARATOR in favor of java.lang.System#lineSeparator
This commit is contained in:
parent
aab4018d8f
commit
d0e2bfc466
|
@ -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");
|
||||
|
||||
/**
|
||||
|
|
|
@ -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) + "]");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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() + "]");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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.";
|
||||
|
|
Loading…
Reference in New Issue