You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ea...@apache.org on 2019/02/09 10:16:22 UTC

[commons-lang] branch master updated: [ToStringBuilderTest] clean up after some old issues

This is an automated email from the ASF dual-hosted git repository.

eax pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git


The following commit(s) were added to refs/heads/master by this push:
     new 6b7a848  [ToStringBuilderTest] clean up after some old issues
6b7a848 is described below

commit 6b7a8480102144663b567982a5536340a57a431e
Author: Eitan Adler <li...@eitanadler.com>
AuthorDate: Sat Feb 9 02:08:32 2019 -0800

    [ToStringBuilderTest] clean up after some old issues
    
    - Remove code to handle old JDK 6 bugs
    - Fix a mis-ordered assertEquals
    - Remove a deprecated call to Character's constructor
---
 .../org/apache/commons/lang3/builder/ToStringBuilderTest.java | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

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 da973e7..72ce965 100644
--- a/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java
@@ -21,14 +21,12 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertNull;
 import static org.junit.jupiter.api.Assertions.assertSame;
 import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.junit.jupiter.api.Assumptions.assumeFalse;
 
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.commons.lang3.SystemUtils;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.Test;
 
@@ -104,7 +102,7 @@ public class ToStringBuilderTest {
      */
     @Test
     public void testReflectionCharacter() {
-        final Character c = new Character('A');
+        final Character c = 'A';
         assertEquals(this.toBaseString(c) + "[value=A]", ToStringBuilder.reflectionToString(c));
     }
 
@@ -315,10 +313,6 @@ public class ToStringBuilderTest {
     // Reflection hierarchy tests
     @Test
     public void testReflectionHierarchyArrayList() {
-        // note, the test data depends on the internal representation of the ArrayList, which may differ between JDK versions and vendors
-        // 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);
         // LANG-1337 without this, the generated string can differ depending on the JVM version/vendor
         final List<Object> list = new ArrayList<>(ARRAYLIST_INITIAL_CAPACITY);
         final String baseString = this.toBaseString(list);
@@ -1276,6 +1270,7 @@ public class ToStringBuilderTest {
     /**
      * Test fixture for ReflectionToStringBuilder.toString() for statics.
      */
+    @SuppressWarnings("unused")
     class InheritedReflectionStaticFieldsFixture extends SimpleReflectionStaticFieldsFixture {
         static final String staticString2 = "staticString2";
         static final int staticInt2 = 67890;
@@ -1303,7 +1298,7 @@ public class ToStringBuilderTest {
         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);
+        assertEquals(-1, testBuilder.toString().indexOf("testInt=31337"));
     }
 
 }