svn commit: r1869037 [2/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/...

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

svn commit: r1869037 [2/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
Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/collections/GenericMapTest.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/collections/GenericMapTest.java?rev=1869037&r1=1869036&r2=1869037&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/collections/GenericMapTest.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/collections/GenericMapTest.java Sun Oct 27 12:51:08 2019
@@ -28,18 +28,14 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.ofbiz.base.util.Debug;
-import org.apache.ofbiz.base.util.collections.GenericMap;
-import org.apache.ofbiz.base.util.collections.GenericMapEntry;
-import org.apache.ofbiz.base.util.collections.IteratorWrapper;
 import org.junit.Test;
 
 public class GenericMapTest {
-
-    public static final String module = GenericMapTest.class.getName();
+    private static final String MODULE = GenericMapTest.class.getName();
 
     @SuppressWarnings("serial")
-    public static class TestGenericMap<K, V> extends GenericMap<K, V> {
-        private static final String[] countNames = {
+    public static final class TestGenericMap<K, V> extends GenericMap<K, V> {
+        private static final String[] COUNT_NAMES = {
             "clearInternal",
             "containsKey",
             "get-true",
@@ -53,15 +49,15 @@ public class GenericMapTest {
             "removeInternal-false",
             "size",
         };
-        protected final Map<String, Integer> counts = new HashMap<>();
-        protected final Map<K, V> proxyMap;
+        private final Map<String, Integer> counts = new HashMap<>();
+        private final Map<K, V> proxyMap;
 
         protected TestGenericMap() {
             this(null);
         }
 
         protected TestGenericMap(Map<K, V> srcMap) {
-            for (String countName: countNames) {
+            for (String countName: COUNT_NAMES) {
                 counts.put(countName, 0);
             }
             if (srcMap != null) {
@@ -77,7 +73,7 @@ public class GenericMapTest {
 
         public List<Integer> getCounts() {
             List<Integer> result = new ArrayList<>();
-            for (String countName: countNames) {
+            for (String countName: COUNT_NAMES) {
                 result.add(counts.get(countName));
             }
             return result;
@@ -124,7 +120,9 @@ public class GenericMapTest {
         @Override
         public V put(K key, V value) {
             incrementCallCount("putInternal");
-            if (!proxyMap.containsKey(key)) incrementModCount();
+            if (!proxyMap.containsKey(key)) {
+                incrementModCount();
+            }
             return proxyMap.put(key, value);
         }
 
@@ -140,8 +138,12 @@ public class GenericMapTest {
         @Override
         protected V removeInternal(Object key, boolean incrementModCount) {
             incrementCallCount("removeInternal-" + incrementModCount);
-            if (!proxyMap.containsKey(key)) return null;
-            if (incrementModCount) incrementModCount();
+            if (!proxyMap.containsKey(key)) {
+                return null;
+            }
+            if (incrementModCount) {
+                incrementModCount();
+            }
             return proxyMap.remove(key);
         }
 
@@ -155,23 +157,30 @@ public class GenericMapTest {
     @Test
     public void testFoo() throws Exception {
         TestGenericMap<String, Integer> map = new TestGenericMap<>();
-        map.put("a", 0); Debug.logInfo("put a\t\tcounts=" + map.getCounts() + ", modCount=" + map.getModCount(), module);
+        map.put("a", 0);
+        Debug.logInfo("put a\t\tcounts=" + map.getCounts() + ", modCount=" + map.getModCount(), MODULE);
         assertEquals("get a", Integer.valueOf(0), map.get("a"));
-        map.put("b", 1); Debug.logInfo("put b\t\tcounts=" + map.getCounts() + ", modCount=" + map.getModCount(), module);
+        map.put("b", 1);
+        Debug.logInfo("put b\t\tcounts=" + map.getCounts() + ", modCount=" + map.getModCount(), MODULE);
         assertEquals("get b", Integer.valueOf(1), map.get("b"));
-        map.put("c", 2); Debug.logInfo("put c\t\tcounts=" + map.getCounts() + ", modCount=" + map.getModCount(), module);
+        map.put("c", 2);
+        Debug.logInfo("put c\t\tcounts=" + map.getCounts() + ", modCount=" + map.getModCount(), MODULE);
         assertEquals("get c", Integer.valueOf(2), map.get("c"));
-        map.put("d", 3); Debug.logInfo("put d\t\tcounts=" + map.getCounts() + ", modCount=" + map.getModCount(), module);
+        map.put("d", 3);
+        Debug.logInfo("put d\t\tcounts=" + map.getCounts() + ", modCount=" + map.getModCount(), MODULE);
         assertEquals("get d", Integer.valueOf(3), map.get("d"));
-        map.put("c", 22); Debug.logInfo("put c-2\t\tcounts=" + map.getCounts() + ", modCount=" + map.getModCount(), module);
+        map.put("c", 22);
+        Debug.logInfo("put c-2\t\tcounts=" + map.getCounts() + ", modCount=" + map.getModCount(), MODULE);
         assertEquals("get c-2", Integer.valueOf(22), map.get("c"));
-        map.remove("b"); Debug.logInfo("remove b\tcounts=" + map.getCounts() + ", modCount=" + map.getModCount(), module);
+        map.remove("b");
+        Debug.logInfo("remove b\tcounts=" + map.getCounts() + ", modCount=" + map.getModCount(), MODULE);
         assertNull("null b", map.get("b"));
-        map.remove("aaa"); Debug.logInfo("remove aaa\tcounts=" + map.getCounts() + ", modCount=" + map.getModCount(), module);
-        Debug.logInfo("map=" + map, module);
-        Debug.logInfo("counts=" + map.getCounts() + ", modCount=" + map.getModCount(), module);
+        map.remove("aaa");
+        Debug.logInfo("remove aaa\tcounts=" + map.getCounts() + ", modCount=" + map.getModCount(), MODULE);
+        Debug.logInfo("map=" + map, MODULE);
+        Debug.logInfo("counts=" + map.getCounts() + ", modCount=" + map.getModCount(), MODULE);
         // this seems to call size()
         new HashMap<>(map);
-        Debug.logInfo("counts=" + map.getCounts() + ", modCount=" + map.getModCount(), module);
+        Debug.logInfo("counts=" + map.getCounts() + ", modCount=" + map.getModCount(), MODULE);
     }
 }

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/collections/MapContextTest.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/collections/MapContextTest.java?rev=1869037&r1=1869036&r2=1869037&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/collections/MapContextTest.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/collections/MapContextTest.java Sun Oct 27 12:51:08 2019
@@ -28,7 +28,6 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.webapp.control.ConfigXMLReader.ControllerConfig;
 import org.junit.Test;
 
 public class MapContextTest {
@@ -43,7 +42,7 @@ public class MapContextTest {
      */
     static class PNode {
         /** The properties of the node. */
-        public Map<String, String> props;
+        private Map<String, String> props;
         /** The included identifier of nodes. */
         private List<PNode> includes;
 
@@ -53,7 +52,7 @@ public class MapContextTest {
          * @param includes  the included nodes
          */
         @SafeVarargs
-        public PNode(PNode... includes) {
+        PNode(PNode... includes) {
             this(Collections.emptyMap(), includes);
         }
 
@@ -64,7 +63,7 @@ public class MapContextTest {
          * @param includes  the included nodes
          */
         @SafeVarargs
-        public PNode(Map<String, String> props, PNode... includes) {
+        PNode(Map<String, String> props, PNode... includes) {
             this.props = props;
             this.includes = Arrays.asList(includes);
         }
@@ -85,7 +84,7 @@ public class MapContextTest {
     // Checks that the order warranty of LinkedHashMap objects are preserved
     // when pushing them in a MapContext.
     @Test
-    public void ControllerConfigLikeContext() {
+    public void controllerConfigLikeContext() {
         Map<String, String> propsA =
                 UtilMisc.toMap(LinkedHashMap::new, "aa", "1", "ab", "1");
         Map<String, String> propsB =

Modified: ofbiz/ofbiz-framework/trunk/framework/common/src/test/java/org/apache/ofbiz/common/GetLocaleListTests.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/common/src/test/java/org/apache/ofbiz/common/GetLocaleListTests.java?rev=1869037&r1=1869036&r2=1869037&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/common/src/test/java/org/apache/ofbiz/common/GetLocaleListTests.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/common/src/test/java/org/apache/ofbiz/common/GetLocaleListTests.java Sun Oct 27 12:51:08 2019
@@ -18,8 +18,12 @@
  */
 package org.apache.ofbiz.common;
 
-import static org.junit.Assert.*;
-import static org.hamcrest.CoreMatchers.*;
+import static org.hamcrest.CoreMatchers.both;
+import static org.hamcrest.CoreMatchers.hasItem;
+import static org.hamcrest.CoreMatchers.hasItems;
+import static org.hamcrest.CoreMatchers.not;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
 
 import java.util.HashMap;
 import java.util.HashSet;
@@ -52,7 +56,7 @@ public class GetLocaleListTests {
         return (List<Map<String, String>>) gContext.get("locales");
     }
 
-    static private List<String> localeStrings(List<Map<String, String>> locales) {
+    private static List<String> localeStrings(List<Map<String, String>> locales) {
         return locales.stream()
             .map(m -> m.get("localeString"))
             .collect(Collectors.toList());

Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/test/java/org/apache/ofbiz/entity/EntityConditionVisitorTests.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/test/java/org/apache/ofbiz/entity/EntityConditionVisitorTests.java?rev=1869037&r1=1869036&r2=1869037&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/entity/src/test/java/org/apache/ofbiz/entity/EntityConditionVisitorTests.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/entity/src/test/java/org/apache/ofbiz/entity/EntityConditionVisitorTests.java Sun Oct 27 12:51:08 2019
@@ -88,11 +88,11 @@ public class EntityConditionVisitorTests
     @Test
     public void complexTest() {
         class ContainsRawCondition implements EntityConditionVisitor {
-            public boolean hasRawCondition = false;
+            private boolean hasRawCondition = false;
 
-            @Override public void visit(EntityNotCondition cond) {}
-            @Override public void visit(EntityFieldMap m) {}
-            @Override public void visit(EntityDateFilterCondition df) {}
+            @Override public void visit(EntityNotCondition cond) { }
+            @Override public void visit(EntityFieldMap m) { }
+            @Override public void visit(EntityDateFilterCondition df) { }
 
             @Override
             public <T extends EntityCondition> void visit(EntityConditionList<T> l) {
@@ -107,10 +107,12 @@ public class EntityConditionVisitorTests
                 Object lhs = expr.getLhs();
                 Object rhs = expr.getRhs();
                 if (lhs instanceof EntityCondition) {
-                    ((EntityCondition) lhs).accept(this);
+                    EntityCondition lhec = (EntityCondition) lhs;
+                    lhec.accept(this);
                 }
                 if (rhs instanceof EntityCondition) {
-                    ((EntityCondition) rhs).accept(this);
+                    EntityCondition rhec = (EntityCondition) lhs;
+                    rhec.accept(this);
                 }
             }
 

Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/test/java/org/apache/ofbiz/entity/util/EntitySaxReaderTests.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/test/java/org/apache/ofbiz/entity/util/EntitySaxReaderTests.java?rev=1869037&r1=1869036&r2=1869037&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/entity/src/test/java/org/apache/ofbiz/entity/util/EntitySaxReaderTests.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/entity/src/test/java/org/apache/ofbiz/entity/util/EntitySaxReaderTests.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.entity.util;
 
 import static org.junit.Assert.assertEquals;
@@ -38,7 +38,8 @@ public class EntitySaxReaderTests {
     @Before
     public void initialize() {
         logVerboseOn = Debug.isOn(Debug.VERBOSE); // save the current setting (to be restored after the tests)
-        Debug.set(Debug.VERBOSE, false); // disable verbose logging: this is necessary to avoid a test error in the "parse" unit test
+        // disable verbose logging: this is necessary to avoid a test error in the "parse" unit test
+        Debug.set(Debug.VERBOSE, false);
     }
 
     @After

Modified: ofbiz/ofbiz-framework/trunk/framework/webapp/src/test/java/org/apache/ofbiz/webapp/WebAppCacheTest.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webapp/src/test/java/org/apache/ofbiz/webapp/WebAppCacheTest.java?rev=1869037&r1=1869036&r2=1869037&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/webapp/src/test/java/org/apache/ofbiz/webapp/WebAppCacheTest.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/webapp/src/test/java/org/apache/ofbiz/webapp/WebAppCacheTest.java Sun Oct 27 12:51:08 2019
@@ -18,8 +18,12 @@
  */
 package org.apache.ofbiz.webapp;
 
-import static org.junit.Assert.*;
-import static org.hamcrest.Matchers.*;
+import static org.hamcrest.Matchers.contains;
+import static org.hamcrest.Matchers.containsInAnyOrder;
+import static org.hamcrest.Matchers.empty;
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertThat;
 
 import java.util.ArrayList;
 

Modified: ofbiz/ofbiz-framework/trunk/framework/webapp/src/test/java/org/apache/ofbiz/webapp/control/ControlFilterTests.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webapp/src/test/java/org/apache/ofbiz/webapp/control/ControlFilterTests.java?rev=1869037&r1=1869036&r2=1869037&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/webapp/src/test/java/org/apache/ofbiz/webapp/control/ControlFilterTests.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/webapp/src/test/java/org/apache/ofbiz/webapp/control/ControlFilterTests.java Sun Oct 27 12:51:08 2019
@@ -54,7 +54,7 @@ public class ControlFilterTests {
         resp = mock(HttpServletResponse.class);
         next = mock(FilterChain.class);
         filter = new ControlFilter();
-     }
+    }
 
     @Test
     public void filterWithExactAllowedPath() throws Exception {

Modified: ofbiz/ofbiz-framework/trunk/framework/webapp/src/test/java/org/apache/ofbiz/webapp/control/RequestHandlerTests.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webapp/src/test/java/org/apache/ofbiz/webapp/control/RequestHandlerTests.java?rev=1869037&r1=1869036&r2=1869037&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/webapp/src/test/java/org/apache/ofbiz/webapp/control/RequestHandlerTests.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/webapp/src/test/java/org/apache/ofbiz/webapp/control/RequestHandlerTests.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.webapp.control;
 
 import static org.hamcrest.CoreMatchers.both;
@@ -48,7 +48,7 @@ import org.w3c.dom.Element;
 
 public class RequestHandlerTests {
     public static class ResolveURITests {
-        private MultivaluedMapContext<String,RequestMap> reqMaps;
+        private MultivaluedMapContext<String, RequestMap> reqMaps;
         private Map<String, ViewMap> viewMaps;
         private HttpServletRequest req;
         private Element dummyElement;
@@ -261,7 +261,7 @@ public class RequestHandlerTests {
         }
     }
 
-    public static class checkCertificatesTests {
+    public static class CheckCertificatesTests {
         private HttpServletRequest req;
 
         @Before