Merge branch 'workaround_mockito' into 'ibm-trunk'

Removed unused constructor and fixed intermittent unit test failure

See merge request !60
diff --git a/yoko-util/pom.xml b/yoko-util/pom.xml
index 2c6c625..22a7200 100644
--- a/yoko-util/pom.xml
+++ b/yoko-util/pom.xml
@@ -50,7 +50,7 @@
         <dependency>
             <groupId>org.mockito</groupId>
             <artifactId>mockito-core</artifactId>
-            <version>1.9.0</version>
+            <version>1.10.19</version>
             <scope>test</scope>
         </dependency>
     </dependencies>
@@ -72,6 +72,7 @@
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-surefire-plugin</artifactId>
                 <configuration>
+                    <!-- <argLine>-verbose:class</argLine> -->
                     <includes>
                         <include>**/*Test.java</include>
                     </includes>
diff --git a/yoko-util/src/main/java/org/apache/yoko/util/concurrent/NoOpRunnableFactory.java b/yoko-util/src/main/java/org/apache/yoko/util/concurrent/NoOpRunnableFactory.java
deleted file mode 100644
index 6d71a32..0000000
--- a/yoko-util/src/main/java/org/apache/yoko/util/concurrent/NoOpRunnableFactory.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package org.apache.yoko.util.concurrent;
-
-import org.apache.yoko.util.Factory;
-import org.apache.yoko.util.KeyedFactory;
-
-public enum NoOpRunnableFactory implements Runnable, KeyedFactory<Object, Runnable> {
-    INSTANCE;
-    public Runnable create(Object key) {return this;}
-    public void run() {}
-}
diff --git a/yoko-util/src/main/java/org/apache/yoko/util/concurrent/WeakConcurrentFifo.java b/yoko-util/src/main/java/org/apache/yoko/util/concurrent/WeakConcurrentFifo.java
index 3dd9592..2191a94 100644
--- a/yoko-util/src/main/java/org/apache/yoko/util/concurrent/WeakConcurrentFifo.java
+++ b/yoko-util/src/main/java/org/apache/yoko/util/concurrent/WeakConcurrentFifo.java
@@ -1,20 +1,17 @@
 package org.apache.yoko.util.concurrent;
 
 import org.apache.yoko.util.KeyedFactory;
-import org.apache.yoko.util.Sequential;
 
 import java.lang.ref.ReferenceQueue;
 
+import static java.util.Objects.requireNonNull;
+
 public class WeakConcurrentFifo<T> extends ConcurrentFifo<T> {
     private final ReferenceQueue<T> refQueue = new ReferenceQueue<>();
     private final KeyedFactory<? super T, Runnable> cleanupFactory;
 
-    WeakConcurrentFifo() {
-        this(NoOpRunnableFactory.INSTANCE);
-    }
-
     WeakConcurrentFifo(KeyedFactory<? super T, Runnable> cleanupFactory) {
-        this.cleanupFactory = cleanupFactory;
+        this.cleanupFactory = requireNonNull(cleanupFactory);
     }
 
     @Override
diff --git a/yoko-util/src/test/java/org/apache/yoko/util/concurrent/WeakConcurrentFifoTest.java b/yoko-util/src/test/java/org/apache/yoko/util/concurrent/WeakConcurrentFifoTest.java
index 75a0727..f81f477 100644
--- a/yoko-util/src/test/java/org/apache/yoko/util/concurrent/WeakConcurrentFifoTest.java
+++ b/yoko-util/src/test/java/org/apache/yoko/util/concurrent/WeakConcurrentFifoTest.java
@@ -5,28 +5,28 @@
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
+import org.mockito.Mockito;
 import org.mockito.runners.MockitoJUnitRunner;
 
 import java.lang.ref.WeakReference;
 
 import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.*;
 
-@RunWith(MockitoJUnitRunner.class)
 public class WeakConcurrentFifoTest extends ConcurrentFifoTest {
-    private KeyedFactory<String, Runnable> factory =  new KeyedFactory<String, Runnable>() {
-        public Runnable create(String key) {
-            return cleanup;
-        }
+    // must not use a mock here because it will hold onto all its arguments strongly
+    private final KeyedFactory<String, Runnable> factory =  new KeyedFactory<String, Runnable>() {
+        public Runnable create(String key) {return cleanup;}
     };
 
-    @Mock
+    // must not use the @Mock annotation and Mockito's injection
+    // because it intermittently fails to count invocations correctly
     private Runnable cleanup;
 
-    @Override
     @Before
+    @Override
     public void setupFifo() {
+        cleanup = mock(Runnable.class);
         fifo = new WeakConcurrentFifo<>(factory);
     }