svn commit: r1869037 [1/2] - in /ofbiz/ofbiz-framework/trunk: ./ framework/base/src/test/java/org/apache/ofbiz/base/conversion/ framework/base/src/test/java/org/apache/ofbiz/base/lang/ framework/base/src/test/java/org/apache/ofbiz/base/test/ framework/...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1869037 [1/2] - in /ofbiz/ofbiz-framework/trunk: ./ framework/base/src/test/java/org/apache/ofbiz/base/conversion/ framework/base/src/test/java/org/apache/ofbiz/base/lang/ framework/base/src/test/java/org/apache/ofbiz/base/test/ framework/...

mthl
Author: mthl
Date: Sun Oct 27 12:51:08 2019
New Revision: 1869037

URL: http://svn.apache.org/viewvc?rev=1869037&view=rev
Log:
Improved: Lint unit tests

This makes no behavioral changes, only coding style fixes.

Modified:
    ofbiz/ofbiz-framework/trunk/build.gradle
    ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/conversion/DateTimeTests.java
    ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/conversion/MiscTests.java
    ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/conversion/TestBooleanConverters.java
    ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/conversion/TestJSONConverters.java
    ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/lang/ComparableRangeTests.java
    ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/test/BaseUnitTests.java
    ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/AssertTests.java
    ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/IndentingWriterTests.java
    ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/ObjectTypeTests.java
    ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/ReferenceCleanerTests.java
    ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/StringUtilTests.java
    ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/TimeDurationTests.java
    ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/UtilCodecTests.java
    ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/UtilHttpTest.java
    ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/UtilIOTests.java
    ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/UtilMiscTests.java
    ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/UtilPropertiesTests.java
    ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/cache/UtilCacheTests.java
    ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/collections/GenericMapTest.java
    ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/collections/MapContextTest.java
    ofbiz/ofbiz-framework/trunk/framework/common/src/test/java/org/apache/ofbiz/common/GetLocaleListTests.java
    ofbiz/ofbiz-framework/trunk/framework/entity/src/test/java/org/apache/ofbiz/entity/EntityConditionVisitorTests.java
    ofbiz/ofbiz-framework/trunk/framework/entity/src/test/java/org/apache/ofbiz/entity/util/EntitySaxReaderTests.java
    ofbiz/ofbiz-framework/trunk/framework/webapp/src/test/java/org/apache/ofbiz/webapp/WebAppCacheTest.java
    ofbiz/ofbiz-framework/trunk/framework/webapp/src/test/java/org/apache/ofbiz/webapp/control/ControlFilterTests.java
    ofbiz/ofbiz-framework/trunk/framework/webapp/src/test/java/org/apache/ofbiz/webapp/control/RequestHandlerTests.java

