[libcommons-lang3-java] 01/04: add patch for FTBFS with jdk7

Tony Mancill tmancill at moszumanska.debian.org
Tue Dec 31 05:41:26 UTC 2013


This is an automated email from the git hooks/post-receive script.

tmancill pushed a commit to branch master
in repository libcommons-lang3-java.

commit dd2b148b2eed5cec2e289bc8f623fab680286b1a
Author: tony mancill <tmancill at debian.org>
Date:   Mon Dec 30 21:23:09 2013 -0800

    add patch for FTBFS with jdk7
---
 debian/patches/0002-ToStringBuilderTest-jdk7.patch | 663 +++++++++++++++++++++
 debian/patches/series                              |   1 +
 2 files changed, 664 insertions(+)

diff --git a/debian/patches/0002-ToStringBuilderTest-jdk7.patch b/debian/patches/0002-ToStringBuilderTest-jdk7.patch
new file mode 100644
index 0000000..3c6b714
--- /dev/null
+++ b/debian/patches/0002-ToStringBuilderTest-jdk7.patch
@@ -0,0 +1,663 @@
+Description: address test failure on jdk7
+ Updates the ToStringBuilderTest class to a newer upstream revision
+Source: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java?revision=1525071&view=co
+
+--
+diff --git a/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java b/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java
+index 88a19b2..37f943b 100644
+--- a/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java
++++ b/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java
+@@ -16,26 +16,38 @@
+  */
+ package org.apache.commons.lang3.builder;
+ 
+-import static org.junit.Assert.*;
++import static org.junit.Assert.assertEquals;
++import static org.junit.Assert.assertNull;
++import static org.junit.Assert.assertSame;
++import static org.junit.Assume.assumeFalse;
+ 
+ import java.util.ArrayList;
+ import java.util.HashMap;
+ import java.util.List;
+-
+-import org.junit.Test;
++import java.util.Map;
+ 
+ import org.apache.commons.lang3.SystemUtils;
++import org.junit.After;
++import org.junit.Test;
+ 
+ /**
+  * Unit tests for {@link org.apache.commons.lang3.builder.ToStringBuilder}.
+  *
+- * @version $Id: ToStringBuilderTest.java 1154530 2011-08-06 15:43:07Z joehni $
++ * @version $Id$
+  */
+ public class ToStringBuilderTest {
+ 
+     private final Integer base = Integer.valueOf(5);
+     private final String baseStr = base.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(base));
+ 
++    /*
++     * All tests should leave the registry empty. 
++     */
++    @After
++    public void after(){
++        validateNullToStringStyleRegistry();
++    }
++
+     //-----------------------------------------------------------------------
+ 
+     @Test
+@@ -52,8 +64,8 @@ public class ToStringBuilderTest {
+     @Test
+     public void testConstructorEx3() {
+         assertEquals("<null>", new ToStringBuilder(null, null, null).toString());
+-        new ToStringBuilder(this.base, null, null);
+-        new ToStringBuilder(this.base, ToStringStyle.DEFAULT_STYLE, null);
++        new ToStringBuilder(this.base, null, null).toString();
++        new ToStringBuilder(this.base, ToStringStyle.DEFAULT_STYLE, null).toString();
+     }
+ 
+     @Test
+@@ -67,15 +79,9 @@ public class ToStringBuilderTest {
+         }
+     }
+ 
+-    @Test
++    @Test(expected=IllegalArgumentException.class)
+     public void testSetDefaultEx() {
+-        try {
+-            ToStringBuilder.setDefaultStyle(null);
+-
+-        } catch (IllegalArgumentException ex) {
+-            return;
+-        }
+-        fail();
++        ToStringBuilder.setDefaultStyle(null);
+     }
+ 
+     @Test
+@@ -96,7 +102,7 @@ public class ToStringBuilderTest {
+      */
+     @Test
+     public void testReflectionCharacter() {
+-        Character c = new Character('A');
++        final Character c = new Character('A');
+         assertEquals(this.toBaseString(c) + "[value=A]", ToStringBuilder.reflectionToString(c));
+     }
+ 
+@@ -117,7 +123,7 @@ public class ToStringBuilderTest {
+      * @param o the object to create the string for.
+      * @return a String in the Object.toString format.
+      */
+-    private String toBaseString(Object o) {
++    private String toBaseString(final Object o) {
+         return o.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(o));
+     }
+ 
+@@ -136,7 +142,7 @@ public class ToStringBuilderTest {
+     // Gary Gregory - 2003-03-12 - ggregory at seagullsw.com
+     //
+ 
+-    public void assertReflectionArray(String expected, Object actual) {
++    public void assertReflectionArray(final String expected, final Object actual) {
+         if (actual == null) {
+             // Until ToStringBuilder supports null objects.
+             return;
+@@ -150,91 +156,82 @@ public class ToStringBuilderTest {
+     @Test
+     public void testReflectionObjectArray() {
+         Object[] array = new Object[] { null, base, new int[] { 3, 6 } };
+-        String baseStr = this.toBaseString(array);
++        final String baseStr = this.toBaseString(array);
+         assertEquals(baseStr + "[{<null>,5,{3,6}}]", ToStringBuilder.reflectionToString(array));
+         array = null;
+         assertReflectionArray("<null>", array);
+-        this.validateNullToStringStyleRegistry();
+     }
+ 
+     @Test
+     public void testReflectionLongArray() {
+         long[] array = new long[] { 1, 2, -3, 4 };
+-        String baseStr = this.toBaseString(array);
++        final String baseStr = this.toBaseString(array);
+         assertEquals(baseStr + "[{1,2,-3,4}]", ToStringBuilder.reflectionToString(array));
+         array = null;
+         assertReflectionArray("<null>", array);
+-        this.validateNullToStringStyleRegistry();
+     }
+ 
+     @Test
+     public void testReflectionIntArray() {
+         int[] array = new int[] { 1, 2, -3, 4 };
+-        String baseStr = this.toBaseString(array);
++        final String baseStr = this.toBaseString(array);
+         assertEquals(baseStr + "[{1,2,-3,4}]", ToStringBuilder.reflectionToString(array));
+         array = null;
+         assertReflectionArray("<null>", array);
+-        this.validateNullToStringStyleRegistry();
+     }
+ 
+     @Test
+     public void testReflectionShortArray() {
+         short[] array = new short[] { 1, 2, -3, 4 };
+-        String baseStr = this.toBaseString(array);
++        final String baseStr = this.toBaseString(array);
+         assertEquals(baseStr + "[{1,2,-3,4}]", ToStringBuilder.reflectionToString(array));
+         array = null;
+         assertReflectionArray("<null>", array);
+-        this.validateNullToStringStyleRegistry();
+     }
+ 
+     @Test
+     public void testReflectionyteArray() {
+         byte[] array = new byte[] { 1, 2, -3, 4 };
+-        String baseStr = this.toBaseString(array);
++        final String baseStr = this.toBaseString(array);
+         assertEquals(baseStr + "[{1,2,-3,4}]", ToStringBuilder.reflectionToString(array));
+         array = null;
+         assertReflectionArray("<null>", array);
+-        this.validateNullToStringStyleRegistry();
+     }
+ 
+     @Test
+     public void testReflectionCharArray() {
+         char[] array = new char[] { 'A', '2', '_', 'D' };
+-        String baseStr = this.toBaseString(array);
++        final String baseStr = this.toBaseString(array);
+         assertEquals(baseStr + "[{A,2,_,D}]", ToStringBuilder.reflectionToString(array));
+         array = null;
+         assertReflectionArray("<null>", array);
+-        this.validateNullToStringStyleRegistry();
+     }
+ 
+     @Test
+     public void testReflectionDoubleArray() {
+         double[] array = new double[] { 1.0, 2.9876, -3.00001, 4.3 };
+-        String baseStr = this.toBaseString(array);
++        final String baseStr = this.toBaseString(array);
+         assertEquals(baseStr + "[{1.0,2.9876,-3.00001,4.3}]", ToStringBuilder.reflectionToString(array));
+         array = null;
+         assertReflectionArray("<null>", array);
+-        this.validateNullToStringStyleRegistry();
+     }
+ 
+     @Test
+     public void testReflectionFloatArray() {
+         float[] array = new float[] { 1.0f, 2.9876f, -3.00001f, 4.3f };
+-        String baseStr = this.toBaseString(array);
++        final String baseStr = this.toBaseString(array);
+         assertEquals(baseStr + "[{1.0,2.9876,-3.00001,4.3}]", ToStringBuilder.reflectionToString(array));
+         array = null;
+         assertReflectionArray("<null>", array);
+-        this.validateNullToStringStyleRegistry();
+     }
+ 
+     @Test
+     public void testReflectionBooleanArray() {
+         boolean[] array = new boolean[] { true, false, false };
+-        String baseStr = this.toBaseString(array);
++        final String baseStr = this.toBaseString(array);
+         assertEquals(baseStr + "[{true,false,false}]", ToStringBuilder.reflectionToString(array));
+         array = null;
+         assertReflectionArray("<null>", array);
+-        this.validateNullToStringStyleRegistry();
+     }
+ 
+     // Reflection Array Array tests
+@@ -242,113 +239,101 @@ public class ToStringBuilderTest {
+     @Test
+     public void testReflectionFloatArrayArray() {
+         float[][] array = new float[][] { { 1.0f, 2.29686f }, null, { Float.NaN } };
+-        String baseStr = this.toBaseString(array);
++        final String baseStr = this.toBaseString(array);
+         assertEquals(baseStr + "[{{1.0,2.29686},<null>,{NaN}}]", ToStringBuilder.reflectionToString(array));
+         array = null;
+         assertReflectionArray("<null>", array);
+-        this.validateNullToStringStyleRegistry();
+     }
+ 
+ 
+     @Test
+     public void testReflectionLongArrayArray() {
+         long[][] array = new long[][] { { 1, 2 }, null, { 5 } };
+-        String baseStr = this.toBaseString(array);
++        final String baseStr = this.toBaseString(array);
+         assertEquals(baseStr + "[{{1,2},<null>,{5}}]", ToStringBuilder.reflectionToString(array));
+         array = null;
+         assertReflectionArray("<null>", array);
+-        this.validateNullToStringStyleRegistry();
+     }
+ 
+     @Test
+     public void testReflectionIntArrayArray() {
+         int[][] array = new int[][] { { 1, 2 }, null, { 5 } };
+-        String baseStr = this.toBaseString(array);
++        final String baseStr = this.toBaseString(array);
+         assertEquals(baseStr + "[{{1,2},<null>,{5}}]", ToStringBuilder.reflectionToString(array));
+         array = null;
+         assertReflectionArray("<null>", array);
+-        this.validateNullToStringStyleRegistry();
+     }
+ 
+     @Test
+     public void testReflectionhortArrayArray() {
+         short[][] array = new short[][] { { 1, 2 }, null, { 5 } };
+-        String baseStr = this.toBaseString(array);
++        final String baseStr = this.toBaseString(array);
+         assertEquals(baseStr + "[{{1,2},<null>,{5}}]", ToStringBuilder.reflectionToString(array));
+         array = null;
+         assertReflectionArray("<null>", array);
+-        this.validateNullToStringStyleRegistry();
+     }
+ 
+     @Test
+     public void testReflectionByteArrayArray() {
+         byte[][] array = new byte[][] { { 1, 2 }, null, { 5 } };
+-        String baseStr = this.toBaseString(array);
++        final String baseStr = this.toBaseString(array);
+         assertEquals(baseStr + "[{{1,2},<null>,{5}}]", ToStringBuilder.reflectionToString(array));
+         array = null;
+         assertReflectionArray("<null>", array);
+-        this.validateNullToStringStyleRegistry();
+     }
+ 
+     @Test
+     public void testReflectionCharArrayArray() {
+         char[][] array = new char[][] { { 'A', 'B' }, null, { 'p' } };
+-        String baseStr = this.toBaseString(array);
++        final String baseStr = this.toBaseString(array);
+         assertEquals(baseStr + "[{{A,B},<null>,{p}}]", ToStringBuilder.reflectionToString(array));
+         array = null;
+         assertReflectionArray("<null>", array);
+-        this.validateNullToStringStyleRegistry();
+     }
+ 
+     @Test
+     public void testReflectionDoubleArrayArray() {
+         double[][] array = new double[][] { { 1.0, 2.29686 }, null, { Double.NaN } };
+-        String baseStr = this.toBaseString(array);
++        final String baseStr = this.toBaseString(array);
+         assertEquals(baseStr + "[{{1.0,2.29686},<null>,{NaN}}]", ToStringBuilder.reflectionToString(array));
+         array = null;
+         assertReflectionArray("<null>", array);
+-        this.validateNullToStringStyleRegistry();
+     }
+ 
+     @Test
+     public void testReflectionBooleanArrayArray() {
+         boolean[][] array = new boolean[][] { { true, false }, null, { false } };
+-        String baseStr = this.toBaseString(array);
++        final String baseStr = this.toBaseString(array);
+         assertEquals(baseStr + "[{{true,false},<null>,{false}}]", ToStringBuilder.reflectionToString(array));
+         assertEquals(baseStr + "[{{true,false},<null>,{false}}]", ToStringBuilder.reflectionToString(array));
+         array = null;
+         assertReflectionArray("<null>", array);
+-        this.validateNullToStringStyleRegistry();
+     }
+ 
+     // Reflection hierarchy tests
+     @Test
+     public void testReflectionHierarchyArrayList() {
+-        List<Object> base = new ArrayList<Object>();
+-        String baseStr = this.toBaseString(base);
+         // note, the test data depends on the internal representation of the ArrayList, which may differ between JDK versions and vendors
+-        String expectedWithTransients = baseStr + "[elementData={<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>},size=0,modCount=0]";
+-        String toStringWithTransients = ToStringBuilder.reflectionToString(base, null, true);
++        // representation different for IBM JDK 1.6.0, LANG-727
++        assumeFalse("IBM Corporation".equals(SystemUtils.JAVA_VENDOR) && "1.6".equals(SystemUtils.JAVA_SPECIFICATION_VERSION));
++        assumeFalse("Oracle Corporation".equals(SystemUtils.JAVA_VENDOR) && "1.6".compareTo(SystemUtils.JAVA_SPECIFICATION_VERSION) < 0);
++        final List<Object> base = new ArrayList<Object>();
++        final String baseStr = this.toBaseString(base);
++        final String expectedWithTransients = baseStr + "[elementData={<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>},size=0,modCount=0]";
++        final String toStringWithTransients = ToStringBuilder.reflectionToString(base, null, true);
+         if (!expectedWithTransients.equals(toStringWithTransients)) {
+-            // representation different for IBM JDK 1.6.0, LANG-727
+-            if (!("IBM Corporation".equals(SystemUtils.JAVA_VENDOR) && "1.6".equals(SystemUtils.JAVA_SPECIFICATION_VERSION))) {
+-                assertEquals(expectedWithTransients, toStringWithTransients);
+-            }
++            assertEquals(expectedWithTransients, toStringWithTransients);
+         }
+-        String expectedWithoutTransients = baseStr + "[size=0]";
+-        String toStringWithoutTransients = ToStringBuilder.reflectionToString(base, null, false);
++        final String expectedWithoutTransients = baseStr + "[size=0]";
++        final String toStringWithoutTransients = ToStringBuilder.reflectionToString(base, null, false);
+         if (!expectedWithoutTransients.equals(toStringWithoutTransients)) {
+-            // representation different for IBM JDK 1.6.0, LANG-727
+-            if (!("IBM Corporation".equals(SystemUtils.JAVA_VENDOR) && "1.6".equals(SystemUtils.JAVA_SPECIFICATION_VERSION))) {
+-                assertEquals(expectedWithoutTransients, toStringWithoutTransients);
+-            }
++            assertEquals(expectedWithoutTransients, toStringWithoutTransients);
+         }
+-        this.validateNullToStringStyleRegistry();
+     }
+ 
+     @Test
+     public void testReflectionHierarchy() {
+-        ReflectionTestFixtureA baseA = new ReflectionTestFixtureA();
++        final ReflectionTestFixtureA baseA = new ReflectionTestFixtureA();
+         String baseStr = this.toBaseString(baseA);
+         assertEquals(baseStr + "[a=a]", ToStringBuilder.reflectionToString(baseA));
+         assertEquals(baseStr + "[a=a]", ToStringBuilder.reflectionToString(baseA, null));
+@@ -358,7 +343,7 @@ public class ToStringBuilderTest {
+         assertEquals(baseStr + "[a=a]", ToStringBuilder.reflectionToString(baseA, null, false, Object.class));
+         assertEquals(baseStr + "[a=a]", ToStringBuilder.reflectionToString(baseA, null, false, ReflectionTestFixtureA.class));
+ 
+-        ReflectionTestFixtureB baseB = new ReflectionTestFixtureB();
++        final ReflectionTestFixtureB baseB = new ReflectionTestFixtureB();
+         baseStr = this.toBaseString(baseB);
+         assertEquals(baseStr + "[b=b,a=a]", ToStringBuilder.reflectionToString(baseB));
+         assertEquals(baseStr + "[b=b,a=a]", ToStringBuilder.reflectionToString(baseB));
+@@ -369,26 +354,25 @@ public class ToStringBuilderTest {
+         assertEquals(baseStr + "[b=b,a=a]", ToStringBuilder.reflectionToString(baseB, null, false, Object.class));
+         assertEquals(baseStr + "[b=b,a=a]", ToStringBuilder.reflectionToString(baseB, null, false, ReflectionTestFixtureA.class));
+         assertEquals(baseStr + "[b=b]", ToStringBuilder.reflectionToString(baseB, null, false, ReflectionTestFixtureB.class));
+-        this.validateNullToStringStyleRegistry();
+     }
+ 
+     static class ReflectionTestFixtureA {
+         @SuppressWarnings("unused")
+-        private char a='a';
++        private final char a='a';
+         @SuppressWarnings("unused")
+         private transient char transientA='t';
+     }
+ 
+     static class ReflectionTestFixtureB extends ReflectionTestFixtureA {
+         @SuppressWarnings("unused")
+-        private char b='b';
++        private final char b='b';
+         @SuppressWarnings("unused")
+         private transient char transientB='t';
+     }
+ 
+     @Test
+     public void testInnerClassReflection() {
+-        Outer outer = new Outer();
++        final Outer outer = new Outer();
+         assertEquals(toBaseString(outer) + "[inner=" + toBaseString(outer.inner) + "[]]", outer.toString());
+     }
+ 
+@@ -413,12 +397,11 @@ public class ToStringBuilderTest {
+      */
+     @Test
+     public void testReflectionArrayCycle() throws Exception {
+-        Object[] objects = new Object[1];
++        final Object[] objects = new Object[1];
+         objects[0] = objects;
+         assertEquals(
+             this.toBaseString(objects) + "[{" + this.toBaseString(objects) + "}]",
+             ToStringBuilder.reflectionToString(objects));
+-        this.validateNullToStringStyleRegistry();
+     }
+ 
+     /**
+@@ -426,8 +409,8 @@ public class ToStringBuilderTest {
+      */
+     @Test
+     public void testReflectionArrayCycleLevel2() throws Exception {
+-        Object[] objects = new Object[1];
+-        Object[] objectsLevel2 = new Object[1];
++        final Object[] objects = new Object[1];
++        final Object[] objectsLevel2 = new Object[1];
+         objects[0] = objectsLevel2;
+         objectsLevel2[0] = objects;
+         assertEquals(
+@@ -436,17 +419,16 @@ public class ToStringBuilderTest {
+         assertEquals(
+             this.toBaseString(objectsLevel2) + "[{{" + this.toBaseString(objectsLevel2) + "}}]",
+             ToStringBuilder.reflectionToString(objectsLevel2));
+-        this.validateNullToStringStyleRegistry();
+     }
+ 
+     @Test
+     public void testReflectionArrayArrayCycle() throws Exception {
+-        Object[][] objects = new Object[2][2];
++        final Object[][] objects = new Object[2][2];
+         objects[0][0] = objects;
+         objects[0][1] = objects;
+         objects[1][0] = objects;
+         objects[1][1] = objects;
+-        String basicToString = this.toBaseString(objects);
++        final String basicToString = this.toBaseString(objects);
+         assertEquals(
+             basicToString
+                 + "[{{"
+@@ -459,7 +441,6 @@ public class ToStringBuilderTest {
+                 + basicToString
+                 + "}}]",
+             ToStringBuilder.reflectionToString(objects));
+-        this.validateNullToStringStyleRegistry();
+     }
+ 
+     /**
+@@ -495,7 +476,7 @@ public class ToStringBuilderTest {
+         public SimpleReflectionTestFixture() {
+         }
+ 
+-        public SimpleReflectionTestFixture(Object o) {
++        public SimpleReflectionTestFixture(final Object o) {
+             this.o = o;
+         }
+ 
+@@ -507,7 +488,7 @@ public class ToStringBuilderTest {
+ 
+     private static class SelfInstanceVarReflectionTestFixture {
+         @SuppressWarnings("unused")
+-        private SelfInstanceVarReflectionTestFixture typeIsSelf;
++        private final SelfInstanceVarReflectionTestFixture typeIsSelf;
+ 
+         public SelfInstanceVarReflectionTestFixture() {
+             this.typeIsSelf = this;
+@@ -521,8 +502,8 @@ public class ToStringBuilderTest {
+ 
+     private static class SelfInstanceTwoVarsReflectionTestFixture {
+         @SuppressWarnings("unused")
+-        private SelfInstanceTwoVarsReflectionTestFixture typeIsSelf;
+-        private String otherType = "The Other Type";
++        private final SelfInstanceTwoVarsReflectionTestFixture typeIsSelf;
++        private final String otherType = "The Other Type";
+ 
+         public SelfInstanceTwoVarsReflectionTestFixture() {
+             this.typeIsSelf = this;
+@@ -546,10 +527,9 @@ public class ToStringBuilderTest {
+      */
+     @Test
+     public void testSimpleReflectionObjectCycle() throws Exception {
+-        SimpleReflectionTestFixture simple = new SimpleReflectionTestFixture();
++        final SimpleReflectionTestFixture simple = new SimpleReflectionTestFixture();
+         simple.o = simple;
+         assertEquals(this.toBaseString(simple) + "[o=" + this.toBaseString(simple) + "]", simple.toString());
+-        this.validateNullToStringStyleRegistry();
+     }
+ 
+     /**
+@@ -559,9 +539,8 @@ public class ToStringBuilderTest {
+      */
+     @Test
+     public void testSelfInstanceVarReflectionObjectCycle() throws Exception {
+-        SelfInstanceVarReflectionTestFixture test = new SelfInstanceVarReflectionTestFixture();
++        final SelfInstanceVarReflectionTestFixture test = new SelfInstanceVarReflectionTestFixture();
+         assertEquals(this.toBaseString(test) + "[typeIsSelf=" + this.toBaseString(test) + "]", test.toString());
+-        this.validateNullToStringStyleRegistry();
+     }
+ 
+     /**
+@@ -572,9 +551,8 @@ public class ToStringBuilderTest {
+      */
+     @Test
+     public void testSelfInstanceTwoVarsReflectionObjectCycle() throws Exception {
+-        SelfInstanceTwoVarsReflectionTestFixture test = new SelfInstanceTwoVarsReflectionTestFixture();
++        final SelfInstanceTwoVarsReflectionTestFixture test = new SelfInstanceTwoVarsReflectionTestFixture();
+         assertEquals(this.toBaseString(test) + "[typeIsSelf=" + this.toBaseString(test) + ",otherType=" + test.getOtherType().toString() + "]", test.toString());
+-        this.validateNullToStringStyleRegistry();
+     }
+ 
+ 
+@@ -585,14 +563,13 @@ public class ToStringBuilderTest {
+      */
+     @Test
+     public void testReflectionObjectCycle() throws Exception {
+-        ReflectionTestCycleA a = new ReflectionTestCycleA();
+-        ReflectionTestCycleB b = new ReflectionTestCycleB();
++        final ReflectionTestCycleA a = new ReflectionTestCycleA();
++        final ReflectionTestCycleB b = new ReflectionTestCycleB();
+         a.b = b;
+         b.a = a;
+         assertEquals(
+             this.toBaseString(a) + "[b=" + this.toBaseString(b) + "[a=" + this.toBaseString(a) + "]]",
+             a.toString());
+-        this.validateNullToStringStyleRegistry();
+     }
+ 
+     /**
+@@ -603,8 +580,8 @@ public class ToStringBuilderTest {
+      */
+     @Test
+     public void testReflectionArrayAndObjectCycle() throws Exception {
+-        Object[] objects = new Object[1];
+-        SimpleReflectionTestFixture simple = new SimpleReflectionTestFixture(objects);
++        final Object[] objects = new Object[1];
++        final SimpleReflectionTestFixture simple = new SimpleReflectionTestFixture(objects);
+         objects[0] = simple;
+         assertEquals(
+             this.toBaseString(objects)
+@@ -621,15 +598,11 @@ public class ToStringBuilderTest {
+                 + this.toBaseString(simple)
+                 + "}]",
+             ToStringBuilder.reflectionToString(simple));
+-        this.validateNullToStringStyleRegistry();
+     }
+ 
+     void validateNullToStringStyleRegistry() {
+-       if (ToStringStyle.getRegistry() != null) {
+-           System.out.println(ToStringStyle.getRegistry());
+-       }
+-
+-        assertNull(ToStringStyle.getRegistry());
++        final Map<Object, Object> registry = ToStringStyle.getRegistry();
++        assertNull("Expected null, actual: "+registry, registry);
+     }
+     //  End: Reflection cycle tests
+ 
+@@ -655,8 +628,8 @@ public class ToStringBuilderTest {
+ 
+     @Test
+     public void testObject() {
+-        Integer i3 = Integer.valueOf(3);
+-        Integer i4 = Integer.valueOf(4);
++        final Integer i3 = Integer.valueOf(3);
++        final Integer i4 = Integer.valueOf(4);
+         assertEquals(baseStr + "[<null>]", new ToStringBuilder(base).append((Object) null).toString());
+         assertEquals(baseStr + "[3]", new ToStringBuilder(base).append(i3).toString());
+         assertEquals(baseStr + "[a=<null>]", new ToStringBuilder(base).append("a", (Object) null).toString());
+@@ -673,8 +646,8 @@ public class ToStringBuilderTest {
+     
+     @Test
+     public void testObjectBuild() {
+-        Integer i3 = Integer.valueOf(3);
+-        Integer i4 = Integer.valueOf(4);
++        final Integer i3 = Integer.valueOf(3);
++        final Integer i4 = Integer.valueOf(4);
+         assertEquals(baseStr + "[<null>]", new ToStringBuilder(base).append((Object) null).build());
+         assertEquals(baseStr + "[3]", new ToStringBuilder(base).append(i3).build());
+         assertEquals(baseStr + "[a=<null>]", new ToStringBuilder(base).append("a", (Object) null).build());
+@@ -920,14 +893,13 @@ public class ToStringBuilderTest {
+ 
+     @Test
+     public void testObjectCycle() {
+-        ObjectCycle a = new ObjectCycle();
+-        ObjectCycle b = new ObjectCycle();
++        final ObjectCycle a = new ObjectCycle();
++        final ObjectCycle b = new ObjectCycle();
+         a.obj = b;
+         b.obj = a;
+ 
+-        String expected = toBaseString(a) + "[" + toBaseString(b) + "[" + toBaseString(a) + "]]";
++        final String expected = toBaseString(a) + "[" + toBaseString(b) + "[" + toBaseString(a) + "]]";
+         assertEquals(expected, a.toString());
+-        validateNullToStringStyleRegistry();
+     }
+ 
+     static class ObjectCycle {
+@@ -941,7 +913,7 @@ public class ToStringBuilderTest {
+ 
+     @Test
+     public void testSimpleReflectionStatics() {
+-        SimpleReflectionStaticFieldsFixture instance1 = new SimpleReflectionStaticFieldsFixture();
++        final SimpleReflectionStaticFieldsFixture instance1 = new SimpleReflectionStaticFieldsFixture();
+         assertEquals(
+             this.toBaseString(instance1) + "[staticString=staticString,staticInt=12345]",
+             ReflectionToStringBuilder.toString(instance1, null, false, true, SimpleReflectionStaticFieldsFixture.class));
+@@ -961,7 +933,7 @@ public class ToStringBuilderTest {
+      */
+     @Test
+     public void testReflectionStatics() {
+-        ReflectionStaticFieldsFixture instance1 = new ReflectionStaticFieldsFixture();
++        final ReflectionStaticFieldsFixture instance1 = new ReflectionStaticFieldsFixture();
+         assertEquals(
+             this.toBaseString(instance1) + "[staticString=staticString,staticInt=12345,instanceString=instanceString,instanceInt=67890]",
+             ReflectionToStringBuilder.toString(instance1, null, false, true, ReflectionStaticFieldsFixture.class));
+@@ -981,7 +953,7 @@ public class ToStringBuilderTest {
+      */
+     @Test
+     public void testInheritedReflectionStatics() {
+-        InheritedReflectionStaticFieldsFixture instance1 = new InheritedReflectionStaticFieldsFixture();
++        final InheritedReflectionStaticFieldsFixture instance1 = new InheritedReflectionStaticFieldsFixture();
+         assertEquals(
+             this.toBaseString(instance1) + "[staticString2=staticString2,staticInt2=67890]",
+             ReflectionToStringBuilder.toString(instance1, null, false, true, InheritedReflectionStaticFieldsFixture.class));
+@@ -1021,7 +993,7 @@ public class ToStringBuilderTest {
+      * @return the String result
+      * @throws IllegalArgumentException if the Object is <code>null</code>
+      */
+-    public <T> String toStringWithStatics(T object, ToStringStyle style, Class<? super T> reflectUpToClass) {
++    public <T> String toStringWithStatics(final T object, final ToStringStyle style, final Class<? super T> reflectUpToClass) {
+         return ReflectionToStringBuilder.toString(object, style, false, true, reflectUpToClass);
+     }
+ 
+@@ -1030,23 +1002,23 @@ public class ToStringBuilderTest {
+      */
+     @Test
+     public void test_setUpToClass_valid() {
+-        Integer val = Integer.valueOf(5);
+-        ReflectionToStringBuilder test = new ReflectionToStringBuilder(val);
++        final Integer val = Integer.valueOf(5);
++        final ReflectionToStringBuilder test = new ReflectionToStringBuilder(val);
+         test.setUpToClass(Number.class);
++        test.toString();
+     }
+ 
+     /**
+      * Tests ReflectionToStringBuilder setUpToClass().
+      */
+-    @Test
++    @Test(expected=IllegalArgumentException.class)
+     public void test_setUpToClass_invalid() {
+-        Integer val = Integer.valueOf(5);
+-        ReflectionToStringBuilder test = new ReflectionToStringBuilder(val);
++        final Integer val = Integer.valueOf(5);
++        final ReflectionToStringBuilder test = new ReflectionToStringBuilder(val);
+         try {
+             test.setUpToClass(String.class);
+-            fail();
+-        } catch (IllegalArgumentException ex) {
+-            // expected
++        } finally {
++            test.toString();
+         }
+     }
+ 
+@@ -1099,8 +1071,8 @@ public class ToStringBuilderTest {
+ 
+     @Test
+     public void testAppendToStringUsingMultiLineStyle() {
+-        MultiLineTestObject obj = new MultiLineTestObject();
+-        ToStringBuilder testBuilder = new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
++        final MultiLineTestObject obj = new MultiLineTestObject();
++        final ToStringBuilder testBuilder = new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+                                           .appendToString(obj.toString());
+         assertEquals(testBuilder.toString().indexOf("testInt=31337"), -1);
+     }
diff --git a/debian/patches/series b/debian/patches/series
index 1e4781e..8e3c931 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 disable_testGetUserHome_test.diff
+0002-ToStringBuilderTest-jdk7.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/libcommons-lang3-java.git



More information about the pkg-java-commits mailing list