http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/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 a5f7e1a..c1d6dcc 100644 --- a/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -75,13 +75,13 @@ public class ObjectUtilsTest { assertEquals("123", firstNonNullGenerics); assertEquals("123", ObjectUtils.firstNonNull("123", null, "456", null)); assertSame(Boolean.TRUE, ObjectUtils.firstNonNull(Boolean.TRUE)); - + // Explicitly pass in an empty array of Object type to ensure compiler doesn't complain of unchecked generic array creation assertNull(ObjectUtils.firstNonNull(new Object[0])); - + // Cast to Object in line below ensures compiler doesn't complain of unchecked generic array creation assertNull(ObjectUtils.firstNonNull(null, null)); - + assertNull(ObjectUtils.firstNonNull((Object) null)); assertNull(ObjectUtils.firstNonNull((Object[]) null)); } @@ -159,13 +159,13 @@ public class ObjectUtilsTest { public void testHashCodeMulti_multiple_likeList() { final List<Object> list0 = new ArrayList<>(Arrays.asList(new Object[0])); assertEquals(list0.hashCode(), ObjectUtils.hashCodeMulti()); - + final List<Object> list1 = new ArrayList<Object>(Arrays.asList("a")); assertEquals(list1.hashCode(), ObjectUtils.hashCodeMulti("a")); - + final List<Object> list2 = new ArrayList<Object>(Arrays.asList("a", "b")); assertEquals(list2.hashCode(), ObjectUtils.hashCodeMulti("a", "b")); - + final List<Object> list3 = new ArrayList<Object>(Arrays.asList("a", "b", "c")); assertEquals(list3.hashCode(), ObjectUtils.hashCodeMulti("a", "b", "c")); } @@ -190,7 +190,7 @@ public class ObjectUtilsTest { } catch(final NullPointerException npe) { } } - + @Test public void testIdentityToStringStringBuilder() { assertEquals(null, ObjectUtils.identityToString(null)); @@ -199,9 +199,9 @@ public class ObjectUtilsTest { ObjectUtils.identityToString(FOO)); final Integer i = Integer.valueOf(90); final String expected = "java.lang.Integer@" + Integer.toHexString(System.identityHashCode(i)); - + assertEquals(expected, ObjectUtils.identityToString(i)); - + final StringBuilder builder = new StringBuilder(); ObjectUtils.identityToString(builder, i); assertEquals(expected, builder.toString()); @@ -211,14 +211,14 @@ public class ObjectUtilsTest { fail("NullPointerException expected"); } catch(final NullPointerException npe) { } - + try { ObjectUtils.identityToString(new StringBuilder(), null); fail("NullPointerException expected"); } catch(final NullPointerException npe) { } } - + @Test public void testIdentityToStringStrBuilder() { final Integer i = Integer.valueOf(102); @@ -233,14 +233,14 @@ public class ObjectUtilsTest { fail("NullPointerException expected"); } catch(final NullPointerException npe) { } - + try { ObjectUtils.identityToString(new StrBuilder(), null); fail("NullPointerException expected"); } catch(final NullPointerException npe) { } } - + @Test public void testIdentityToStringAppendable() { final Integer i = Integer.valueOf(121); @@ -253,7 +253,7 @@ public class ObjectUtilsTest { } catch(final IOException ex) { fail("IOException unexpected"); } - + try { ObjectUtils.identityToString((Appendable)null, "tmp"); fail("NullPointerException expected"); @@ -298,12 +298,12 @@ public class ObjectUtilsTest { final Date nonNullComparable1 = calendar.getTime(); final Date nonNullComparable2 = calendar.getTime(); final String[] nullArray = null; - + calendar.set( Calendar.YEAR, calendar.get( Calendar.YEAR ) -1 ); final Date minComparable = calendar.getTime(); - + assertNotSame( nonNullComparable1, nonNullComparable2 ); - + assertNull(ObjectUtils.max( (String) null ) ); assertNull(ObjectUtils.max( nullArray ) ); assertSame( nonNullComparable1, ObjectUtils.max( null, nonNullComparable1 ) ); @@ -324,12 +324,12 @@ public class ObjectUtilsTest { final Date nonNullComparable1 = calendar.getTime(); final Date nonNullComparable2 = calendar.getTime(); final String[] nullArray = null; - + calendar.set( Calendar.YEAR, calendar.get( Calendar.YEAR ) -1 ); final Date minComparable = calendar.getTime(); - + assertNotSame( nonNullComparable1, nonNullComparable2 ); - + assertNull(ObjectUtils.min( (String) null ) ); assertNull(ObjectUtils.min( nullArray ) ); assertSame( nonNullComparable1, ObjectUtils.min( null, nonNullComparable1 ) ); @@ -358,7 +358,7 @@ public class ObjectUtilsTest { assertEquals("Null one false", -1, ObjectUtils.compare(nullValue, one)); assertEquals("Null one true", 1, ObjectUtils.compare(nullValue, one, true)); - + assertEquals("one Null false", 1, ObjectUtils.compare(one, nullValue)); assertEquals("one Null true", -1, ObjectUtils.compare(one, nullValue, true));
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/RandomStringUtilsTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/lang3/RandomStringUtilsTest.java b/src/test/java/org/apache/commons/lang3/RandomStringUtilsTest.java index 68d10d2..d3ed631 100644 --- a/src/test/java/org/apache/commons/lang3/RandomStringUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/RandomStringUtilsTest.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -50,7 +50,7 @@ public class RandomStringUtilsTest { assertTrue(Modifier.isPublic(RandomStringUtils.class.getModifiers())); assertFalse(Modifier.isFinal(RandomStringUtils.class.getModifiers())); } - + //----------------------------------------------------------------------- /** * Test the implementation @@ -62,12 +62,12 @@ public class RandomStringUtilsTest { String r2 = RandomStringUtils.random(50); assertEquals("random(50) length", 50, r2.length()); assertTrue("!r1.equals(r2)", !r1.equals(r2)); - + r1 = RandomStringUtils.randomAscii(50); assertEquals("randomAscii(50) length", 50, r1.length()); for(int i = 0; i < r1.length(); i++) { assertTrue("char between 32 and 127", r1.charAt(i) >= 32 && r1.charAt(i) <= 127); - } + } r2 = RandomStringUtils.randomAscii(50); assertTrue("!r1.equals(r2)", !r1.equals(r2)); @@ -78,7 +78,7 @@ public class RandomStringUtilsTest { } r2 = RandomStringUtils.randomAlphabetic(50); assertTrue("!r1.equals(r2)", !r1.equals(r2)); - + r1 = RandomStringUtils.randomAlphanumeric(50); assertEquals("randomAlphanumeric(50)", 50, r1.length()); for(int i = 0; i < r1.length(); i++) { @@ -86,7 +86,7 @@ public class RandomStringUtilsTest { } r2 = RandomStringUtils.randomAlphabetic(50); assertTrue("!r1.equals(r2)", !r1.equals(r2)); - + r1 = RandomStringUtils.randomGraph(50); assertEquals("randomGraph(50) length", 50, r1.length()); for(int i = 0; i < r1.length(); i++) { @@ -94,7 +94,7 @@ public class RandomStringUtilsTest { } r2 = RandomStringUtils.randomGraph(50); assertTrue("!r1.equals(r2)", !r1.equals(r2)); - + r1 = RandomStringUtils.randomNumeric(50); assertEquals("randomNumeric(50)", 50, r1.length()); for(int i = 0; i < r1.length(); i++) { @@ -102,7 +102,7 @@ public class RandomStringUtilsTest { } r2 = RandomStringUtils.randomNumeric(50); assertTrue("!r1.equals(r2)", !r1.equals(r2)); - + r1 = RandomStringUtils.randomPrint(50); assertEquals("randomPrint(50) length", 50, r1.length()); for(int i = 0; i < r1.length(); i++) { @@ -110,7 +110,7 @@ public class RandomStringUtilsTest { } r2 = RandomStringUtils.randomPrint(50); assertTrue("!r1.equals(r2)", !r1.equals(r2)); - + String set = "abcdefg"; r1 = RandomStringUtils.random(50, set); assertEquals("random(50, \"abcdefg\")", 50, r1.length()); @@ -119,13 +119,13 @@ public class RandomStringUtilsTest { } r2 = RandomStringUtils.random(50, set); assertTrue("!r1.equals(r2)", !r1.equals(r2)); - + r1 = RandomStringUtils.random(50, (String) null); assertEquals("random(50) length", 50, r1.length()); r2 = RandomStringUtils.random(50, (String) null); assertEquals("random(50) length", 50, r2.length()); assertTrue("!r1.equals(r2)", !r1.equals(r2)); - + set = "stuvwxyz"; r1 = RandomStringUtils.random(50, set.toCharArray()); assertEquals("random(50, \"stuvwxyz\")", 50, r1.length()); @@ -134,7 +134,7 @@ public class RandomStringUtilsTest { } r2 = RandomStringUtils.random(50, set); assertTrue("!r1.equals(r2)", !r1.equals(r2)); - + r1 = RandomStringUtils.random(50, (char[]) null); assertEquals("random(50) length", 50, r1.length()); r2 = RandomStringUtils.random(50, (char[]) null); @@ -216,11 +216,11 @@ public class RandomStringUtilsTest { fail(); } catch (final IllegalArgumentException ex) {} } - + /** * Make sure boundary alphanumeric characters are generated by randomAlphaNumeric * This test will fail randomly with probability = 6 * (61/62)**1000 ~ 5.2E-7 - */ + */ @Test public void testRandomAlphaNumeric() { final char[] testChars = {'a', 'z', 'A', 'Z', '0', '9'}; @@ -235,16 +235,16 @@ public class RandomStringUtilsTest { } for (int i = 0; i < testChars.length; i++) { if (!found[i]) { - fail("alphanumeric character not generated in 1000 attempts: " + fail("alphanumeric character not generated in 1000 attempts: " + testChars[i] +" -- repeated failures indicate a problem "); } } } - + /** * Make sure '0' and '9' are generated by randomNumeric * This test will fail randomly with probability = 2 * (9/10)**1000 ~ 3.5E-46 - */ + */ @Test public void testRandomNumeric() { final char[] testChars = {'0','9'}; @@ -259,16 +259,16 @@ public class RandomStringUtilsTest { } for (int i = 0; i < testChars.length; i++) { if (!found[i]) { - fail("digit not generated in 1000 attempts: " + fail("digit not generated in 1000 attempts: " + testChars[i] +" -- repeated failures indicate a problem "); } - } + } } - + /** * Make sure boundary alpha characters are generated by randomAlphabetic * This test will fail randomly with probability = 4 * (51/52)**1000 ~ 1.58E-8 - */ + */ @Test public void testRandomAlphabetic() { final char[] testChars = {'a', 'z', 'A', 'Z'}; @@ -283,16 +283,16 @@ public class RandomStringUtilsTest { } for (int i = 0; i < testChars.length; i++) { if (!found[i]) { - fail("alphanumeric character not generated in 1000 attempts: " + fail("alphanumeric character not generated in 1000 attempts: " + testChars[i] +" -- repeated failures indicate a problem "); } } } - + /** * Make sure 32 and 127 are generated by randomNumeric * This test will fail randomly with probability = 2*(95/96)**1000 ~ 5.7E-5 - */ + */ @Test public void testRandomAscii() { final char[] testChars = {(char) 32, (char) 126}; @@ -307,11 +307,11 @@ public class RandomStringUtilsTest { } for (int i = 0; i < testChars.length; i++) { if (!found[i]) { - fail("ascii character not generated in 1000 attempts: " - + (int) testChars[i] + + fail("ascii character not generated in 1000 attempts: " + + (int) testChars[i] + " -- repeated failures indicate a problem"); } - } + } } @Test @@ -463,8 +463,8 @@ public class RandomStringUtilsTest { assertThat("min generated, may fail randomly rarely", minCreatedLength, is(expectedMinLengthInclusive)); assertThat("max generated, may fail randomly rarely", maxCreatedLength, is(expectedMaxLengthExclusive - 1)); } - - /** + + /** * Test homogeneity of random strings generated -- * i.e., test that characters show up with expected frequencies * in generated strings. Will fail randomly about 1 in 1000 times. @@ -487,12 +487,12 @@ public class RandomStringUtilsTest { default: {fail("generated character not in set");} } } - } + } // Perform chi-square test with df = 3-1 = 2, testing at .001 level assertTrue("test homogeneity -- will fail about 1 in 1000 times", - chiSquare(expected,counts) < 13.82); + chiSquare(expected,counts) < 13.82); } - + /** * Computes Chi-Square statistic given observed and expected counts * @param observed array of observed frequency counts @@ -506,7 +506,7 @@ public class RandomStringUtilsTest { sumSq += dev * dev / expected[i]; } return sumSq; - } + } /** * Checks if the string got by {@link RandomStringUtils#random(int)} @@ -534,20 +534,20 @@ public class RandomStringUtilsTest { // just to be complete assertEquals(orig, copy); } - - + + /** * Test for LANG-1286. Creates situation where old code would * overflow a char and result in a code point outside the specified * range. - * + * * @throws Exception */ @Test public void testCharOverflow() throws Exception { int start = Character.MAX_VALUE; int end = Integer.MAX_VALUE; - + @SuppressWarnings("serial") Random fixedRandom = new Random() { @Override @@ -556,7 +556,7 @@ public class RandomStringUtilsTest { return super.nextInt(n - 1) + 1; } }; - + String result = RandomStringUtils.random(2, start, end, false, false, null, fixedRandom); int c = result.codePointAt(0); assertTrue(String.format("Character '%d' not in range [%d,%d).", c, start, end), c >= start && c < end); http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/RandomUtilsTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/lang3/RandomUtilsTest.java b/src/test/java/org/apache/commons/lang3/RandomUtilsTest.java index ddbaab1..3f9604f 100644 --- a/src/test/java/org/apache/commons/lang3/RandomUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/RandomUtilsTest.java @@ -125,7 +125,7 @@ public class RandomUtilsTest { public void testNextIntMinimalRange() { assertEquals(42, RandomUtils.nextInt(42, 42)); } - + /** * Tests next int range. */ @@ -144,23 +144,23 @@ public class RandomUtilsTest { assertTrue(randomResult > 0); assertTrue(randomResult < Integer.MAX_VALUE); } - + /** * Test next double range with minimal range. */ @Test public void testNextDoubleMinimalRange() { assertEquals(42.1, RandomUtils.nextDouble(42.1, 42.1), DELTA); - } - + } + /** * Test next float range with minimal range. */ @Test public void testNextFloatMinimalRange() { assertEquals(42.1f, RandomUtils.nextFloat(42.1f, 42.1f), DELTA); - } - + } + /** * Tests next double range. */ @@ -179,7 +179,7 @@ public class RandomUtilsTest { assertTrue(randomResult > 0); assertTrue(randomResult < Double.MAX_VALUE); } - + /** * Tests next float range. */ @@ -206,7 +206,7 @@ public class RandomUtilsTest { public void testNextLongMinimalRange() { assertEquals(42L, RandomUtils.nextLong(42L, 42L)); } - + /** * Tests next long range. */ @@ -225,7 +225,7 @@ public class RandomUtilsTest { assertTrue(randomResult > 0); assertTrue(randomResult < Long.MAX_VALUE); } - + /** * Tests extreme range. */ @@ -234,7 +234,7 @@ public class RandomUtilsTest { final int result = RandomUtils.nextInt(0, Integer.MAX_VALUE); assertTrue(result >= 0 && result < Integer.MAX_VALUE); } - + /** * Tests extreme range. */ @@ -242,8 +242,8 @@ public class RandomUtilsTest { public void testExtremeRangeLong() { final long result = RandomUtils.nextLong(0, Long.MAX_VALUE); assertTrue(result >= 0 && result < Long.MAX_VALUE); - } - + } + /** * Tests extreme range. */ @@ -251,8 +251,8 @@ public class RandomUtilsTest { public void testExtremeRangeFloat() { final float result = RandomUtils.nextFloat(0, Float.MAX_VALUE); assertTrue(result >= 0f && result <= Float.MAX_VALUE); - } - + } + /** * Tests extreme range. */ @@ -260,5 +260,5 @@ public class RandomUtilsTest { public void testExtremeRangeDouble() { final double result = RandomUtils.nextDouble(0, Double.MAX_VALUE); assertTrue(result >= 0 && result <= Double.MAX_VALUE); - } + } } http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/RangeTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/lang3/RangeTest.java b/src/test/java/org/apache/commons/lang3/RangeTest.java index 03ed509..a8d7e1b 100644 --- a/src/test/java/org/apache/commons/lang3/RangeTest.java +++ b/src/test/java/org/apache/commons/lang3/RangeTest.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java b/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java index caa648b..d9a5bde 100644 --- a/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -47,7 +47,7 @@ public class SerializationUtilsTest { static final String CLASS_NOT_FOUND_MESSAGE = "ClassNotFoundSerialization.readObject fake exception"; protected static final String SERIALIZE_IO_EXCEPTION_MESSAGE = "Anonymous OutputStream I/O exception"; - + private String iString; private Integer iInteger; private HashMap<Object, Object> iMap; @@ -72,29 +72,29 @@ public class SerializationUtilsTest { assertTrue(Modifier.isPublic(SerializationUtils.class.getModifiers())); assertFalse(Modifier.isFinal(SerializationUtils.class.getModifiers())); } - + @Test public void testException() { SerializationException serEx; final Exception ex = new Exception(); - + serEx = new SerializationException(); assertSame(null, serEx.getMessage()); assertSame(null, serEx.getCause()); - + serEx = new SerializationException("Message"); assertSame("Message", serEx.getMessage()); assertSame(null, serEx.getCause()); - + serEx = new SerializationException(ex); assertEquals("java.lang.Exception", serEx.getMessage()); assertSame(ex, serEx.getCause()); - + serEx = new SerializationException("Message", ex); assertSame("Message", serEx.getMessage()); assertSame(ex, serEx.getCause()); } - + //----------------------------------------------------------------------- @Test @@ -166,7 +166,7 @@ public class SerializationUtilsTest { } fail(); } - + @Test public void testSerializeIOException() throws Exception { // forces an IOException when the ObjectOutputStream is created, to test not closing the stream @@ -268,13 +268,13 @@ public class SerializationUtilsTest { assertEquals("java.lang.ClassNotFoundException: " + CLASS_NOT_FOUND_MESSAGE, se.getMessage()); } } - - @Test + + @Test public void testRoundtrip() { final HashMap<Object, Object> newMap = SerializationUtils.roundtrip(iMap); assertEquals(iMap, newMap); } - + //----------------------------------------------------------------------- @Test @@ -408,7 +408,7 @@ public class SerializationUtilsTest { } fail(); } - + @Test public void testPrimitiveTypeClassSerialization() { final Class<?>[] primitiveTypes = { byte.class, short.class, int.class, long.class, float.class, double.class, http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java b/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java index df188a6..47e4fce 100644 --- a/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -51,7 +51,7 @@ public class StringEscapeUtilsTest { assertTrue(Modifier.isPublic(StringEscapeUtils.class.getModifiers())); assertFalse(Modifier.isFinal(StringEscapeUtils.class.getModifiers())); } - + @Test public void testEscapeJava() throws IOException { assertEquals(null, StringEscapeUtils.escapeJava(null)); @@ -69,7 +69,7 @@ public class StringEscapeUtilsTest { fail(); } catch (final IllegalArgumentException ex) { } - + assertEscapeJava("empty string", "", ""); assertEscapeJava(FOO, FOO); assertEscapeJava("tab", "\\t", "\t"); @@ -106,7 +106,7 @@ public class StringEscapeUtilsTest { */ assertEquals(expected, actual); } - + private void assertEscapeJava(final String escaped, final String original) throws IOException { assertEscapeJava(null, escaped, original); } @@ -143,7 +143,7 @@ public class StringEscapeUtilsTest { fail(); } catch (final RuntimeException ex) { } - + assertUnescapeJava("", ""); assertUnescapeJava("test", "test"); assertUnescapeJava("\ntest\b", "\\ntest\\b"); @@ -194,9 +194,9 @@ public class StringEscapeUtilsTest { fail(); } catch (final IllegalArgumentException ex) { } - + assertEquals("He didn\\'t say, \\\"stop!\\\"", StringEscapeUtils.escapeEcmaScript("He didn't say, \"stop!\"")); - assertEquals("document.getElementById(\\\"test\\\").value = \\'<script>alert(\\'aaa\\');<\\/script>\\';", + assertEquals("document.getElementById(\\\"test\\\").value = \\'<script>alert(\\'aaa\\');<\\/script>\\';", StringEscapeUtils.escapeEcmaScript("document.getElementById(\"test\").value = '<script>alert('aaa');</script>';")); } @@ -265,7 +265,7 @@ public class StringEscapeUtilsTest { final String expected = element[2]; final String original = element[1]; assertEquals(message, expected, StringEscapeUtils.unescapeHtml4(original)); - + final StringWriter sw = new StringWriter(); try { StringEscapeUtils.UNESCAPE_HTML4.translate(original, sw); @@ -276,9 +276,9 @@ public class StringEscapeUtilsTest { } // \u00E7 is a cedilla (c with wiggle under) // note that the test string must be 7-bit-clean (Unicode escaped) or else it will compile incorrectly - // on some locales + // on some locales assertEquals("funny chars pass through OK", "Fran\u00E7ais", StringEscapeUtils.unescapeHtml4("Fran\u00E7ais")); - + assertEquals("Hello&;World", StringEscapeUtils.unescapeHtml4("Hello&;World")); assertEquals("Hello&#;World", StringEscapeUtils.unescapeHtml4("Hello&#;World")); assertEquals("Hello&# ;World", StringEscapeUtils.unescapeHtml4("Hello&# ;World")); @@ -287,7 +287,7 @@ public class StringEscapeUtilsTest { @Test public void testUnescapeHexCharsHtml() { - // Simple easy to grok test + // Simple easy to grok test assertEquals("hex number unescape", "\u0080\u009F", StringEscapeUtils.unescapeHtml4("€Ÿ")); assertEquals("hex number unescape", "\u0080\u009F", StringEscapeUtils.unescapeHtml4("€Ÿ")); // Test all Character values: @@ -350,7 +350,7 @@ public class StringEscapeUtilsTest { } assertEquals("XML was unescaped incorrectly", "<abc>", sw.toString() ); } - + @Test public void testEscapeXml10() throws Exception { assertEquals("a<b>c"d'e&f", StringEscapeUtils.escapeXml10("a<b>c\"d'e&f")); @@ -365,7 +365,7 @@ public class StringEscapeUtilsTest { assertEquals("XML 1.0 should escape #x7f-#x84 | #x86 - #x9f, for XML 1.1 compatibility", "a\u007e„\u0085†Ÿ\u00a0b", StringEscapeUtils.escapeXml10("a\u007e\u007f\u0084\u0085\u0086\u009f\u00a0b")); } - + @Test public void testEscapeXml11() throws Exception { assertEquals("a<b>c"d'e&f", StringEscapeUtils.escapeXml11("a<b>c\"d'e&f")); @@ -384,7 +384,7 @@ public class StringEscapeUtilsTest { } /** - * Tests Supplementary characters. + * Tests Supplementary characters. * <p> * From http://www.w3.org/International/questions/qa-escapes * </p> @@ -400,7 +400,7 @@ public class StringEscapeUtilsTest { */ @Test public void testEscapeXmlSupplementaryCharacters() { - final CharSequenceTranslator escapeXml = + final CharSequenceTranslator escapeXml = StringEscapeUtils.ESCAPE_XML.with( NumericEntityEscaper.between(0x7f, Integer.MAX_VALUE) ); assertEquals("Supplementary character must be represented using a single escape", "𣎴", @@ -409,7 +409,7 @@ public class StringEscapeUtilsTest { assertEquals("Supplementary characters mixed with basic characters should be encoded correctly", "a b c 𣎴", escapeXml.translate("a b c \uD84C\uDFB4")); } - + @Test public void testEscapeXmlAllCharacters() { // http://www.w3.org/TR/xml/#charsets says: @@ -427,7 +427,7 @@ public class StringEscapeUtilsTest { assertEquals("Hello World! Ain't this great?", escapeXml.translate("Hello World! Ain't this great?")); assertEquals("", escapeXml.translate("\u000E\u000F\u0018\u0019")); } - + /** * Reverse of the above. * @@ -441,7 +441,7 @@ public class StringEscapeUtilsTest { assertEquals("Supplementary characters mixed with basic characters should be decoded correctly", "a b c \uD84C\uDFB4", StringEscapeUtils.unescapeXml("a b c 𣎴") ); } - + // Tests issue #38569 // http://issues.apache.org/bugzilla/show_bug.cgi?id=38569 @Test @@ -583,7 +583,7 @@ public class StringEscapeUtilsTest { /** * Tests https://issues.apache.org/jira/browse/LANG-708 - * + * * @throws IOException * if an I/O error occurs */ http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/StringUtilsContainsTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsContainsTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsContainsTest.java index 6fedb92..5cc635f 100644 --- a/src/test/java/org/apache/commons/lang3/StringUtilsContainsTest.java +++ b/src/test/java/org/apache/commons/lang3/StringUtilsContainsTest.java @@ -211,7 +211,7 @@ public class StringUtilsContainsTest { assertFalse(StringUtils.containsAny(CharU20000, CharU20001)); assertFalse(StringUtils.containsAny(CharU20001, CharU20000)); } - + @Test public void testContainsAny_StringStringArray() { assertFalse(StringUtils.containsAny(null, (String[]) null)); http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/StringUtilsEmptyBlankTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsEmptyBlankTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsEmptyBlankTest.java index 8e88f6e..8e872c3 100644 --- a/src/test/java/org/apache/commons/lang3/StringUtilsEmptyBlankTest.java +++ b/src/test/java/org/apache/commons/lang3/StringUtilsEmptyBlankTest.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java index 91c0451..22cf9aa 100644 --- a/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java +++ b/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java @@ -294,7 +294,7 @@ public class StringUtilsEqualsIndexOfTest { assertEquals(2, StringUtils.indexOf("aabaabaa", 'b', -1)); assertEquals(5, StringUtils.indexOf(new StringBuilder("aabaabaa"), 'b', 3)); - + //LANG-1300 tests go here final int CODE_POINT = 0x2070E; StringBuilder builder = new StringBuilder(); @@ -545,7 +545,7 @@ public class StringUtilsEqualsIndexOfTest { assertEquals(0, StringUtils.lastIndexOf("aabaabaa", 'a', 0)); assertEquals(2, StringUtils.lastIndexOf(new StringBuilder("aabaabaa"), 'b', 2)); - + //LANG-1300 addition test final int CODE_POINT = 0x2070E; StringBuilder builder = new StringBuilder(); @@ -784,7 +784,7 @@ public class StringUtilsEqualsIndexOfTest { @Test public void testLANG1193() { - assertEquals(0, StringUtils.ordinalIndexOf("abc", "ab", 1)); + assertEquals(0, StringUtils.ordinalIndexOf("abc", "ab", 1)); } @Test http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/StringUtilsIsTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsIsTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsIsTest.java index 6932afb..4160f1a 100644 --- a/src/test/java/org/apache/commons/lang3/StringUtilsIsTest.java +++ b/src/test/java/org/apache/commons/lang3/StringUtilsIsTest.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -127,7 +127,7 @@ public class StringUtilsIsTest { assertTrue(StringUtils.isAsciiPrintable("=?iso-8859-1?Q?G=FClc=FC?=")); assertFalse(StringUtils.isAsciiPrintable("G\u00fclc\u00fc")); } - + @Test public void testIsNumeric() { assertFalse(StringUtils.isNumeric(null)); http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/StringUtilsStartsEndsWithTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsStartsEndsWithTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsStartsEndsWithTest.java index ec72c0d..2eb5ddb 100644 --- a/src/test/java/org/apache/commons/lang3/StringUtilsStartsEndsWithTest.java +++ b/src/test/java/org/apache/commons/lang3/StringUtilsStartsEndsWithTest.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -99,7 +99,7 @@ public class StringUtilsStartsEndsWithTest { assertTrue("StringUtils.startsWithAny(abcxyz, StringBuilder(xyz), StringBuffer(abc))", StringUtils.startsWithAny("abcxyz", new StringBuilder("xyz"), new StringBuffer("abc"))); assertTrue("StringUtils.startsWithAny(StringBuffer(abcxyz), StringBuilder(xyz), StringBuffer(abc))", StringUtils.startsWithAny(new StringBuffer("abcxyz"), new StringBuilder("xyz"), new StringBuffer("abc"))); } - + /** * Test StringUtils.endsWith() @@ -183,7 +183,7 @@ public class StringUtilsStartsEndsWithTest { /* * Type null of the last argument to method endsWithAny(CharSequence, CharSequence...) - * doesn't exactly match the vararg parameter type. + * doesn't exactly match the vararg parameter type. * Cast to CharSequence[] to confirm the non-varargs invocation, * or pass individual arguments of type CharSequence for a varargs invocation. * http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/StringUtilsSubstringTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsSubstringTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsSubstringTest.java index f6986ee..66d03f3 100644 --- a/src/test/java/org/apache/commons/lang3/StringUtilsSubstringTest.java +++ b/src/test/java/org/apache/commons/lang3/StringUtilsSubstringTest.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -39,7 +39,7 @@ public class StringUtilsSubstringTest { assertEquals(null, StringUtils.substring(null, 0)); assertEquals("", StringUtils.substring("", 0)); assertEquals("", StringUtils.substring("", 2)); - + assertEquals("", StringUtils.substring(SENTENCE, 80)); assertEquals(BAZ, StringUtils.substring(SENTENCE, 8)); assertEquals(BAZ, StringUtils.substring(SENTENCE, -3)); @@ -54,7 +54,7 @@ public class StringUtilsSubstringTest { assertEquals("", StringUtils.substring("abc", 3)); assertEquals("", StringUtils.substring("abc", 4)); } - + @Test public void testSubstring_StringIntInt() { assertEquals(null, StringUtils.substring(null, 0, 0)); @@ -62,7 +62,7 @@ public class StringUtilsSubstringTest { assertEquals("", StringUtils.substring("", 0, 0)); assertEquals("", StringUtils.substring("", 1, 2)); assertEquals("", StringUtils.substring("", -2, -1)); - + assertEquals("", StringUtils.substring(SENTENCE, 8, 6)); assertEquals(FOO, StringUtils.substring(SENTENCE, 0, 3)); assertEquals("o", StringUtils.substring(SENTENCE, -9, 3)); @@ -72,50 +72,50 @@ public class StringUtilsSubstringTest { assertEquals("", StringUtils.substring(SENTENCE, 2, 2)); assertEquals("b",StringUtils.substring("abc", -2, -1)); } - + @Test public void testLeft_String() { assertSame(null, StringUtils.left(null, -1)); assertSame(null, StringUtils.left(null, 0)); assertSame(null, StringUtils.left(null, 2)); - + assertEquals("", StringUtils.left("", -1)); assertEquals("", StringUtils.left("", 0)); assertEquals("", StringUtils.left("", 2)); - + assertEquals("", StringUtils.left(FOOBAR, -1)); assertEquals("", StringUtils.left(FOOBAR, 0)); assertEquals(FOO, StringUtils.left(FOOBAR, 3)); assertSame(FOOBAR, StringUtils.left(FOOBAR, 80)); } - + @Test public void testRight_String() { assertSame(null, StringUtils.right(null, -1)); assertSame(null, StringUtils.right(null, 0)); assertSame(null, StringUtils.right(null, 2)); - + assertEquals("", StringUtils.right("", -1)); assertEquals("", StringUtils.right("", 0)); assertEquals("", StringUtils.right("", 2)); - + assertEquals("", StringUtils.right(FOOBAR, -1)); assertEquals("", StringUtils.right(FOOBAR, 0)); assertEquals(BAR, StringUtils.right(FOOBAR, 3)); assertSame(FOOBAR, StringUtils.right(FOOBAR, 80)); } - + @Test public void testMid_String() { assertSame(null, StringUtils.mid(null, -1, 0)); assertSame(null, StringUtils.mid(null, 0, -1)); assertSame(null, StringUtils.mid(null, 3, 0)); assertSame(null, StringUtils.mid(null, 3, 2)); - + assertEquals("", StringUtils.mid("", 0, -1)); assertEquals("", StringUtils.mid("", 0, 0)); assertEquals("", StringUtils.mid("", 0, 2)); - + assertEquals("", StringUtils.mid(FOOBAR, 3, -1)); assertEquals("", StringUtils.mid(FOOBAR, 3, 0)); assertEquals("b", StringUtils.mid(FOOBAR, 3, 1)); @@ -126,7 +126,7 @@ public class StringUtilsSubstringTest { assertEquals("", StringUtils.mid(FOOBAR, 9, 3)); assertEquals(FOO, StringUtils.mid(FOOBAR, -1, 3)); } - + //----------------------------------------------------------------------- @Test public void testSubstringBefore_StringString() { @@ -138,7 +138,7 @@ public class StringUtilsSubstringTest { assertEquals("", StringUtils.substringBefore("", null)); assertEquals("", StringUtils.substringBefore("", "")); assertEquals("", StringUtils.substringBefore("", "XX")); - + assertEquals("foo", StringUtils.substringBefore("foo", null)); assertEquals("foo", StringUtils.substringBefore("foo", "b")); assertEquals("f", StringUtils.substringBefore("foot", "o")); @@ -147,18 +147,18 @@ public class StringUtilsSubstringTest { assertEquals("ab", StringUtils.substringBefore("abc", "c")); assertEquals("", StringUtils.substringBefore("abc", "")); } - + @Test public void testSubstringAfter_StringString() { assertEquals("barXXbaz", StringUtils.substringAfter("fooXXbarXXbaz", "XX")); - + assertEquals(null, StringUtils.substringAfter(null, null)); assertEquals(null, StringUtils.substringAfter(null, "")); assertEquals(null, StringUtils.substringAfter(null, "XX")); assertEquals("", StringUtils.substringAfter("", null)); assertEquals("", StringUtils.substringAfter("", "")); assertEquals("", StringUtils.substringAfter("", "XX")); - + assertEquals("", StringUtils.substringAfter("foo", null)); assertEquals("ot", StringUtils.substringAfter("foot", "o")); assertEquals("bc", StringUtils.substringAfter("abc", "a")); @@ -191,7 +191,7 @@ public class StringUtilsSubstringTest { assertEquals("a", StringUtils.substringBeforeLast("a", "")); assertEquals("", StringUtils.substringBeforeLast("a", "a")); } - + @Test public void testSubstringAfterLast_StringString() { assertEquals("baz", StringUtils.substringAfterLast("fooXXbarXXbaz", "XX")); @@ -211,8 +211,8 @@ public class StringUtilsSubstringTest { assertEquals("", StringUtils.substringAfterLast("abc", "c")); assertEquals("", StringUtils.substringAfterLast("", "d")); assertEquals("", StringUtils.substringAfterLast("abc", "")); - } - + } + //----------------------------------------------------------------------- @Test public void testSubstringBetween_StringString() { @@ -227,7 +227,7 @@ public class StringUtilsSubstringTest { assertEquals("bc", StringUtils.substringBetween("abcabca", "a")); assertEquals("bar", StringUtils.substringBetween("\nbar\n", "\n")); } - + @Test public void testSubstringBetween_StringStringString() { assertEquals(null, StringUtils.substringBetween(null, "", "")); @@ -312,11 +312,11 @@ public class StringUtilsSubstringTest { assertEquals(0, StringUtils.countMatches("x", "")); assertEquals(0, StringUtils.countMatches("", "")); - assertEquals(3, + assertEquals(3, StringUtils.countMatches("one long someone sentence of one", "one")); - assertEquals(0, + assertEquals(0, StringUtils.countMatches("one long someone sentence of one", "two")); - assertEquals(4, + assertEquals(4, StringUtils.countMatches("oooooooooooo", "ooo")); } http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/StringUtilsTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsTest.java index 2b49669..5cda0af 100644 --- a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/StringUtilsTest.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -3204,7 +3204,7 @@ public class StringUtilsTest { assertNull(StringUtils.unwrap(null, null)); assertNull(StringUtils.unwrap(null, '\0')); assertNull(StringUtils.unwrap(null, '1')); - + assertEquals("abc", StringUtils.unwrap("abc", null)); assertEquals("abc", StringUtils.unwrap("\'abc\'", '\'')); assertEquals("abc", StringUtils.unwrap("AabcA", 'A')); @@ -3214,18 +3214,18 @@ public class StringUtilsTest { assertEquals("A#", StringUtils.unwrap("A#", '#')); assertEquals("ABA", StringUtils.unwrap("AABAA", 'A')); } - + @Test public void testToCodePoints() throws Exception { final int orphanedHighSurrogate = 0xD801; final int orphanedLowSurrogate = 0xDC00; final int supplementary = 0x2070E; - - final int[] codePoints = {'a', orphanedHighSurrogate, 'b','c', supplementary, + + final int[] codePoints = {'a', orphanedHighSurrogate, 'b','c', supplementary, 'd', orphanedLowSurrogate, 'e'}; final String s = new String(codePoints, 0, codePoints.length); assertArrayEquals(codePoints, StringUtils.toCodePoints(s)); - + assertNull(StringUtils.toCodePoints(null)); assertArrayEquals(ArrayUtils.EMPTY_INT_ARRAY, StringUtils.toCodePoints("")); } http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/StringUtilsTrimStripTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsTrimStripTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsTrimStripTest.java index 1a558f5..d9fdb74 100644 --- a/src/test/java/org/apache/commons/lang3/StringUtilsTrimStripTest.java +++ b/src/test/java/org/apache/commons/lang3/StringUtilsTrimStripTest.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -74,10 +74,10 @@ public class StringUtilsTrimStripTest { assertEquals("", StringUtils.strip("")); assertEquals("", StringUtils.strip(" ")); assertEquals("abc", StringUtils.strip(" abc ")); - assertEquals(StringUtilsTest.NON_WHITESPACE, + assertEquals(StringUtilsTest.NON_WHITESPACE, StringUtils.strip(StringUtilsTest.WHITESPACE + StringUtilsTest.NON_WHITESPACE + StringUtilsTest.WHITESPACE)); } - + @Test public void testStripToNull_String() { assertEquals(null, StringUtils.stripToNull(null)); @@ -85,10 +85,10 @@ public class StringUtilsTrimStripTest { assertEquals(null, StringUtils.stripToNull(" ")); assertEquals(null, StringUtils.stripToNull(StringUtilsTest.WHITESPACE)); assertEquals("ab c", StringUtils.stripToNull(" ab c ")); - assertEquals(StringUtilsTest.NON_WHITESPACE, + assertEquals(StringUtilsTest.NON_WHITESPACE, StringUtils.stripToNull(StringUtilsTest.WHITESPACE + StringUtilsTest.NON_WHITESPACE + StringUtilsTest.WHITESPACE)); } - + @Test public void testStripToEmpty_String() { assertEquals("", StringUtils.stripToEmpty(null)); @@ -96,10 +96,10 @@ public class StringUtilsTrimStripTest { assertEquals("", StringUtils.stripToEmpty(" ")); assertEquals("", StringUtils.stripToEmpty(StringUtilsTest.WHITESPACE)); assertEquals("ab c", StringUtils.stripToEmpty(" ab c ")); - assertEquals(StringUtilsTest.NON_WHITESPACE, + assertEquals(StringUtilsTest.NON_WHITESPACE, StringUtils.stripToEmpty(StringUtilsTest.WHITESPACE + StringUtilsTest.NON_WHITESPACE + StringUtilsTest.WHITESPACE)); } - + @Test public void testStrip_StringString() { // null strip @@ -107,7 +107,7 @@ public class StringUtilsTrimStripTest { assertEquals("", StringUtils.strip("", null)); assertEquals("", StringUtils.strip(" ", null)); assertEquals("abc", StringUtils.strip(" abc ", null)); - assertEquals(StringUtilsTest.NON_WHITESPACE, + assertEquals(StringUtilsTest.NON_WHITESPACE, StringUtils.strip(StringUtilsTest.WHITESPACE + StringUtilsTest.NON_WHITESPACE + StringUtilsTest.WHITESPACE, null)); // "" strip @@ -116,13 +116,13 @@ public class StringUtilsTrimStripTest { assertEquals(" ", StringUtils.strip(" ", "")); assertEquals(" abc ", StringUtils.strip(" abc ", "")); assertEquals(StringUtilsTest.WHITESPACE, StringUtils.strip(StringUtilsTest.WHITESPACE, "")); - + // " " strip assertEquals(null, StringUtils.strip(null, " ")); assertEquals("", StringUtils.strip("", " ")); assertEquals("", StringUtils.strip(" ", " ")); assertEquals("abc", StringUtils.strip(" abc ", " ")); - + // "ab" strip assertEquals(null, StringUtils.strip(null, "ab")); assertEquals("", StringUtils.strip("", "ab")); @@ -131,7 +131,7 @@ public class StringUtilsTrimStripTest { assertEquals("c", StringUtils.strip("abcabab", "ab")); assertEquals(StringUtilsTest.WHITESPACE, StringUtils.strip(StringUtilsTest.WHITESPACE, "")); } - + @Test public void testStripStart_StringString() { // null stripStart @@ -139,7 +139,7 @@ public class StringUtilsTrimStripTest { assertEquals("", StringUtils.stripStart("", null)); assertEquals("", StringUtils.stripStart(" ", null)); assertEquals("abc ", StringUtils.stripStart(" abc ", null)); - assertEquals(StringUtilsTest.NON_WHITESPACE + StringUtilsTest.WHITESPACE, + assertEquals(StringUtilsTest.NON_WHITESPACE + StringUtilsTest.WHITESPACE, StringUtils.stripStart(StringUtilsTest.WHITESPACE + StringUtilsTest.NON_WHITESPACE + StringUtilsTest.WHITESPACE, null)); // "" stripStart @@ -148,13 +148,13 @@ public class StringUtilsTrimStripTest { assertEquals(" ", StringUtils.stripStart(" ", "")); assertEquals(" abc ", StringUtils.stripStart(" abc ", "")); assertEquals(StringUtilsTest.WHITESPACE, StringUtils.stripStart(StringUtilsTest.WHITESPACE, "")); - + // " " stripStart assertEquals(null, StringUtils.stripStart(null, " ")); assertEquals("", StringUtils.stripStart("", " ")); assertEquals("", StringUtils.stripStart(" ", " ")); assertEquals("abc ", StringUtils.stripStart(" abc ", " ")); - + // "ab" stripStart assertEquals(null, StringUtils.stripStart(null, "ab")); assertEquals("", StringUtils.stripStart("", "ab")); @@ -163,7 +163,7 @@ public class StringUtilsTrimStripTest { assertEquals("cabab", StringUtils.stripStart("abcabab", "ab")); assertEquals(StringUtilsTest.WHITESPACE, StringUtils.stripStart(StringUtilsTest.WHITESPACE, "")); } - + @Test public void testStripEnd_StringString() { // null stripEnd @@ -171,7 +171,7 @@ public class StringUtilsTrimStripTest { assertEquals("", StringUtils.stripEnd("", null)); assertEquals("", StringUtils.stripEnd(" ", null)); assertEquals(" abc", StringUtils.stripEnd(" abc ", null)); - assertEquals(StringUtilsTest.WHITESPACE + StringUtilsTest.NON_WHITESPACE, + assertEquals(StringUtilsTest.WHITESPACE + StringUtilsTest.NON_WHITESPACE, StringUtils.stripEnd(StringUtilsTest.WHITESPACE + StringUtilsTest.NON_WHITESPACE + StringUtilsTest.WHITESPACE, null)); // "" stripEnd @@ -180,13 +180,13 @@ public class StringUtilsTrimStripTest { assertEquals(" ", StringUtils.stripEnd(" ", "")); assertEquals(" abc ", StringUtils.stripEnd(" abc ", "")); assertEquals(StringUtilsTest.WHITESPACE, StringUtils.stripEnd(StringUtilsTest.WHITESPACE, "")); - + // " " stripEnd assertEquals(null, StringUtils.stripEnd(null, " ")); assertEquals("", StringUtils.stripEnd("", " ")); assertEquals("", StringUtils.stripEnd(" ", " ")); assertEquals(" abc", StringUtils.stripEnd(" abc ", " ")); - + // "ab" stripEnd assertEquals(null, StringUtils.stripEnd(null, "ab")); assertEquals("", StringUtils.stripEnd("", "ab")); @@ -211,7 +211,7 @@ public class StringUtilsTrimStripTest { assertArrayEquals(empty, StringUtils.stripAll(empty)); assertArrayEquals(foo, StringUtils.stripAll(fooSpace)); - + assertNull(StringUtils.stripAll(null, null)); assertArrayEquals(foo, StringUtils.stripAll(fooSpace, null)); assertArrayEquals(foo, StringUtils.stripAll(fooDots, ".")); @@ -222,11 +222,11 @@ public class StringUtilsTrimStripTest { final String cue = "\u00C7\u00FA\u00EA"; assertEquals( "Failed to strip accents from " + cue, "Cue", StringUtils.stripAccents(cue)); - final String lots = "\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5\u00C7\u00C8\u00C9" + - "\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF\u00D1\u00D2\u00D3" + + final String lots = "\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5\u00C7\u00C8\u00C9" + + "\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF\u00D1\u00D2\u00D3" + "\u00D4\u00D5\u00D6\u00D9\u00DA\u00DB\u00DC\u00DD"; - assertEquals( "Failed to strip accents from " + lots, - "AAAAAACEEEEIIIINOOOOOUUUUY", + assertEquals( "Failed to strip accents from " + lots, + "AAAAAACEEEEIIIINOOOOOUUUUY", StringUtils.stripAccents(lots)); assertNull( "Failed null safety", StringUtils.stripAccents(null) ); http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java b/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java index cc1d492..3d9d024 100644 --- a/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java @@ -43,7 +43,7 @@ import org.junit.Test; /** * Unit tests {@link org.apache.commons.lang3.SystemUtils}. - * + * * Only limited testing can be performed. */ public class SystemUtilsTest { http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/builder/CompareToBuilderTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/lang3/builder/CompareToBuilderTest.java b/src/test/java/org/apache/commons/lang3/builder/CompareToBuilderTest.java index 4ce0a1f..33deaa8 100644 --- a/src/test/java/org/apache/commons/lang3/builder/CompareToBuilderTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/CompareToBuilderTest.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -95,7 +95,7 @@ public class CompareToBuilderTest { this.t = t; } } - + @Test public void testReflectionCompare() { final TestObject o1 = new TestObject(4); @@ -124,16 +124,16 @@ public class CompareToBuilderTest { public void testReflectionHierarchyCompare() { testReflectionHierarchyCompare(false, null); } - + @Test public void testReflectionHierarchyCompareExcludeFields() { final String[] excludeFields = new String[] { "b" }; testReflectionHierarchyCompare(true, excludeFields); - + TestSubObject x; TestSubObject y; TestSubObject z; - + x = new TestSubObject(1, 1); y = new TestSubObject(2, 1); z = new TestSubObject(3, 1); @@ -144,7 +144,7 @@ public class CompareToBuilderTest { z = new TestSubObject(3, 1); assertXYZCompareOrder(x, y, z, true, excludeFields); } - + @Test public void testReflectionHierarchyCompareTransients() { testReflectionHierarchyCompare(true, null); @@ -157,27 +157,27 @@ public class CompareToBuilderTest { y = new TestTransientSubObject(2, 2); z = new TestTransientSubObject(3, 3); assertXYZCompareOrder(x, y, z, true, null); - + x = new TestTransientSubObject(1, 1); y = new TestTransientSubObject(1, 2); z = new TestTransientSubObject(1, 3); - assertXYZCompareOrder(x, y, z, true, null); + assertXYZCompareOrder(x, y, z, true, null); } - + private void assertXYZCompareOrder(final Object x, final Object y, final Object z, final boolean testTransients, final String[] excludeFields) { assertTrue(0 == CompareToBuilder.reflectionCompare(x, x, testTransients, null, excludeFields)); assertTrue(0 == CompareToBuilder.reflectionCompare(y, y, testTransients, null, excludeFields)); assertTrue(0 == CompareToBuilder.reflectionCompare(z, z, testTransients, null, excludeFields)); - + assertTrue(0 > CompareToBuilder.reflectionCompare(x, y, testTransients, null, excludeFields)); assertTrue(0 > CompareToBuilder.reflectionCompare(x, z, testTransients, null, excludeFields)); assertTrue(0 > CompareToBuilder.reflectionCompare(y, z, testTransients, null, excludeFields)); - + assertTrue(0 < CompareToBuilder.reflectionCompare(y, x, testTransients, null, excludeFields)); assertTrue(0 < CompareToBuilder.reflectionCompare(z, x, testTransients, null, excludeFields)); assertTrue(0 < CompareToBuilder.reflectionCompare(z, y, testTransients, null, excludeFields)); } - + private void testReflectionHierarchyCompare(final boolean testTransients, final String[] excludeFields) { final TestObject to1 = new TestObject(1); final TestObject to2 = new TestObject(2); @@ -185,26 +185,26 @@ public class CompareToBuilderTest { final TestSubObject tso1 = new TestSubObject(1, 1); final TestSubObject tso2 = new TestSubObject(2, 2); final TestSubObject tso3 = new TestSubObject(3, 3); - + assertReflectionCompareContract(to1, to1, to1, false, excludeFields); assertReflectionCompareContract(to1, to2, to3, false, excludeFields); assertReflectionCompareContract(tso1, tso1, tso1, false, excludeFields); assertReflectionCompareContract(tso1, tso2, tso3, false, excludeFields); assertReflectionCompareContract("1", "2", "3", false, excludeFields); - + assertTrue(0 != CompareToBuilder.reflectionCompare(tso1, new TestSubObject(1, 0), testTransients)); assertTrue(0 != CompareToBuilder.reflectionCompare(tso1, new TestSubObject(0, 1), testTransients)); // root class assertXYZCompareOrder(to1, to2, to3, true, null); - // subclass - assertXYZCompareOrder(tso1, tso2, tso3, true, null); + // subclass + assertXYZCompareOrder(tso1, tso2, tso3, true, null); } /** * See "Effective Java" under "Consider Implementing Comparable". - * - * @param x an object to compare + * + * @param x an object to compare * @param y an object to compare * @param z an object to compare * @param testTransients Whether to include transients in the comparison @@ -214,26 +214,26 @@ public class CompareToBuilderTest { // signum assertTrue(reflectionCompareSignum(x, y, testTransients, excludeFields) == -reflectionCompareSignum(y, x, testTransients, excludeFields)); - + // transitive - if (CompareToBuilder.reflectionCompare(x, y, testTransients, null, excludeFields) > 0 + if (CompareToBuilder.reflectionCompare(x, y, testTransients, null, excludeFields) > 0 && CompareToBuilder.reflectionCompare(y, z, testTransients, null, excludeFields) > 0){ assertTrue(CompareToBuilder.reflectionCompare(x, z, testTransients, null, excludeFields) > 0); } - + // un-named if (CompareToBuilder.reflectionCompare(x, y, testTransients, null, excludeFields) == 0) { assertTrue(reflectionCompareSignum(x, z, testTransients, excludeFields) == -reflectionCompareSignum(y, z, testTransients, excludeFields)); } - + // strongly recommended but not strictly required assertTrue(CompareToBuilder.reflectionCompare(x, y, testTransients) ==0 == EqualsBuilder.reflectionEquals(x, y, testTransients)); } - + /** * Returns the signum of the result of comparing x and y with * <code>CompareToBuilder.reflectionCompare</code> - * + * * @param lhs The "left-hand-side" of the comparison. * @param rhs The "right-hand-side" of the comparison. * @param testTransients Whether to include transients in the comparison @@ -243,7 +243,7 @@ public class CompareToBuilderTest { private int reflectionCompareSignum(final Object lhs, final Object rhs, final boolean testTransients, final String[] excludeFields) { return BigInteger.valueOf(CompareToBuilder.reflectionCompare(lhs, rhs, testTransients)).signum(); } - + @Test public void testAppendSuper() { final TestObject o1 = new TestObject(4); @@ -251,14 +251,14 @@ public class CompareToBuilderTest { assertTrue(new CompareToBuilder().appendSuper(0).append(o1, o1).toComparison() == 0); assertTrue(new CompareToBuilder().appendSuper(0).append(o1, o2).toComparison() < 0); assertTrue(new CompareToBuilder().appendSuper(0).append(o2, o1).toComparison() > 0); - + assertTrue(new CompareToBuilder().appendSuper(-1).append(o1, o1).toComparison() < 0); assertTrue(new CompareToBuilder().appendSuper(-1).append(o1, o2).toComparison() < 0); - + assertTrue(new CompareToBuilder().appendSuper(1).append(o1, o1).toComparison() > 0); assertTrue(new CompareToBuilder().appendSuper(1).append(o1, o2).toComparison() > 0); } - + @Test public void testObject() { final TestObject o1 = new TestObject(4); @@ -268,12 +268,12 @@ public class CompareToBuilderTest { o2.setA(5); assertTrue(new CompareToBuilder().append(o1, o2).toComparison() < 0); assertTrue(new CompareToBuilder().append(o2, o1).toComparison() > 0); - + assertTrue(new CompareToBuilder().append(o1, null).toComparison() > 0); assertTrue(new CompareToBuilder().append((Object) null, null).toComparison() == 0); assertTrue(new CompareToBuilder().append(null, o1).toComparison() < 0); } - + @Test public void testObjectBuild() { final TestObject o1 = new TestObject(4); @@ -283,7 +283,7 @@ public class CompareToBuilderTest { o2.setA(5); assertTrue(new CompareToBuilder().append(o1, o2).build().intValue() < 0); assertTrue(new CompareToBuilder().append(o2, o1).build().intValue() > 0); - + assertTrue(new CompareToBuilder().append(o1, null).build().intValue() > 0); assertEquals(Integer.valueOf(0), new CompareToBuilder().append((Object) null, null).build()); assertTrue(new CompareToBuilder().append(null, o1).build().intValue() < 0); @@ -308,12 +308,12 @@ public class CompareToBuilderTest { o2 = "FREDA"; assertTrue(new CompareToBuilder().append(o1, o2, String.CASE_INSENSITIVE_ORDER).toComparison() < 0); assertTrue(new CompareToBuilder().append(o2, o1, String.CASE_INSENSITIVE_ORDER).toComparison() > 0); - + assertTrue(new CompareToBuilder().append(o1, null, String.CASE_INSENSITIVE_ORDER).toComparison() > 0); assertTrue(new CompareToBuilder().append(null, null, String.CASE_INSENSITIVE_ORDER).toComparison() == 0); assertTrue(new CompareToBuilder().append(null, o1, String.CASE_INSENSITIVE_ORDER).toComparison() < 0); } - + @Test public void testObjectComparatorNull() { final String o1 = "Fred"; @@ -323,7 +323,7 @@ public class CompareToBuilderTest { o2 = "Zebra"; assertTrue(new CompareToBuilder().append(o1, o2, null).toComparison() < 0); assertTrue(new CompareToBuilder().append(o2, o1, null).toComparison() > 0); - + assertTrue(new CompareToBuilder().append(o1, null, null).toComparison() > 0); assertTrue(new CompareToBuilder().append(null, null, null).toComparison() == 0); assertTrue(new CompareToBuilder().append(null, o1, null).toComparison() < 0); @@ -458,12 +458,12 @@ public class CompareToBuilderTest { obj3[0] = new TestObject(4); obj3[1] = new TestObject(5); obj3[2] = new TestObject(6); - + assertTrue(new CompareToBuilder().append(obj1, obj1).toComparison() == 0); assertTrue(new CompareToBuilder().append(obj1, obj2).toComparison() == 0); assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0); assertTrue(new CompareToBuilder().append(obj3, obj1).toComparison() > 0); - + obj1[1] = new TestObject(7); assertTrue(new CompareToBuilder().append(obj1, obj2).toComparison() > 0); assertTrue(new CompareToBuilder().append(obj2, obj1).toComparison() < 0); @@ -485,7 +485,7 @@ public class CompareToBuilderTest { obj3[0] = 5L; obj3[1] = 6L; obj3[2] = 7L; - + assertTrue(new CompareToBuilder().append(obj1, obj1).toComparison() == 0); assertTrue(new CompareToBuilder().append(obj1, obj2).toComparison() == 0); assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0); @@ -703,7 +703,7 @@ public class CompareToBuilderTest { } array3[1][2] = 100; array3[1][2] = 100; - + assertTrue(new CompareToBuilder().append(array1, array1).toComparison() == 0); assertTrue(new CompareToBuilder().append(array1, array2).toComparison() == 0); assertTrue(new CompareToBuilder().append(array1, array3).toComparison() < 0); @@ -727,7 +727,7 @@ public class CompareToBuilderTest { } array3[1][2] = 100; array3[1][2] = 100; - + assertTrue(new CompareToBuilder().append(array1, array1).toComparison() == 0); assertTrue(new CompareToBuilder().append(array1, array2).toComparison() == 0); assertTrue(new CompareToBuilder().append(array1, array3).toComparison() < 0); @@ -751,7 +751,7 @@ public class CompareToBuilderTest { } array3[1][2] = 100; array3[1][2] = 100; - + assertTrue(new CompareToBuilder().append(array1, array1).toComparison() == 0); assertTrue(new CompareToBuilder().append(array1, array2).toComparison() == 0); assertTrue(new CompareToBuilder().append(array1, array3).toComparison() < 0); @@ -775,7 +775,7 @@ public class CompareToBuilderTest { } array3[1][2] = 100; array3[1][2] = 100; - + assertTrue(new CompareToBuilder().append(array1, array1).toComparison() == 0); assertTrue(new CompareToBuilder().append(array1, array2).toComparison() == 0); assertTrue(new CompareToBuilder().append(array1, array3).toComparison() < 0); @@ -799,7 +799,7 @@ public class CompareToBuilderTest { } array3[1][2] = 100; array3[1][2] = 100; - + assertTrue(new CompareToBuilder().append(array1, array1).toComparison() == 0); assertTrue(new CompareToBuilder().append(array1, array2).toComparison() == 0); assertTrue(new CompareToBuilder().append(array1, array3).toComparison() < 0); @@ -808,7 +808,7 @@ public class CompareToBuilderTest { assertTrue(new CompareToBuilder().append(array1, array2).toComparison() > 0); assertTrue(new CompareToBuilder().append(array2, array1).toComparison() < 0); } - + @Test public void testMultiFloatArray() { final float[][] array1 = new float[2][2]; @@ -823,7 +823,7 @@ public class CompareToBuilderTest { } array3[1][2] = 100; array3[1][2] = 100; - + assertTrue(new CompareToBuilder().append(array1, array1).toComparison() == 0); assertTrue(new CompareToBuilder().append(array1, array2).toComparison() == 0); assertTrue(new CompareToBuilder().append(array1, array3).toComparison() < 0); @@ -847,7 +847,7 @@ public class CompareToBuilderTest { } array3[1][2] = 100; array3[1][2] = 100; - + assertTrue(new CompareToBuilder().append(array1, array1).toComparison() == 0); assertTrue(new CompareToBuilder().append(array1, array2).toComparison() == 0); assertTrue(new CompareToBuilder().append(array1, array3).toComparison() < 0); @@ -871,7 +871,7 @@ public class CompareToBuilderTest { } array3[1][2] = false; array3[1][2] = false; - + assertTrue(new CompareToBuilder().append(array1, array1).toComparison() == 0); assertTrue(new CompareToBuilder().append(array1, array2).toComparison() == 0); assertTrue(new CompareToBuilder().append(array1, array3).toComparison() < 0); @@ -898,8 +898,8 @@ public class CompareToBuilderTest { } array3[1][2] = 100; array3[1][2] = 100; - - + + assertTrue(new CompareToBuilder().append(array1, array1).toComparison() == 0); assertTrue(new CompareToBuilder().append(array1, array2).toComparison() == 0); assertTrue(new CompareToBuilder().append(array1, array3).toComparison() < 0); @@ -947,11 +947,11 @@ public class CompareToBuilderTest { array3[0] = new TestObject(4); array3[1] = new TestObject(5); array3[2] = new TestObject(6); - + final Object obj1 = array1; final Object obj2 = array2; final Object obj3 = array3; - + assertTrue(new CompareToBuilder().append(obj1, obj1).toComparison() == 0); assertTrue(new CompareToBuilder().append(obj1, obj2).toComparison() == 0); assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0); @@ -1161,5 +1161,5 @@ public class CompareToBuilderTest { assertTrue(new CompareToBuilder().append(obj1, obj2).toComparison() > 0); assertTrue(new CompareToBuilder().append(obj2, obj1).toComparison() < 0); } - + } http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1da8ccdb/src/test/java/org/apache/commons/lang3/builder/DefaultToStringStyleTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/lang3/builder/DefaultToStringStyleTest.java b/src/test/java/org/apache/commons/lang3/builder/DefaultToStringStyleTest.java index b8fd1f1..6bc9223 100644 --- a/src/test/java/org/apache/commons/lang3/builder/DefaultToStringStyleTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/DefaultToStringStyleTest.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -33,7 +33,7 @@ public class DefaultToStringStyleTest { private final Integer base = Integer.valueOf(5); private final String baseStr = base.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(base)); - + @Before public void setUp() throws Exception { ToStringBuilder.setDefaultStyle(ToStringStyle.DEFAULT_STYLE); @@ -45,7 +45,7 @@ public class DefaultToStringStyleTest { } //---------------------------------------------------------------- - + @Test public void testBlank() { assertEquals(baseStr + "[]", new ToStringBuilder(base).toString()); @@ -55,12 +55,12 @@ public class DefaultToStringStyleTest { public void testAppendSuper() { assertEquals(baseStr + "[]", new ToStringBuilder(base).appendSuper("Integer@8888[]").toString()); assertEquals(baseStr + "[<null>]", new ToStringBuilder(base).appendSuper("Integer@8888[<null>]").toString()); - + assertEquals(baseStr + "[a=hello]", new ToStringBuilder(base).appendSuper("Integer@8888[]").append("a", "hello").toString()); assertEquals(baseStr + "[<null>,a=hello]", new ToStringBuilder(base).appendSuper("Integer@8888[<null>]").append("a", "hello").toString()); assertEquals(baseStr + "[a=hello]", new ToStringBuilder(base).appendSuper(null).append("a", "hello").toString()); } - + @Test public void testObject() { final Integer i3 = Integer.valueOf(3);