Modified: ofbiz/ofbiz-framework/trunk/build.gradle
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/build.gradle?rev=1869037&r1=1869036&r2=1869037&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/build.gradle (original)
+++ ofbiz/ofbiz-framework/trunk/build.gradle Sun Oct 27 12:51:08 2019
@@ -308,7 +308,6 @@ checkstyle {
     // ‘checkstyle’ tool present in the framework and in the official
     // plugins.
     tasks.checkstyleMain.maxErrors = 37830
-    tasks.checkstyleTest.maxErrors = 176
     // Currently there are a lot of errors so we need to temporarily
     // hide them to avoid polluting the terminal output.
     showViolations = false

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/conversion/DateTimeTests.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/conversion/DateTimeTests.java?rev=1869037&r1=1869036&r2=1869037&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/conversion/DateTimeTests.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/conversion/DateTimeTests.java Sun Oct 27 12:51:08 2019
@@ -22,15 +22,14 @@ import static org.junit.Assert.assertEqu
 import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertTrue;
 
-import org.apache.ofbiz.base.conversion.Converter;
-import org.apache.ofbiz.base.conversion.DateTimeConverters;
 import org.junit.Test;
 
 import com.ibm.icu.util.Calendar;
 
 public class DateTimeTests {
 
-    private static <S, T> void assertConversion(String label, Converter<S, T> converter, S source, T target) throws Exception {
+    private static <S, T> void assertConversion(String label, Converter<S, T> converter, S source, T target)
+            throws Exception {
         assertTrue(label + " can convert", converter.canConvert(source.getClass(), target.getClass()));
         assertEquals(label + " converted", target, converter.convert(source));
     }
@@ -48,7 +47,8 @@ public class DateTimeTests {
         java.sql.Timestamp timestamp = new java.sql.Timestamp(longTime);
         // Source class = java.util.Date
         assertConversion("DateToLong", new DateTimeConverters.DateToLong(), utilDate, longTime);
-        assertConversion("DateToSqlDate", new DateTimeConverters.DateToSqlDate(), utilDate, new java.sql.Date(longTime));
+        assertConversion("DateToSqlDate", new DateTimeConverters.DateToSqlDate(), utilDate,
+                new java.sql.Date(longTime));
         assertConversion("DateToString", new DateTimeConverters.DateToString(), utilDate, utilDate.toString());
         assertConversion("DateToTimestamp", new DateTimeConverters.DateToTimestamp(), utilDate, timestamp);
         // Source class = java.sql.Date
@@ -60,13 +60,16 @@ public class DateTimeTests {
         assertConversion("TimestampToLong", new DateTimeConverters.DateToLong(), timestamp, longTime);
         assertConversion("TimestampToDate", new DateTimeConverters.TimestampToDate(), timestamp, utilDate);
         assertConversion("TimestampToSqlDate", new DateTimeConverters.TimestampToSqlDate(), timestamp, sqlDate);
-        assertConversion("TimestampToString", new DateTimeConverters.TimestampToString(), timestamp, timestamp.toString());
+        assertConversion("TimestampToString", new DateTimeConverters.TimestampToString(), timestamp,
+                timestamp.toString());
         // Source class = java.lang.Long
         assertConversion("LongToDate", new DateTimeConverters.NumberToDate(), longTime, utilDate);
         assertConversion("LongToSqlDate", new DateTimeConverters.NumberToSqlDate(), longTime, sqlDate);
-        assertConversion("LongToSqlDate", new DateTimeConverters.NumberToSqlDate(), currentTime, sqlDate); //Test conversion to start of day
+        //Test conversion to start of day
+        assertConversion("LongToSqlDate", new DateTimeConverters.NumberToSqlDate(), currentTime, sqlDate);
         assertConversion("LongToTimestamp", new DateTimeConverters.NumberToTimestamp(), longTime, timestamp);
         // Source class = java.lang.String
-        assertConversion("StringToTimestamp", new DateTimeConverters.StringToTimestamp(), timestamp.toString(), timestamp);
+        assertConversion("StringToTimestamp", new DateTimeConverters.StringToTimestamp(), timestamp.toString(),
+                timestamp);
     }
 }

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/conversion/MiscTests.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/conversion/MiscTests.java?rev=1869037&r1=1869036&r2=1869037&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/conversion/MiscTests.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/conversion/MiscTests.java Sun Oct 27 12:51:08 2019
@@ -29,16 +29,13 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.ofbiz.base.conversion.Converter;
-import org.apache.ofbiz.base.conversion.ConverterLoader;
-import org.apache.ofbiz.base.conversion.Converters;
 import org.apache.ofbiz.base.util.UtilGenerics;
 import org.apache.ofbiz.base.util.UtilMisc;
 import org.junit.Test;
 
 public class MiscTests {
 
-    public static class ConverterLoaderImpl implements ConverterLoader {
+    public static final class ConverterLoaderImpl implements ConverterLoader {
         @Override
         public void loadConverters() {
             throw new RuntimeException();
@@ -54,7 +51,8 @@ public class MiscTests {
         assertPassThru(wanted, sourceClass, sourceClass);
     }
 
-    public static <S> void assertPassThru(Object wanted, Class<S> sourceClass, Class<? super S> targetClass) throws Exception {
+    public static <S> void assertPassThru(Object wanted, Class<S> sourceClass, Class<? super S> targetClass)
+            throws Exception {
         Converter<S, ? super S> converter = Converters.getConverter(sourceClass, targetClass);
         Object result = converter.convert(UtilGenerics.<S>cast(wanted));
         assertEquals("pass thru convert", wanted, result);

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/conversion/TestBooleanConverters.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/conversion/TestBooleanConverters.java?rev=1869037&r1=1869036&r2=1869037&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/conversion/TestBooleanConverters.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/conversion/TestBooleanConverters.java Sun Oct 27 12:51:08 2019
@@ -25,10 +25,6 @@ import java.util.Collection;
 import java.util.List;
 import java.util.Set;
 
-import org.apache.ofbiz.base.conversion.BooleanConverters;
-import org.apache.ofbiz.base.conversion.Converter;
-import org.apache.ofbiz.base.conversion.ConverterLoader;
-import org.apache.ofbiz.base.conversion.Converters;
 import org.apache.ofbiz.base.util.UtilGenerics;
 import org.junit.Test;
 

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/conversion/TestJSONConverters.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/conversion/TestJSONConverters.java?rev=1869037&r1=1869036&r2=1869037&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/conversion/TestJSONConverters.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/conversion/TestJSONConverters.java Sun Oct 27 12:51:08 2019
@@ -39,9 +39,10 @@ public class TestJSONConverters {
 
     @Test
     public void testJSONToMap() throws Exception {
-        Converter<JSON, Map<String,String>> converter =
+        Converter<JSON, Map<String, String>> converter =
                 UtilGenerics.cast(Converters.getConverter(JSON.class, Map.class));
-        Map<String,String> map, convertedMap;
+        Map<String, String> map;
+        Map<String, String> convertedMap;
         map = new HashMap<>();
         map.put("field1", "value1");
         JSON json = JSON.from(map);
@@ -53,22 +54,21 @@ public class TestJSONConverters {
     @Test
     public void testJSONToList() throws Exception {
         Converter<JSON, List<Object>> converter = UtilGenerics.cast(Converters.getConverter(JSON.class, List.class));
-        List<Object> list, convertedList;
-        list = new ArrayList<>();
+        List<Object> list = new ArrayList<>();
         list.add("field1");
         list.add("field2");
         JSON json = JSON.from(list);
         Object obj = converter.convert(json);
-        convertedList = (obj instanceof List) ? UtilGenerics.cast(obj) : null;
+        List<Object> convertedList = (obj instanceof List) ? UtilGenerics.cast(obj) : null;
         assertEquals("JSON to List", list, convertedList);
     }
 
     @Test
     public void testMapToJSON() throws Exception {
-        Converter<Map<String,Object>, JSON> converter =
+        Converter<Map<String, Object>, JSON> converter =
                 UtilGenerics.cast(Converters.getConverter(Map.class, JSON.class));
         JSON json;
-        Map<String,Object> map = new LinkedHashMap<>();
+        Map<String, Object> map = new LinkedHashMap<>();
         map.put("field1", "value1");
         map.put("field2", new BigDecimal("3.7"));
         json = converter.convert(map);

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/lang/ComparableRangeTests.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/lang/ComparableRangeTests.java?rev=1869037&r1=1869036&r2=1869037&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/lang/ComparableRangeTests.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/lang/ComparableRangeTests.java Sun Oct 27 12:51:08 2019
@@ -27,18 +27,19 @@ import static org.junit.Assert.assertNot
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
-import org.apache.ofbiz.base.lang.ComparableRange;
 import org.apache.ofbiz.base.util.UtilGenerics;
 import org.junit.Test;
 
 public class ComparableRangeTests {
 
-    private static <L extends Comparable<L>, R extends Comparable<R>> void comparableRangeConstructorTest(L left, R right) {
+    private static <L extends Comparable<L>, R extends Comparable<R>> void comparableRangeConstructorTest(L left,
+            R right) {
         new ComparableRange<>(left, left);
         new ComparableRange<>(right, right);
     }
 
-    private static <T extends Comparable<T>, B extends Comparable<B>> void comparableRangeTest(String label, B bad, T a, T b, T c, T d) {
+    private static <T extends Comparable<T>, B extends Comparable<B>> void comparableRangeTest(String label, B bad,
+            T a, T b, T c, T d) {
         comparableRangeConstructorTest(bad, a);
         assertTrue(label + ":a-isPoint", new ComparableRange<>(a, a).isPoint());
         assertTrue(label + ":b-isPoint", new ComparableRange<>(b, b).isPoint());

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/test/BaseUnitTests.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/test/BaseUnitTests.java?rev=1869037&r1=1869036&r2=1869037&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/test/BaseUnitTests.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/test/BaseUnitTests.java Sun Oct 27 12:51:08 2019
@@ -48,43 +48,43 @@ public class BaseUnitTests {
     }
 
     @Test
-    public void testFormatPrintableCreditCard_1() {
+    public void testFormatPrintableCreditCard1() {
         assertEquals("test 4111111111111111 to ************111",
                 "************1111",
                 UtilFormatOut.formatPrintableCreditCard("4111111111111111"));
     }
 
     @Test
-    public void testFormatPrintableCreditCard_2() {
+    public void testFormatPrintableCreditCard2() {
         assertEquals("test 4111 to 4111",
                 "4111",
                 UtilFormatOut.formatPrintableCreditCard("4111"));
     }
 
     @Test
-    public void testFormatPrintableCreditCard_3() {
+    public void testFormatPrintableCreditCard3() {
         assertEquals("test null to null",
                 null,
                 UtilFormatOut.formatPrintableCreditCard(null));
     }
 
     @Test
-    public void testIsDouble_1() {
+    public void testIsDouble1() {
         assertFalse(UtilValidate.isDouble("10.0", true, true, 2, 2));
     }
 
     @Test
-    public void testIsFloat_1() {
+    public void testIsFloat1() {
         assertFalse(UtilValidate.isFloat("10.0", true, true, 2, 2));
     }
 
     @Test
-    public void testIsDouble_2() {
+    public void testIsDouble2() {
         assertTrue(UtilValidate.isDouble("10.000", true, true, 3, 3));
     }
 
     @Test
-    public void testIsFloat_2() {
+    public void testIsFloat2() {
         assertTrue(UtilValidate.isFloat("10.000", true, true, 3, 3));
     }
 

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/AssertTests.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/AssertTests.java?rev=1869037&r1=1869036&r2=1869037&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/AssertTests.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/AssertTests.java Sun Oct 27 12:51:08 2019
@@ -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.
@@ -29,12 +29,12 @@ import org.junit.Test;
  * Assert tests {@link org.apache.ofbiz.base.util.Assert}.
  */
 public class AssertTests {
-    public static final String module = AssertTests.class.getName();
+    private static final String MODULE = AssertTests.class.getName();
 
-    @Test
-    public void testAssert(){
-        Object testObject = new Object();
+    private Object testObject = new Object();
 
+    @Test
+    public void testAssertNullOrEmpty() {
         //-----------------------------------------------------------------------
         try {
             Assert.notNull("foo", testObject);
@@ -45,10 +45,9 @@ public class AssertTests {
             Assert.notNull("foo", null);
             fail("notNull - IllegalArgumentException not thrown");
         } catch (IllegalArgumentException e) {
-            Debug.logError(e, module);
+            Debug.logError(e, MODULE);
         }
 
-
         //-----------------------------------------------------------------------
         try {
             Assert.notNull("foo", testObject, "bar", testObject);
@@ -59,10 +58,9 @@ public class AssertTests {
             Assert.notNull("foo", testObject, "bar", null);
             fail("notNull (argument list) - IllegalArgumentException not thrown");
         } catch (IllegalArgumentException e) {
-            Debug.logError(e, module);
+            Debug.logError(e, MODULE);
         }
 
-
         //-----------------------------------------------------------------------
         try {
             Assert.notEmpty("foo", "foo");
@@ -73,10 +71,9 @@ public class AssertTests {
             Assert.notEmpty("foo", "");
             fail("notEmpty(String) - IllegalArgumentException not thrown");
         } catch (IllegalArgumentException e) {
-            Debug.logError(e, module);
+            Debug.logError(e, MODULE);
         }
 
-
         //-----------------------------------------------------------------------
         String[] strArray = {"foo", "bar"};
         try {
@@ -88,17 +85,16 @@ public class AssertTests {
             Assert.notEmpty("foo", new String[0]);
             fail("notEmpty(Array) - IllegalArgumentException not thrown");
         } catch (IllegalArgumentException e) {
-            Debug.logError(e, module);
+            Debug.logError(e, MODULE);
         }
 
-
         //-----------------------------------------------------------------------
         List<String> strList = new ArrayList<>();
         try {
             Assert.notEmpty("foo", strList);
             fail("notEmpty(Collection) - IllegalArgumentException not thrown");
         } catch (IllegalArgumentException e) {
-            Debug.logError(e, module);
+            Debug.logError(e, MODULE);
         }
 
         strList.add("foo");
@@ -109,12 +105,12 @@ public class AssertTests {
         }
 
         //-----------------------------------------------------------------------
-        Map<String,String> strMap = new HashMap<>();
+        Map<String, String> strMap = new HashMap<>();
         try {
             Assert.notEmpty("foo", strMap);
             fail("notEmpty(Map) - IllegalArgumentException not thrown");
         } catch (IllegalArgumentException e) {
-            Debug.logError(e, module);
+            Debug.logError(e, MODULE);
         }
 
         strMap.put("foo", "foo");
@@ -123,7 +119,12 @@ public class AssertTests {
         } catch (Exception e) {
             fail("notEmpty(Map) threw an exception - " + e);
         }
+    }
 
+    @Test
+    public void testAssertInstance() {
+        Map<String, String> strMap = new HashMap<>();
+        strMap.put("foo", "foo");
         //-----------------------------------------------------------------------
         try {
             Assert.isInstanceOf("foo", strMap, Map.class);
@@ -134,10 +135,9 @@ public class AssertTests {
             Assert.isInstanceOf("foo", strMap, AssertTests.class);
             fail("isInstanceOf - IllegalArgumentException not thrown");
         } catch (IllegalArgumentException e) {
-            Debug.logError(e, module);
+            Debug.logError(e, MODULE);
         }
 
-
         //-----------------------------------------------------------------------
         try {
             Assert.isInstanceOf("foo", strMap, String.class, Map.class);
@@ -148,10 +148,9 @@ public class AssertTests {
             Assert.isInstanceOf("foo", strMap, String.class, AssertTests.class);
             fail("isInstanceOf (argument list) - IllegalArgumentException not thrown");
         } catch (IllegalArgumentException e) {
-            Debug.logError(e, module);
+            Debug.logError(e, MODULE);
         }
 
-
         //-----------------------------------------------------------------------
         try {
             Assert.isNotInstanceOf("foo", strMap, String.class);
@@ -162,10 +161,9 @@ public class AssertTests {
             Assert.isNotInstanceOf("foo", strMap, Map.class);
             fail("isNotInstanceOf - IllegalArgumentException not thrown");
         } catch (IllegalArgumentException e) {
-            Debug.logError(e, module);
+            Debug.logError(e, MODULE);
         }
 
-
         //-----------------------------------------------------------------------
         try {
             Assert.isNotInstanceOf("foo", strMap, String.class, AssertTests.class);
@@ -176,10 +174,13 @@ public class AssertTests {
             Assert.isNotInstanceOf("foo", strMap, String.class, Map.class);
             fail("isNotInstanceOf (argument list) - IllegalArgumentException not thrown");
         } catch (IllegalArgumentException e) {
-            Debug.logError(e, module);
+            Debug.logError(e, MODULE);
         }
+    }
 
-
+    @Test
+    public void testAssertAssignable() {
+        String[] strArray = {"foo", "bar"};
         //-----------------------------------------------------------------------
         try {
             Assert.isAssignableTo("foo", strArray, strArray.getClass());
@@ -190,8 +191,7 @@ public class AssertTests {
             Assert.isAssignableTo("foo", strArray, Map[].class);
             fail("isNotInstanceOf (argument list) - IllegalArgumentException not thrown");
         } catch (IllegalArgumentException e) {
-            Debug.logError(e, module);
+            Debug.logError(e, MODULE);
         }
-
     }
 }

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/IndentingWriterTests.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/IndentingWriterTests.java?rev=1869037&r1=1869036&r2=1869037&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/IndentingWriterTests.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/IndentingWriterTests.java Sun Oct 27 12:51:08 2019
@@ -23,7 +23,6 @@ import static org.junit.Assert.assertSam
 
 import java.io.StringWriter;
 
-import org.apache.ofbiz.base.util.IndentingWriter;
 import org.junit.Test;
 
 public class IndentingWriterTests {

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/ObjectTypeTests.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/ObjectTypeTests.java?rev=1869037&r1=1869036&r2=1869037&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/ObjectTypeTests.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/ObjectTypeTests.java Sun Oct 27 12:51:08 2019
@@ -37,20 +37,13 @@ import java.util.Map;
 import java.util.Set;
 import java.util.TimeZone;
 
-import org.apache.ofbiz.base.util.GeneralException;
-import org.apache.ofbiz.base.util.ObjectType;
-import org.apache.ofbiz.base.util.TimeDuration;
-import org.apache.ofbiz.base.util.UtilDateTime;
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.base.util.UtilXml;
 import org.junit.Test;
 import org.w3c.dom.Document;
 
 import com.ibm.icu.util.Calendar;
 
 public class ObjectTypeTests {
-    public static final String module = ObjectTypeTests.class.getName();
-    private static final LocaleData localeData = new LocaleData("en_US", "Pacific/Wake", "fr", "GMT");
+    private static final LocaleData LOCALE_DATA = new LocaleData("en_US", "Pacific/Wake", "fr", "GMT");
     private final TimeDuration duration = new TimeDuration(0, 0, 0, 1, 1, 1, 1);
     // These numbers are all based on 1 / 128, which is a binary decimal
     // that can be represented by both float and double
@@ -80,17 +73,17 @@ public class ObjectTypeTests {
         map.put("two", "2");
         map.put("three", "3");
         set = new LinkedHashSet<>(list);
-        Calendar cal = UtilDateTime.getCalendarInstance(localeData.goodTimeZone, localeData.goodLocale);
+        Calendar cal = UtilDateTime.getCalendarInstance(LOCALE_DATA.goodTimeZone, LOCALE_DATA.goodLocale);
         cal.set(1969, Calendar.DECEMBER, 31, 0, 0, 0);
         cal.set(Calendar.MILLISECOND, 0);
         sqlDt = new java.sql.Date(cal.getTimeInMillis());
     }
 
     public static class LocaleData {
-        public final Locale goodLocale;
-        public final TimeZone goodTimeZone;
-        public final Locale badLocale;
-        public final TimeZone badTimeZone;
+        private final Locale goodLocale;
+        private final TimeZone goodTimeZone;
+        private final Locale badLocale;
+        private final TimeZone badTimeZone;
 
         public LocaleData(String goodLocale, String goodTimeZone, String badLocale, String badTimeZone) {
             this.goodLocale = UtilMisc.parseLocale(goodLocale);
@@ -317,55 +310,55 @@ public class ObjectTypeTests {
         simpleTypeOrObjectConvertTestMultiMulti("String->Boolean(false)", new String[] {"false", " false ", " FaLsE"},
                 new String[] {"Boolean", "java.lang.Boolean"}, Boolean.FALSE);
         simpleTypeOrObjectConvertTestSingleMulti("String->Locale", "en_us", new String[] {"Locale", "java.util.Locale"},
-                localeData.goodLocale);
+                LOCALE_DATA.goodLocale);
         simpleTypeOrObjectConvertTestError("String->error-Locale", "o", new String[] {"Locale", "java.util.Locale"});
         // TZ can never be null, will default to GMT if it can't be parsed(from the javadocs of java.util.TimeZone)
         simpleTypeOrObjectConvertTestSingleMulti("String->TimeZone", "Pacific/Wake",
-                new String[] {"TimeZone", "java.util.TimeZone"}, localeData.goodTimeZone);
+                new String[] {"TimeZone", "java.util.TimeZone"}, LOCALE_DATA.goodTimeZone);
         simpleTypeOrObjectConvertTestSingleMulti("String->BigDecimal", "78,125E-2",
-                new String[] {"BigDecimal", "java.math.BigDecimal"}, null, localeData, dcml);
+                new String[] {"BigDecimal", "java.math.BigDecimal"}, null, LOCALE_DATA, dcml);
         simpleTypeOrObjectConvertTestError("String->error-BigDecimal", "o",
                 new String[] {"BigDecimal", "java.math.BigDecimal"});
         simpleTypeOrObjectConvertTestSingleMulti("String->Double", "78,125E-2",
-                new String[] {"Double", "java.lang.Double"}, null, localeData, dbl);
+                new String[] {"Double", "java.lang.Double"}, null, LOCALE_DATA, dbl);
         simpleTypeOrObjectConvertTestError("String->error-Double", "o",
                 new String[] {"Double", "java.lang.Double"});
         simpleTypeOrObjectConvertTestSingleMulti("String->Float", "78,125E-2",
-                new String[] {"Float", "java.lang.Float"}, null, localeData, flt);
+                new String[] {"Float", "java.lang.Float"}, null, LOCALE_DATA, flt);
         simpleTypeOrObjectConvertTestError("String->error-Float", "o", new String[] {"Float", "java.lang.Float"});
         simpleTypeOrObjectConvertTestSingleMulti("String->Long", "78,125E-2",
-                new String[] {"Long", "java.lang.Long"}, null, localeData, lng);
+                new String[] {"Long", "java.lang.Long"}, null, LOCALE_DATA, lng);
         simpleTypeOrObjectConvertTestError("String->error-Long", "o", new String[] {"Long", "java.lang.Long"});
         simpleTypeOrObjectConvertTestSingleMulti("String->Integer", "78,125E-2",
-                new String[] {"Integer", "java.lang.Integer"}, null, localeData, intg);
+                new String[] {"Integer", "java.lang.Integer"}, null, LOCALE_DATA, intg);
         simpleTypeOrObjectConvertTestError("String->error-Integer", "o",
                 new String[] {"Integer", "java.lang.Integer"});
 
         simpleTypeOrObjectConvertTestSingleMulti("String->java.sql.Date", "1969-12-31",
-                new String[] {"Date", "java.sql.Date"}, null, localeData, sqlDt);
+                new String[] {"Date", "java.sql.Date"}, null, LOCALE_DATA, sqlDt);
         simpleTypeOrObjectConvertTestSingleMulti("String->java.sql.Date", "1969-12-31",
-                new String[] {"Date", "java.sql.Date"}, "", localeData, sqlDt);
+                new String[] {"Date", "java.sql.Date"}, "", LOCALE_DATA, sqlDt);
         simpleTypeOrObjectConvertTestSingleMulti("String->java.sql.Date", "12-31-1969",
-                new String[] {"Date", "java.sql.Date"}, "MM-dd-yyyy", localeData, sqlDt);
+                new String[] {"Date", "java.sql.Date"}, "MM-dd-yyyy", LOCALE_DATA, sqlDt);
         simpleTypeOrObjectConvertTestError("String->error-java.sql.Date", "o",
                 new String[] {"Date", "java.sql.Date"});
         simpleTypeOrObjectConvertTestSingleMulti("String->java.sql.Time", "12:34:56",
-                new String[] {"Time", "java.sql.Time"}, null, localeData, sqlTm);
+                new String[] {"Time", "java.sql.Time"}, null, LOCALE_DATA, sqlTm);
         simpleTypeOrObjectConvertTestSingleMulti("String->java.sql.Time", "12:34:56",
-                new String[] {"Time", "java.sql.Time"}, "", localeData, sqlTm);
+                new String[] {"Time", "java.sql.Time"}, "", LOCALE_DATA, sqlTm);
         simpleTypeOrObjectConvertTestSingleMulti("String->java.sql.Time", "563412",
-                new String[] {"Time", "java.sql.Time"}, "ssmmHH", localeData, sqlTm);
+                new String[] {"Time", "java.sql.Time"}, "ssmmHH", LOCALE_DATA, sqlTm);
         simpleTypeOrObjectConvertTestError("String->error-java.sql.Time", "o",
                 new String[] {"Time", "java.sql.Time"});
         simpleTypeOrObjectConvertTestSingleMulti("String->Timestamp", "1970-01-01 12:00:00.123",
-                new String[] {"Timestamp", "java.sql.Timestamp"}, null, localeData, ntstmp);
+                new String[] {"Timestamp", "java.sql.Timestamp"}, null, LOCALE_DATA, ntstmp);
         simpleTypeOrObjectConvertTestSingleMulti("String->Timestamp", "1970-01-01 12:00:00.123",
-                new String[] {"Timestamp", "java.sql.Timestamp"}, "", localeData, ntstmp);
+                new String[] {"Timestamp", "java.sql.Timestamp"}, "", LOCALE_DATA, ntstmp);
         simpleTypeOrObjectConvertTestSingleMulti("String->Timestamp", "01-01-1970 12:00:00/123",
-                new String[] {"Timestamp", "java.sql.Timestamp"}, "dd-MM-yyyy HH:mm:ss/SSS", localeData, ntstmp);
+                new String[] {"Timestamp", "java.sql.Timestamp"}, "dd-MM-yyyy HH:mm:ss/SSS", LOCALE_DATA, ntstmp);
         simpleTypeOrObjectConvertTestMultiMulti("String->Timestamp",
                 new String[] {"1970-01-01", "1970-01-01 00:00:00", "1970-01-01 00:00:00.0", "1970-01-01 00:00:00.000"},
-                new String[] {"Timestamp", "java.sql.Timestamp"}, null, localeData, new Timestamp(-43200000));
+                new String[] {"Timestamp", "java.sql.Timestamp"}, null, LOCALE_DATA, new Timestamp(-43200000));
         simpleTypeOrObjectConvertTestError("String->error-Timestamp", "o",
                 new String[] {"Timestamp", "java.sql.Timestamp"});
         simpleTypeOrObjectConvertTestSingleMulti("String->List", "[one, two, three]",
@@ -387,7 +380,7 @@ public class ObjectTypeTests {
         simpleTypeOrObjectConvertTestError("String->Map(error-2)", "one=1, two=2, three=3}",
                 new String[] {"Map", "java.util.Map"});
         simpleTypeOrObjectConvertTestSingleMulti("String->TimeDuration(number)", "3,661,001",
-                new String[] {"TimeDuration", "org.apache.ofbiz.base.util.TimeDuration"}, null, localeData, duration);
+                new String[] {"TimeDuration", "org.apache.ofbiz.base.util.TimeDuration"}, null, LOCALE_DATA, duration);
         simpleTypeOrObjectConvertTestMultiMulti("String->TimeDuration(string)", new String[] {"1:1:1:1"},
                 new String[] {"TimeDuration", "org.apache.ofbiz.base.util.TimeDuration"}, duration);
         simpleTypeOrObjectConvertTestError("String->error-TimeDuration", "o",
@@ -397,11 +390,11 @@ public class ObjectTypeTests {
     @Test
     public void testDouble() throws GeneralException {
         simpleTypeOrObjectConvertTestSingleMulti("Double->String", Double.valueOf("1234567"),
-                new String[] {"String", "java.lang.String"}, null, localeData, "1,234,567");
+                new String[] {"String", "java.lang.String"}, null, LOCALE_DATA, "1,234,567");
         simpleTypeOrObjectConvertTestSingleMulti("Double->BigDecimal", dbl,
                 new String[] {"BigDecimal", "java.math.BigDecimal"}, dcml);
         simpleTypeOrObjectConvertTestSingleMulti("Double->Double", dbl,
-                new String[] {"Double", "java.lang.Double"},  Double.valueOf("781.25"));
+                new String[] {"Double", "java.lang.Double"}, Double.valueOf("781.25"));
         simpleTypeOrObjectConvertTestSingleMulti("Double->Float", dbl,
                 new String[] {"Float", "java.lang.Float"}, flt);
         simpleTypeOrObjectConvertTestSingleMulti("Double->Long", dbl,
@@ -421,7 +414,7 @@ public class ObjectTypeTests {
     public void testFloat() throws GeneralException {
         // does not support to java.lang variants
         simpleTypeOrObjectConvertTestSingleMulti("Float->String", Float.valueOf("1234567"), new String[] {"String"},
-                null, localeData, "1,234,567");
+                null, LOCALE_DATA, "1,234,567");
         simpleTypeOrObjectConvertTestSingleMulti("Float->BigDecimal", flt,
                 new String[] {"BigDecimal", "java.math.BigDecimal"}, dcml);
         simpleTypeOrObjectConvertTestSingleMulti("Float->Double", flt,
@@ -444,15 +437,15 @@ public class ObjectTypeTests {
     @Test
     public void testLong() throws GeneralException {
         simpleTypeOrObjectConvertTestSingleMulti("Long->String", Long.valueOf("1234567"),
-                new String[] {"String", "java.lang.String"}, null, localeData, "1,234,567");
+                new String[] {"String", "java.lang.String"}, null, LOCALE_DATA, "1,234,567");
         simpleTypeOrObjectConvertTestSingleMulti("Long->BigDecimal", lng,
                 new String[] {"BigDecimal", "java.math.BigDecimal"}, new BigDecimal("781"));
         simpleTypeOrObjectConvertTestSingleMulti("Long->Double", lng,
-                new String[] { "Double", "java.lang.Double" }, Double.valueOf("781"));
+                new String[] {"Double", "java.lang.Double"}, Double.valueOf("781"));
         simpleTypeOrObjectConvertTestSingleMulti("Long->Float", lng,
-                new String[] { "Float", "java.lang.Float" }, Float.valueOf("781"));
+                new String[] {"Float", "java.lang.Float"}, Float.valueOf("781"));
         simpleTypeOrObjectConvertTestSingleMulti("Long->Long", lng,
-                new String[] { "Long", "java.lang.Long" }, Long.valueOf("781"));
+                new String[] {"Long", "java.lang.Long"}, Long.valueOf("781"));
         simpleTypeOrObjectConvertTestSingleMulti("Long->Integer", lng,
                 new String[] {"Integer", "java.lang.Integer"}, intg);
         simpleTypeOrObjectConvertTestSingleMulti("Long->List", lng,
@@ -471,13 +464,13 @@ public class ObjectTypeTests {
     @Test
     public void testInteger() throws GeneralException {
         simpleTypeOrObjectConvertTestSingleMulti("Integer->String", Integer.valueOf("1234567"),
-                new String[] {"String", "java.lang.String"}, null, localeData, "1,234,567");
+                new String[] {"String", "java.lang.String"}, null, LOCALE_DATA, "1,234,567");
         simpleTypeOrObjectConvertTestSingleMulti("Integer->BigDecimal", intg,
                 new String[] {"BigDecimal", "java.math.BigDecimal"}, new BigDecimal("781"));
         simpleTypeOrObjectConvertTestSingleMulti("Integer->Double", intg,
-                new String[] { "Double", "java.lang.Double" }, Double.valueOf("781"));
+                new String[] {"Double", "java.lang.Double"}, Double.valueOf("781"));
         simpleTypeOrObjectConvertTestSingleMulti("Integer->Float", intg,
-                new String[] { "Float", "java.lang.Float" }, Float.valueOf("781"));
+                new String[] {"Float", "java.lang.Float"}, Float.valueOf("781"));
         simpleTypeOrObjectConvertTestSingleMulti("Integer->Long", intg,
                 new String[] {"Long", "java.lang.Long"}, lng);
         simpleTypeOrObjectConvertTestSingleMulti("Integer->Integer", intg,
@@ -494,7 +487,7 @@ public class ObjectTypeTests {
     @Test
     public void testBigDecimal() throws GeneralException {
         simpleTypeOrObjectConvertTestSingleMulti("BigDecimal->String", new BigDecimal("12345.67"),
-                new String[] {"String", "java.lang.String"}, null, localeData, "12,345.67");
+                new String[] {"String", "java.lang.String"}, null, LOCALE_DATA, "12,345.67");
         simpleTypeOrObjectConvertTestSingleMulti("BigDecimal->BigDecimal", dcml,
                 new String[] {"BigDecimal", "java.math.BigDecimal"}, new BigDecimal("781.25"));
         simpleTypeOrObjectConvertTestSingleMulti("BigDecimal->Double", dcml,
@@ -517,11 +510,11 @@ public class ObjectTypeTests {
     @Test
     public void testSqlDate() throws GeneralException {
         simpleTypeOrObjectConvertTestSingleMulti("SqlDate->String", sqlDt,
-                new String[] {"String", "java.lang.String"}, null, localeData, "1969-12-31");
+                new String[] {"String", "java.lang.String"}, null, LOCALE_DATA, "1969-12-31");
         simpleTypeOrObjectConvertTestSingleMulti("SqlDate->String", sqlDt,
-                new String[] {"String", "java.lang.String"}, "", localeData, "1969-12-31");
+                new String[] {"String", "java.lang.String"}, "", LOCALE_DATA, "1969-12-31");
         simpleTypeOrObjectConvertTestSingleMulti("SqlDate->String", sqlDt,
-                new String[] {"String", "java.lang.String"}, "dd-MM-yyyy", localeData, "31-12-1969");
+                new String[] {"String", "java.lang.String"}, "dd-MM-yyyy", LOCALE_DATA, "31-12-1969");
         simpleTypeOrObjectConvertTestSingleMulti("SqlDate->SqlDate", sqlDt,
                 new String[] {"Date", "java.sql.Date"}, new java.sql.Date(-129600000));
         simpleTypeOrObjectConvertTestSingleMulti("SqlDate->Timestamp", sqlDt,
@@ -539,11 +532,11 @@ public class ObjectTypeTests {
     @Test
     public void testSqlTime() throws GeneralException {
         simpleTypeOrObjectConvertTestSingleMulti("SqlTime->String", sqlTm,
-                new String[] {"String", "java.lang.String"}, null, localeData, "12:34:56");
+                new String[] {"String", "java.lang.String"}, null, LOCALE_DATA, "12:34:56");
         simpleTypeOrObjectConvertTestSingleMulti("SqlTime->String", sqlTm,
-                new String[] {"String", "java.lang.String"}, "", localeData, "12:34:56");
+                new String[] {"String", "java.lang.String"}, "", LOCALE_DATA, "12:34:56");
         simpleTypeOrObjectConvertTestSingleMulti("SqlTime->String", sqlTm,
-                new String[] {"String", "java.lang.String"}, "ss:mm:HH", localeData, "56:34:12");
+                new String[] {"String", "java.lang.String"}, "ss:mm:HH", LOCALE_DATA, "56:34:12");
         simpleTypeOrObjectConvertTestSingleMulti("SqlTime->SqlTime", sqlTm,
                 new String[] {"Time", "java.sql.Time"}, new java.sql.Time(2096000));
         simpleTypeOrObjectConvertTestSingleMulti("SqlTime->Timestamp", sqlTm,
@@ -559,11 +552,11 @@ public class ObjectTypeTests {
     @Test
     public void testTimestamp() throws GeneralException {
         simpleTypeOrObjectConvertTestSingleMulti("Timestamp->String", tstmp,
-                new String[] {"String", "java.lang.String"}, null, localeData, "1970-01-01 12:00:00.781");
+                new String[] {"String", "java.lang.String"}, null, LOCALE_DATA, "1970-01-01 12:00:00.781");
         simpleTypeOrObjectConvertTestSingleMulti("Timestamp->String", tstmp,
-                new String[] {"String", "java.lang.String"}, "", localeData, "1970-01-01 12:00:00.781");
+                new String[] {"String", "java.lang.String"}, "", LOCALE_DATA, "1970-01-01 12:00:00.781");
         simpleTypeOrObjectConvertTestSingleMulti("Timestamp->String", tstmp,
-                new String[] {"String", "java.lang.String"}, "dd-MM-yyyy HH:mm:ss/SSS", localeData,
+                new String[] {"String", "java.lang.String"}, "dd-MM-yyyy HH:mm:ss/SSS", LOCALE_DATA,
                 "01-01-1970 12:00:00/781");
         simpleTypeOrObjectConvertTestSingleMulti("Timestamp->Date", tstmp,
                 new String[] {"Date", "java.sql.Date"}, new java.sql.Date(781));
@@ -603,20 +596,20 @@ public class ObjectTypeTests {
 
     @Test
     public void testLocale() throws GeneralException {
-        simpleTypeOrObjectConvertTestSingleMulti("Locale->Locale", localeData.goodLocale,
-                new String[] {"Locale", "java.util.Locale"}, localeData.goodLocale);
-        simpleTypeOrObjectConvertTestSingleMulti("Locale->String", localeData.goodLocale,
-                new String[] {"String", "java.lang.String"}, localeData.goodLocale.toString());
-        simpleTypeOrObjectConvertTestError("Locale->error", localeData.goodLocale, new String[] {});
+        simpleTypeOrObjectConvertTestSingleMulti("Locale->Locale", LOCALE_DATA.goodLocale,
+                new String[] {"Locale", "java.util.Locale"}, LOCALE_DATA.goodLocale);
+        simpleTypeOrObjectConvertTestSingleMulti("Locale->String", LOCALE_DATA.goodLocale,
+                new String[] {"String", "java.lang.String"}, LOCALE_DATA.goodLocale.toString());
+        simpleTypeOrObjectConvertTestError("Locale->error", LOCALE_DATA.goodLocale, new String[] {});
     }
 
     @Test
     public void testTimeZone() throws GeneralException {
-        simpleTypeOrObjectConvertTestSingleMulti("TimeZone->TimeZone", localeData.goodTimeZone,
-                new String[] {"TimeZone", "java.util.TimeZone"}, localeData.goodTimeZone);
-        simpleTypeOrObjectConvertTestSingleMulti("TimeZone->String", localeData.goodTimeZone,
-                new String[] {"String", "java.lang.String"}, localeData.goodTimeZone.getID());
-        simpleTypeOrObjectConvertTestError("TimeZone->error", localeData.goodTimeZone, new String[] {});
+        simpleTypeOrObjectConvertTestSingleMulti("TimeZone->TimeZone", LOCALE_DATA.goodTimeZone,
+                new String[] {"TimeZone", "java.util.TimeZone"}, LOCALE_DATA.goodTimeZone);
+        simpleTypeOrObjectConvertTestSingleMulti("TimeZone->String", LOCALE_DATA.goodTimeZone,
+                new String[] {"String", "java.lang.String"}, LOCALE_DATA.goodTimeZone.getID());
+        simpleTypeOrObjectConvertTestError("TimeZone->error", LOCALE_DATA.goodTimeZone, new String[] {});
     }
 
 

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/ReferenceCleanerTests.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/ReferenceCleanerTests.java?rev=1869037&r1=1869036&r2=1869037&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/ReferenceCleanerTests.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/ReferenceCleanerTests.java Sun Oct 27 12:51:08 2019
@@ -28,7 +28,6 @@ import java.util.HashSet;
 import java.util.concurrent.SynchronousQueue;
 import java.util.concurrent.TimeUnit;
 
-import org.apache.ofbiz.base.util.ReferenceCleaner;
 import org.junit.Ignore;
 import org.junit.Test;
 

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/StringUtilTests.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/StringUtilTests.java?rev=1869037&r1=1869036&r2=1869037&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/StringUtilTests.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/StringUtilTests.java Sun Oct 27 12:51:08 2019
@@ -28,8 +28,6 @@ import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 
-import org.apache.ofbiz.base.util.GeneralRuntimeException;
-import org.apache.ofbiz.base.util.StringUtil;
 import org.junit.Test;
 
 public class StringUtilTests {
@@ -38,7 +36,8 @@ public class StringUtilTests {
     public void testInternString() {
         assertSame("intern-constant", StringUtil.internString("foo"), StringUtil.internString("foo"));
         assertSame("intern-new", StringUtil.internString("foo"), StringUtil.internString("foo"));
-        assertSame("intern-char", StringUtil.internString("foo"), StringUtil.internString(new String(new char[] {'f', 'o', 'o'})));
+        assertSame("intern-char", StringUtil.internString("foo"),
+                StringUtil.internString(new String(new char[] {'f', 'o', 'o'})));
         assertSame("intern-null", StringUtil.internString(null), StringUtil.internString(null));
     }
 
@@ -139,7 +138,8 @@ public class StringUtilTests {
     public void testCleanUpPathPrefix() {
         assertEquals("null", "", StringUtil.cleanUpPathPrefix(null));
         assertEquals("empty", "", StringUtil.cleanUpPathPrefix(""));
-        for (String s: new String[] {"\\a\\b\\c", "\\a\\b\\c\\", "a\\b\\c\\", "a\\b\\c", "/a/b/c", "/a/b/c/", "a/b/c/", "a/b/c"}) {
+        for (String s: new String[] {"\\a\\b\\c", "\\a\\b\\c\\",
+                "a\\b\\c\\", "a\\b\\c", "/a/b/c", "/a/b/c/", "a/b/c/", "a/b/c"}) {
             assertEquals("cleanup(" + s + ")", "/a/b/c", StringUtil.cleanUpPathPrefix(s));
         }
     }

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/TimeDurationTests.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/TimeDurationTests.java?rev=1869037&r1=1869036&r2=1869037&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/TimeDurationTests.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/TimeDurationTests.java Sun Oct 27 12:51:08 2019
@@ -22,33 +22,32 @@ import static org.junit.Assert.assertEqu
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotSame;
 
-import org.apache.ofbiz.base.util.TimeDuration;
 import org.junit.Test;
 
 import com.ibm.icu.util.Calendar;
 import com.ibm.icu.util.TimeZone;
 
 public class TimeDurationTests {
-    private static final Calendar zero = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
+    private static final Calendar ZERO = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
 
     static {
-        zero.clear();
-        zero.setTimeInMillis(0);
+        ZERO.clear();
+        ZERO.setTimeInMillis(0);
     }
 
     private static <T extends Comparable<T>> int doCompare(T comparable, T other) {
         return comparable.compareTo(other);
     }
 
-    private static void assertDurationFields(String label, int years, int months, int days, int hours, int minutes,
-            int seconds, int milliseconds, String string, TimeDuration duration, boolean isNegative, boolean isZero) {
-        assertEquals(label + ".years()", years, duration.years());
-        assertEquals(label + ".months()", months, duration.months());
-        assertEquals(label + ".days()", days, duration.days());
-        assertEquals(label + ".hours()", hours, duration.hours());
-        assertEquals(label + ".minutes()", minutes, duration.minutes());
-        assertEquals(label + ".seconds()", seconds, duration.seconds());
-        assertEquals(label + ".milliseconds()", milliseconds, duration.milliseconds());
+    private static void assertDurationFields(String label, DateTuple d, String string, TimeDuration duration,
+            boolean isNegative, boolean isZero) {
+        assertEquals(label + ".years()", d.years, duration.years());
+        assertEquals(label + ".months()", d.months, duration.months());
+        assertEquals(label + ".days()", d.days, duration.days());
+        assertEquals(label + ".hours()", d.hours, duration.hours());
+        assertEquals(label + ".minutes()", d.minutes, duration.minutes());
+        assertEquals(label + ".seconds()", d.seconds, duration.seconds());
+        assertEquals(label + ".milliseconds()", d.milliseconds, duration.milliseconds());
         assertEquals(label + ".isNegative()", isNegative, duration.isNegative());
         assertEquals(label + ".toString()", string, duration.toString());
         assertEquals(label + ".equals(from/to long)", duration, TimeDuration.fromLong(TimeDuration.toLong(duration)));
@@ -64,50 +63,71 @@ public class TimeDurationTests {
         }
     }
 
-    private static TimeDuration assertDurationLoop(String label, Calendar right, int years, int months, int days,
-            int hours, int minutes, int seconds, int milliseconds, TimeDuration lastString, boolean isNegative) {
+    private static final class DateTuple {
+        private final int years;
+        private final int months;
+        private final int days;
+        private final int hours;
+        private final int minutes;
+        private final int seconds;
+        private final int milliseconds;
+
+        private DateTuple(int years, int months, int days, int hours, int minutes, int seconds, int milliseconds) {
+            this.years = years;
+            this.months = months;
+            this.days = days;
+            this.hours = hours;
+            this.minutes = minutes;
+            this.seconds = seconds;
+            this.milliseconds = milliseconds;
+        }
+
+        static DateTuple of(int years, int months, int days, int hours, int minutes, int seconds, int milliseconds) {
+            return new DateTuple(years, months, days, hours, minutes, seconds, milliseconds);
+        }
+    }
+
+    private static TimeDuration assertDurationLoop(String label, Calendar right, DateTuple d, TimeDuration lastString,
+            boolean isNegative) {
         StringBuilder sb = new StringBuilder();
-        sb.append(years != 0 ? years : "");
-        sb.append(':').append(months != 0 ? months : "");
-        sb.append(':').append(days != 0 ? days : "");
-        sb.append(':').append(hours != 0 ? hours : "");
-        sb.append(':').append(minutes != 0 ? minutes : "");
-        sb.append(':').append(seconds != 0 ? seconds : "");
-        sb.append(':').append(milliseconds != 0 ? milliseconds : "");
-        String durationString =
-                years + ":" + months + ":" + days + ":" + hours + ":" + minutes + ":" + seconds + ":" + milliseconds;
+        sb.append(d.years != 0 ? d.years : "");
+        sb.append(':').append(d.months != 0 ? d.months : "");
+        sb.append(':').append(d.days != 0 ? d.days : "");
+        sb.append(':').append(d.hours != 0 ? d.hours : "");
+        sb.append(':').append(d.minutes != 0 ? d.minutes : "");
+        sb.append(':').append(d.seconds != 0 ? d.seconds : "");
+        sb.append(':').append(d.milliseconds != 0 ? d.milliseconds : "");
+        String durationString = d.years + ":" + d.months + ":" + d.days + ":"
+                + d.hours + ":" + d.minutes + ":" + d.seconds + ":" + d.milliseconds;
         TimeDuration stringDuration = TimeDuration.parseDuration(sb.toString());
         right.setTimeInMillis(0);
-        if (years != 0) {
-            right.set(Calendar.YEAR, 1970 + Math.abs(years));
+        if (d.years != 0) {
+            right.set(Calendar.YEAR, 1970 + Math.abs(d.years));
         }
-        if (months != 0) {
-            right.set(Calendar.MONTH, Math.abs(months));
+        if (d.months != 0) {
+            right.set(Calendar.MONTH, Math.abs(d.months));
         }
-        right.set(Calendar.DAY_OF_MONTH, Math.abs(days) + 1);
-        if (hours != 0) {
-            right.set(Calendar.HOUR, Math.abs(hours));
-        }
-        if (minutes != 0) {
-            right.set(Calendar.MINUTE, Math.abs(minutes));
-        }
-        if (seconds != 0) {
-            right.set(Calendar.SECOND, Math.abs(seconds));
-        }
-        if (milliseconds != 0) {
-            right.set(Calendar.MILLISECOND, Math.abs(milliseconds));
-        }
-        TimeDuration calDuration = isNegative ? new TimeDuration(right, zero) : new TimeDuration(zero, right);
-        assertDurationFields(label + "(parseString[0])", years, months, days, hours, minutes, seconds, milliseconds,
-                durationString, TimeDuration.parseDuration(durationString), isNegative, false);
-        assertDurationFields(label + "(parseString)", years, months, days, hours, minutes, seconds, milliseconds,
-                durationString, stringDuration, isNegative, false);
-        assertDurationFields(label + "(cal)", years, months, days, hours, minutes, seconds, milliseconds,
-                durationString, calDuration, isNegative, false);
-        Calendar added = calDuration.addToCalendar((Calendar) zero.clone());
-        TimeDuration addDuration = new TimeDuration(zero, added);
-        assertDurationFields(label + "(cal[add])", years, months, days, hours, minutes, seconds, milliseconds,
-                durationString, addDuration, isNegative, false);
+        right.set(Calendar.DAY_OF_MONTH, Math.abs(d.days) + 1);
+        if (d.hours != 0) {
+            right.set(Calendar.HOUR, Math.abs(d.hours));
+        }
+        if (d.minutes != 0) {
+            right.set(Calendar.MINUTE, Math.abs(d.minutes));
+        }
+        if (d.seconds != 0) {
+            right.set(Calendar.SECOND, Math.abs(d.seconds));
+        }
+        if (d.milliseconds != 0) {
+            right.set(Calendar.MILLISECOND, Math.abs(d.milliseconds));
+        }
+        TimeDuration calDuration = isNegative ? new TimeDuration(right, ZERO) : new TimeDuration(ZERO, right);
+        assertDurationFields(label + "(parseString[0])", d, durationString,
+                TimeDuration.parseDuration(durationString), isNegative, false);
+        assertDurationFields(label + "(parseString)", d, durationString, stringDuration, isNegative, false);
+        assertDurationFields(label + "(cal)", d, durationString, calDuration, isNegative, false);
+        Calendar added = calDuration.addToCalendar((Calendar) ZERO.clone());
+        TimeDuration addDuration = new TimeDuration(ZERO, added);
+        assertDurationFields(label + "(cal[add])", d, durationString, addDuration, isNegative, false);
         assertEquals(label + ".compareTo(string, cal)", 0, doCompare(stringDuration, calDuration));
         assertEquals(label + ".compareTo(string, string)", 0, doCompare(stringDuration, stringDuration));
         assertEquals(label + ".compareTo(cal, cal)", 0, doCompare(calDuration, calDuration));
@@ -122,18 +142,19 @@ public class TimeDurationTests {
         return stringDuration;
     }
 
-    public static void assertDuration(String label, int years, int months, int days, int hours, int minutes,
-            int seconds, int milliseconds) {
+    public static void assertDuration(String label, DateTuple d) {
         TimeDuration lastString = null;
-        Calendar right = (Calendar) zero.clone();
+        Calendar right = (Calendar) ZERO.clone();
         for (int i = 1; i < 12; i++) {
-            lastString = assertDurationLoop(i + " " + label, right, i * years, i * months, i * days, i * hours,
-                    i * minutes, i * seconds, i * milliseconds, lastString, false);
+            DateTuple nd = DateTuple.of(i * d.years, i * d.months, i * d.days,
+                    i * d.hours, i * d.minutes, i * d.seconds, i * d.milliseconds);
+            lastString = assertDurationLoop(i + " " + label, right, nd, lastString, false);
         }
         lastString = null;
         for (int i = -2; i > -12; i--) {
-            lastString = assertDurationLoop(i + " " + label, right, i * years, i * months, i * days, i * hours,
-                    i * minutes, i * seconds, i * milliseconds, lastString, true);
+            DateTuple nd = DateTuple.of(i * d.years, i * d.months, i * d.days,
+                    i * d.hours, i * d.minutes, i * d.seconds, i * d.milliseconds);
+            lastString = assertDurationLoop(i + " " + label, right, nd, lastString, true);
         }
     }
 
@@ -145,25 +166,25 @@ public class TimeDurationTests {
         Calendar newTime = (Calendar) now.clone();
         zeroDuration.addToCalendar(newTime);
         assertEquals("zero same calendar", now, newTime);
-        assertDurationFields("zero(same zero calendar)", 0, 0, 0, 0, 0, 0, 0, "0:0:0:0:0:0:0",
-                new TimeDuration(zero, zero), false, true);
-        assertDurationFields("zero(same now calendar)", 0, 0, 0, 0, 0, 0, 0, "0:0:0:0:0:0:0",
+        assertDurationFields("zero(same zero calendar)", DateTuple.of(0, 0, 0, 0, 0, 0, 0), "0:0:0:0:0:0:0",
+                new TimeDuration(ZERO, ZERO), false, true);
+        assertDurationFields("zero(same now calendar)", DateTuple.of(0, 0, 0, 0, 0, 0, 0), "0:0:0:0:0:0:0",
                 new TimeDuration(now, now), false, true);
-        assertDurationFields("zero(empty parse)", 0, 0, 0, 0, 0, 0, 0, "0:0:0:0:0:0:0",
+        assertDurationFields("zero(empty parse)", DateTuple.of(0, 0, 0, 0, 0, 0, 0), "0:0:0:0:0:0:0",
                 TimeDuration.parseDuration(""), false, true);
-        assertDurationFields("zero(zero parse)", 0, 0, 0, 0, 0, 0, 0, "0:0:0:0:0:0:0",
+        assertDurationFields("zero(zero parse)", DateTuple.of(0, 0, 0, 0, 0, 0, 0), "0:0:0:0:0:0:0",
                 TimeDuration.parseDuration("0:0:0:0:0:0:0"), false, true);
-        assertDurationFields("zero(from null number)", 0, 0, 0, 0, 0, 0, 0, "0:0:0:0:0:0:0",
+        assertDurationFields("zero(from null number)", DateTuple.of(0, 0, 0, 0, 0, 0, 0), "0:0:0:0:0:0:0",
                 TimeDuration.fromNumber(null), false, true);
-        assertDurationFields("zero(from null number)", 0, 0, 0, 0, 0, 0, 0, "0:0:0:0:0:0:0",
+        assertDurationFields("zero(from null number)", DateTuple.of(0, 0, 0, 0, 0, 0, 0), "0:0:0:0:0:0:0",
                 TimeDuration.fromNumber(null), false, true);
-        assertDuration("millisecond", 0, 0, 0, 0, 0, 0, 1);
-        assertDuration("second", 0, 0 ,0 ,0, 0, 1, 0);
-        assertDuration("minute", 0, 0, 0, 0, 1, 0, 0);
-        assertDuration("hour", 0, 0, 0, 1, 0, 0, 0);
-        assertDuration("day",  0, 0, 1, 0, 0, 0, 0);
-        assertDuration("month", 0, 1, 0, 0, 0, 0, 0);
-        assertDuration("year", 1, 0, 0, 0, 0, 0, 0);
+        assertDuration("millisecond", DateTuple.of(0, 0, 0, 0, 0, 0, 1));
+        assertDuration("second", DateTuple.of(0, 0, 0, 0, 0, 1, 0));
+        assertDuration("minute", DateTuple.of(0, 0, 0, 0, 1, 0, 0));
+        assertDuration("hour", DateTuple.of(0, 0, 0, 1, 0, 0, 0));
+        assertDuration("day", DateTuple.of(0, 0, 1, 0, 0, 0, 0));
+        assertDuration("month", DateTuple.of(0, 1, 0, 0, 0, 0, 0));
+        assertDuration("year", DateTuple.of(1, 0, 0, 0, 0, 0, 0));
         Calendar start = new com.ibm.icu.util.GregorianCalendar(1967, 1, 1, 0, 0, 0);
         start.set(Calendar.MILLISECOND, 0);
         Calendar end = (Calendar) start.clone();
@@ -174,7 +195,7 @@ public class TimeDurationTests {
         end.add(Calendar.DAY_OF_MONTH, 1);
         end.add(Calendar.MONTH, 1);
         end.add(Calendar.YEAR, 1);
-        assertDurationFields("pre-epoch elapsed time", 1, 1, 1, 1, 1, 1, 1, "1:1:1:1:1:1:1",
+        assertDurationFields("pre-epoch elapsed time", DateTuple.of(1, 1, 1, 1, 1, 1, 1), "1:1:1:1:1:1:1",
                 new TimeDuration(start, end), false, false);
     }
 }

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/UtilCodecTests.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/UtilCodecTests.java?rev=1869037&r1=1869036&r2=1869037&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/UtilCodecTests.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/UtilCodecTests.java Sun Oct 27 12:51:08 2019
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -15,7 +15,7 @@
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
- *******************************************************************************/
+ */
 package org.apache.ofbiz.base.util;
 
 import static org.junit.Assert.assertEquals;
@@ -41,10 +41,12 @@ public class UtilCodecTests {
     public void checkStringForHtmlStrictNoneDetectsXSS() {
         String xssVector = "&lt;script&gtalert(\"XSS vector\");&lt;/script&gt;";
         List<String> errorList = new ArrayList<>();
-        String canonicalizedXssVector = UtilCodec.checkStringForHtmlStrictNone("fieldName", xssVector, errorList, new Locale("test"));
+        String canonicalizedXssVector = UtilCodec.checkStringForHtmlStrictNone("fieldName", xssVector, errorList,
+                new Locale("test"));
         assertEquals("<script>alert(\"XSS vector\");</script>", canonicalizedXssVector);
         assertEquals(1, errorList.size());
-        assertEquals("In field [fieldName] less-than (<) and greater-than (>) symbols are not allowed.", errorList.get(0));
+        assertEquals("In field [fieldName] less-than (<) and greater-than (>) symbols are not allowed.",
+                errorList.get(0));
     }
 
     @Test
@@ -57,44 +59,51 @@ public class UtilCodecTests {
 
     @Test
     public void testCheckStringForHtmlStrictNone() {
-        checkStringForHtmlStrictNone_test("null pass-thru", null, null);
-        checkStringForHtmlStrictNone_test("empty pass-thru", "", "");
-        checkStringForHtmlStrictNone_test("o-numeric-encode", "foo", "f&#111;o");
-        checkStringForHtmlStrictNone_test("o-hex-encode", "foo", "f%6fo");
-        // jacopoc: temporarily commented because this test is failing after the upgrade of owasp-esapi (still investigating)
+        checkStringForHtmlStrictNoneTest("null pass-thru", null, null);
+        checkStringForHtmlStrictNoneTest("empty pass-thru", "", "");
+        checkStringForHtmlStrictNoneTest("o-numeric-encode", "foo", "f&#111;o");
+        checkStringForHtmlStrictNoneTest("o-hex-encode", "foo", "f%6fo");
+        // jacopoc: temporarily commented because this test is failingafter the upgrade of owasp-esapi
         //checkStringForHtmlStrictNone_test("o-double-hex-encode", "foo", "f%256fo");
-        checkStringForHtmlStrictNone_test("<-not-allowed", "f<oo", "f<oo", "In field [<-not-allowed] less-than (<) and greater-than (>) symbols are not allowed.");
-        checkStringForHtmlStrictNone_test(">-not-allowed", "f>oo", "f>oo", "In field [>-not-allowed] less-than (<) and greater-than (>) symbols are not allowed.");
+        checkStringForHtmlStrictNoneTest("<-not-allowed", "f<oo", "f<oo",
+                "In field [<-not-allowed] less-than (<) and greater-than (>) symbols are not allowed.");
+        checkStringForHtmlStrictNoneTest(">-not-allowed", "f>oo", "f>oo",
+                "In field [>-not-allowed] less-than (<) and greater-than (>) symbols are not allowed.");
         // jleroux: temporarily comments because this test is failing on BuildBot (only) when switching to Gradle
         //checkStringForHtmlStrictNone_test("high-ascii", "fÀ®", "f%C0%AE");
         // this looks like a bug, namely the extra trailing ;
-        // jacopoc: temporarily commented because this test is failing after the upgrade of owasp-esapi (still investigating)
+        // jacopoc: temporarily commented because this test is failing after the upgrade of owasp-esapi
         //checkStringForHtmlStrictNone_test("double-ampersand", "f\";oo", "f%26quot%3boo");
-        checkStringForHtmlStrictNone_test("double-encoding", "%2%353Cscript", "%2%353Cscript", "In field [double-encoding] found character escaping (mixed or double) that is not allowed or other format consistency error: org.apache.ofbiz.base.util.UtilCodec$IntrusionException: Input validation failure");
-        checkStringForHtmlStrictNone_test("js_event", "non_existent.foo\" onerror=\"alert('Hi!');", "non_existent.foo\" onerror=\"alert('Hi!');", "In field [js_event] Javascript events are not allowed.");
+        checkStringForHtmlStrictNoneTest("double-encoding", "%2%353Cscript", "%2%353Cscript",
+                "In field [double-encoding] found character escaping (mixed or double) that is not allowed "
+                        + "or other format consistency error: "
+                        + "org.apache.ofbiz.base.util.UtilCodec$IntrusionException: Input validation failure");
+        checkStringForHtmlStrictNoneTest("js_event", "non_existent.foo\" onerror=\"alert('Hi!');",
+                "non_existent.foo\" onerror=\"alert('Hi!');",
+                "In field [js_event] Javascript events are not allowed.");
     }
 
     private static void encoderTest(String label, UtilCodec.SimpleEncoder encoder, String wanted, String toEncode) {
         assertNull(label + "(encoder):null", encoder.encode(null));
         assertEquals(label + "(encoder):encode", wanted, encoder.encode(toEncode));
     }
-    private static void checkStringForHtmlStrictNone_test(String label, String fixed, String input, String... wantedMessages) {
+    private static void checkStringForHtmlStrictNoneTest(String label, String fixed, String input,
+            String... wantedMessages) {
         List<String> gottenMessages = new ArrayList<>();
-        assertEquals(label, fixed, UtilCodec.checkStringForHtmlStrictNone(label, input, gottenMessages, new Locale("test")));
+        assertEquals(label, fixed, UtilCodec.checkStringForHtmlStrictNone(label, input, gottenMessages,
+                new Locale("test")));
         assertEquals(label, Arrays.asList(wantedMessages), gottenMessages);
     }
-    
+
     @Test
     public void testCheckStringForHtmlSafe() {
         String xssVector = "<script>alert('XSS vector');</script>";
         List<String> errorList = new ArrayList<>();
-        String canonicalizedXssVector = UtilCodec.checkStringForHtmlSafe("fieldName", xssVector, errorList, new Locale("test"));
+        String canonicalizedXssVector = UtilCodec.checkStringForHtmlSafe("fieldName", xssVector, errorList,
+                new Locale("test"));
         assertEquals("<script>alert('XSS vector');</script>", canonicalizedXssVector);
         assertEquals(1, errorList.size());
         assertEquals("In field [fieldName] by our input policy, your input has not been accepted for security reason. "
                 + "Please check and modify accordingly, thanks.", errorList.get(0));
     }
-
-    
-
 }

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/UtilHttpTest.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/UtilHttpTest.java?rev=1869037&r1=1869036&r2=1869037&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/UtilHttpTest.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/UtilHttpTest.java Sun Oct 27 12:51:08 2019
@@ -19,8 +19,14 @@
 package org.apache.ofbiz.base.util;
 
 import static org.apache.ofbiz.base.util.UtilHttp.getPathInfoOnlyParameterMap;
-import static org.hamcrest.Matchers.*;
+import static org.hamcrest.Matchers.allOf;
+import static org.hamcrest.Matchers.anEmptyMap;
+import static org.hamcrest.Matchers.contains;
+import static org.hamcrest.Matchers.containsInAnyOrder;
+import static org.hamcrest.Matchers.equalTo;
 import static org.hamcrest.Matchers.hasEntry;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.not;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertThat;
 import static org.mockito.Mockito.when;
@@ -61,7 +67,7 @@ public class UtilHttpTest {
                 hasEntry("foo", Arrays.asList("1", "2", "3")));
 
         assertThat(getPathInfoOnlyParameterMap("/~foo=1/~bar=2/~foo=3/", x -> true),
-                Matchers.<Map<String,Object>>allOf(
+                Matchers.<Map<String, Object>>allOf(
                         hasEntry("foo", Arrays.asList("1", "3")),
                         hasEntry("bar", "2")));
     }

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/UtilIOTests.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/UtilIOTests.java?rev=1869037&r1=1869036&r2=1869037&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/UtilIOTests.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/UtilIOTests.java Sun Oct 27 12:51:08 2019
@@ -18,6 +18,7 @@
  */
 package org.apache.ofbiz.base.util;
 
+import static org.apache.ofbiz.base.util.UtilIO.readString;
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 
@@ -29,15 +30,15 @@ import java.nio.charset.StandardCharsets
 import org.junit.Test;
 
 public class UtilIOTests {
-    private static final byte[] trademarkBytes = new byte[] {
+    private static final byte[] TRADEMARK_BYTES = new byte[] {
         (byte) 0xE2, (byte) 0x84, (byte) 0xA2
     };
 
     @Test
     public void testReadString() throws Exception {
-        readStringTest_0("unix line ending", "\n", new byte[] { 0x0A });
-        readStringTest_0("mac line ending", "\r", new byte[] { 0x0D });
-        readStringTest_0("windows line ending", "\r\n", new byte[] { 0x0D, 0x0A });
+        readStringTest0("unix line ending", "\n", new byte[] {0x0A});
+        readStringTest0("mac line ending", "\r", new byte[] {0x0D});
+        readStringTest0("windows line ending", "\r\n", new byte[] {0x0D, 0x0A});
     }
 
     private static byte[] join(byte[]... parts) {
@@ -54,50 +55,56 @@ public class UtilIOTests {
         return result;
     }
 
-    private static void readStringTest_0(String label, String lineSeparator, byte[] extra) throws IOException {
+    private static void readStringTest0(String label, String lineSeparator, byte[] extra) throws IOException {
         String originalLineSeparator = System.getProperty("line.separator");
         try {
             System.getProperties().put("line.separator", lineSeparator);
-            readStringTest_1(label + ":mark", "\u2122", join(trademarkBytes));
-            readStringTest_1(label + ":mark NL", "\u2122\n", join(trademarkBytes, extra));
-            readStringTest_1(label + ":NL mark", "\n\u2122", join(extra, trademarkBytes));
+            readStringTest1(label + ":mark", "\u2122", join(TRADEMARK_BYTES));
+            readStringTest1(label + ":mark NL", "\u2122\n", join(TRADEMARK_BYTES, extra));
+            readStringTest1(label + ":NL mark", "\n\u2122", join(extra, TRADEMARK_BYTES));
         } finally {
             System.getProperties().put("line.separator", originalLineSeparator);
         }
     }
 
-    private static void readStringTest_1(String label, String wanted, byte[] toRead) throws IOException {
-        assertEquals("readString bytes default:" + label, wanted, UtilIO.readString(toRead));
-        assertEquals("readString bytes UTF-8:" + label, wanted, UtilIO.readString(toRead, "UTF-8"));
-        assertEquals("readString bytes UTF8:" + label, wanted, UtilIO.readString(toRead, StandardCharsets.UTF_8));
-        assertEquals("readString bytes offset/length default:" + label, wanted, UtilIO.readString(toRead, 0, toRead.length));
-        assertEquals("readString bytes offset/length UTF-8:" + label, wanted, UtilIO.readString(toRead, 0, toRead.length, "UTF-8"));
-        assertEquals("readString bytes offset/length UTF8:" + label, wanted, UtilIO.readString(toRead, 0, toRead.length, StandardCharsets.UTF_8));
-        assertEquals("readString stream default:" + label, wanted, UtilIO.readString(new ByteArrayInputStream(toRead)));
-        assertEquals("readString stream UTF-8:" + label, wanted, UtilIO.readString(new ByteArrayInputStream(toRead), "UTF-8"));
-        assertEquals("readString stream UTF8:" + label, wanted, UtilIO.readString(new ByteArrayInputStream(toRead), StandardCharsets.UTF_8));
+    private static void readStringTest1(String label, String wanted, byte[] toRead) throws IOException {
+        assertEquals("readString bytes default:" + label, wanted, readString(toRead));
+        assertEquals("readString bytes UTF-8:" + label, wanted, readString(toRead, "UTF-8"));
+        assertEquals("readString bytes UTF8:" + label, wanted, readString(toRead, StandardCharsets.UTF_8));
+        assertEquals("readString bytes offset/length default:" + label, wanted,
+                readString(toRead, 0, toRead.length));
+        assertEquals("readString bytes offset/length UTF-8:" + label, wanted,
+                readString(toRead, 0, toRead.length, "UTF-8"));
+        assertEquals("readString bytes offset/length UTF8:" + label, wanted,
+                readString(toRead, 0, toRead.length, StandardCharsets.UTF_8));
+        assertEquals("readString stream default:" + label, wanted,
+                readString(new ByteArrayInputStream(toRead)));
+        assertEquals("readString stream UTF-8:" + label, wanted,
+                readString(new ByteArrayInputStream(toRead), "UTF-8"));
+        assertEquals("readString stream UTF8:" + label, wanted,
+                readString(new ByteArrayInputStream(toRead), StandardCharsets.UTF_8));
     }
 
     @Test
     public void testWriteString() throws Exception {
-        writeStringTest_0("unix line ending", "\n", new byte[] { 0x0A });
-        writeStringTest_0("mac line ending", "\r", new byte[] { 0x0D });
-        writeStringTest_0("windows line ending", "\r\n", new byte[] { 0x0D, 0x0A });
+        writeStringTest0("unix line ending", "\n", new byte[] {0x0A});
+        writeStringTest0("mac line ending", "\r", new byte[] {0x0D});
+        writeStringTest0("windows line ending", "\r\n", new byte[] {0x0D, 0x0A});
     }
 
-    private static void writeStringTest_0(String label, String lineSeparator, byte[] extra) throws IOException {
+    private static void writeStringTest0(String label, String lineSeparator, byte[] extra) throws IOException {
         String originalLineSeparator = System.getProperty("line.separator");
         try {
             System.getProperties().put("line.separator", lineSeparator);
-            writeStringTest_1(label + ":mark", join(trademarkBytes), "\u2122");
-            writeStringTest_1(label + ":mark NL", join(trademarkBytes, extra), "\u2122\n");
-            writeStringTest_1(label + ":NL mark", join(extra, trademarkBytes), "\n\u2122");
+            writeStringTest1(label + ":mark", join(TRADEMARK_BYTES), "\u2122");
+            writeStringTest1(label + ":mark NL", join(TRADEMARK_BYTES, extra), "\u2122\n");
+            writeStringTest1(label + ":NL mark", join(extra, TRADEMARK_BYTES), "\n\u2122");
         } finally {
             System.getProperties().put("line.separator", originalLineSeparator);
         }
     }
 
-    private static void writeStringTest_1(String label, byte[] wanted, String toWrite) throws IOException {
+    private static void writeStringTest1(String label, byte[] wanted, String toWrite) throws IOException {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         UtilIO.writeString(baos, toWrite);
         assertArrayEquals("writeString default:" + label, wanted, baos.toByteArray());

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/UtilMiscTests.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/UtilMiscTests.java?rev=1869037&r1=1869036&r2=1869037&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/UtilMiscTests.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/UtilMiscTests.java Sun Oct 27 12:51:08 2019
@@ -23,7 +23,6 @@ import static org.junit.Assert.fail;
 import java.util.List;
 import java.util.Locale;
 
-import org.apache.ofbiz.base.util.UtilMisc;
 import org.junit.Test;
 
 public class UtilMiscTests {

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/UtilPropertiesTests.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/UtilPropertiesTests.java?rev=1869037&r1=1869036&r2=1869037&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/UtilPropertiesTests.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/UtilPropertiesTests.java Sun Oct 27 12:51:08 2019
@@ -29,14 +29,13 @@ import java.nio.charset.Charset;
 import java.util.Locale;
 import java.util.Properties;
 
-import org.apache.ofbiz.base.util.UtilProperties;
 import org.junit.Test;
 
 public class UtilPropertiesTests {
 
-    private static final String country = "AU";
-    private static final String language = "en";
-    private final Locale locale = new Locale(language, country);
+    private static final String COUNTRY = "AU";
+    private static final String LANGUAGE = "en";
+    private final Locale locale = new Locale(LANGUAGE, COUNTRY);
 
     /**
      * Old style xml:lang attribute value was of form en_AU. Test this
@@ -67,15 +66,13 @@ public class UtilPropertiesTests {
     }
 
     private Properties xmlToProperties(String separator) throws IOException {
-        String xmlData = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
-                "<resource xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
-                "          xsi:noNamespaceSchemaLocation=\"http://ofbiz.apache.org/dtds/ofbiz-properties.xsd\">\n" +
-                "    <property key=\"PropertyKey\">\n" +
-                "        <value xml:lang=\"" +
-                language + separator + country +
-                "\">Key Value</value>\n" +
-                "    </property>\n" +
-                "</resource>";
+        String xmlData = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+                + "<resource xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
+                + "          xsi:noNamespaceSchemaLocation=\"http://ofbiz.apache.org/dtds/ofbiz-properties.xsd\">\n"
+                + "    <property key=\"PropertyKey\">\n"
+                + "        <value xml:lang=\"" + LANGUAGE + separator + COUNTRY + "\">Key Value</value>\n"
+                + "    </property>\n"
+                + "</resource>";
         try (InputStream in = new ByteArrayInputStream(
                 new String(xmlData.getBytes(), Charset.forName("UTF-8")).getBytes())) {
             return UtilProperties.xmlToProperties(in, locale, null);

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/cache/UtilCacheTests.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/cache/UtilCacheTests.java?rev=1869037&r1=1869036&r2=1869037&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/cache/UtilCacheTests.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/cache/UtilCacheTests.java Sun Oct 27 12:51:08 2019
@@ -43,10 +43,16 @@ import org.junit.Test;
 
 @SuppressWarnings("serial")
 public class UtilCacheTests implements Serializable {
-    public static final String module = UtilCacheTests.class.getName();
+    abstract static class Change {
+        private int count = 1;
 
-    protected static abstract class Change {
-        protected int count = 1;
+        public int getCount() {
+            return count;
+        }
+
+        public void incCount() {
+            count += 1;
+        }
     }
 
     protected static final class Removal<V> extends Change {
@@ -112,7 +118,7 @@ public class UtilCacheTests implements S
             if (o instanceof Update<?>) {
                 Update<?> other = (Update<?>) o;
                 if (!Objects.equals(newValue, other.newValue)) {
-                   return false;
+                    return false;
                 }
                 return Objects.equals(oldValue, other.oldValue);
             }
@@ -120,8 +126,8 @@ public class UtilCacheTests implements S
         }
     }
 
-    protected static class Listener<K, V> implements CacheListener<K, V> {
-        protected Map<K, Set<Change>> changeMap = new HashMap<>();
+    private static final class Listener<K, V> implements CacheListener<K, V> {
+        private Map<K, Set<Change>> changeMap = new HashMap<>();
 
         private void add(K key, Change change) {
             Set<Change> changeSet = changeMap.get(key);
@@ -131,7 +137,7 @@ public class UtilCacheTests implements S
             }
             for (Change checkChange: changeSet) {
                 if (checkChange.equals(change)) {
-                    checkChange.count++;
+                    checkChange.incCount();
                     return;
                 }
             }