svn commit: r1811414 - /ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/test/GenericTestCaseBase.java

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

svn commit: r1811414 - /ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/test/GenericTestCaseBase.java

mbrohl
Author: mbrohl
Date: Sat Oct  7 12:13:05 2017
New Revision: 1811414

URL: http://svn.apache.org/viewvc?rev=1811414&view=rev
Log:
Improved: Fixing defects reported by FindBugs, package
org.apache.ofbiz.base.test.
(OFBIZ-9574)

Thanks Dennis Balkir for reporting and providing the patch.

Modified:
    ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/test/GenericTestCaseBase.java

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/test/GenericTestCaseBase.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/test/GenericTestCaseBase.java?rev=1811414&r1=1811413&r2=1811414&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/test/GenericTestCaseBase.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/test/GenericTestCaseBase.java Sat Oct  7 12:13:05 2017
@@ -44,7 +44,7 @@ public abstract class GenericTestCaseBas
     }
 
     public static void useAllMemory() throws Exception {
-        List<long[]> dummy = new LinkedList<long[]>();
+        List<long[]> dummy = new LinkedList<>();
         try {
             do {
                 dummy.add(new long[1048576]);
@@ -154,7 +154,7 @@ public abstract class GenericTestCaseBas
         if (got.equals(wanted)) return;
         msg = msg == null ? "" : msg + ' ';
         assertNotNull(msg + "expected a value", got);
-        List<T> list = new ArrayList<T>(wanted);
+        List<T> list = new ArrayList<>(wanted);
         Iterator<?> rightIt = ((Collection<?>) got).iterator();
 OUTER:
         while (rightIt.hasNext()) {
@@ -188,7 +188,7 @@ OUTER:
         if (got.equals(wanted)) return;
         msg = msg == null ? "" : msg + ' ';
         assertNotNull(msg + "expected a value", got);
-        Set<T> wantedSet = new HashSet<T>(wanted);
+        Set<T> wantedSet = new HashSet<>(wanted);
         Iterator<?> rightIt = ((Set<?>) got).iterator();
         while (rightIt.hasNext()) {
             Object right = rightIt.next();
@@ -299,8 +299,8 @@ OUTER:
         if (!(got instanceof Map<?, ?>)) fail(msg + "expected a map");
         Map<?, ?> gotMap = (Map<?, ?>) got;
         if (!got.equals(wanted)) {
-            Set<T> leftKeys = new LinkedHashSet<T>(wanted.keySet());
-            Set<Object> rightKeys = new HashSet<Object>(gotMap.keySet());
+            Set<T> leftKeys = new LinkedHashSet<>(wanted.keySet());
+            Set<Object> rightKeys = new HashSet<>(gotMap.keySet());
             for (T key: leftKeys) {
                 assertTrue(msg + "got key(" + key + ")", rightKeys.remove(key));
                 assertEquals(msg + "key(" + key + ") value", wanted.get(key), gotMap.get(key));
@@ -345,23 +345,23 @@ OUTER:
     }
 
     public static <T> List<T> list(T value) {
-        List<T> list = new ArrayList<T>(1);
+        List<T> list = new ArrayList<>(1);
         list.add(value);
         return list;
     }
 
     public static <T> List<T> list(T... list) {
-        return new ArrayList<T>(Arrays.asList(list));
+        return new ArrayList<>(Arrays.asList(list));
     }
 
     public static <T> Set<T> set(T value) {
-        Set<T> set = new HashSet<T>(1);
+        Set<T> set = new HashSet<>(1);
         set.add(value);
         return set;
     }
 
     public static <T> Set<T> set(T... list) {
-        return new HashSet<T>(Arrays.asList(list));
+        return new HashSet<>(Arrays.asList(list));
     }
 
     public static <T> Set<T> set(Iterable<T> iterable) {
@@ -369,7 +369,7 @@ OUTER:
     }
 
     public static <T> Set<T> set(Iterator<T> it) {
-        Set<T> set = new HashSet<T>();
+        Set<T> set = new HashSet<>();
         while (it.hasNext()) {
             T item = it.next();
             set.add(item);
@@ -380,7 +380,7 @@ OUTER:
     @SuppressWarnings("unchecked")
     public static <K, V> Map<K, V> map(Object... list) {
         assertEquals("list has even number of elements", 0, list.length % 2);
-        Map<K, V> map = new LinkedHashMap<K, V>();
+        Map<K, V> map = new LinkedHashMap<>();
         for (int i = 0; i < list.length; i += 2) {
             map.put((K) list[i], (V) list[i + 1]);
         }