Bump MRI upstreams
[openflowplugin.git] / openflowplugin-impl / src / test / java / org / opendaylight / openflowplugin / impl / karaf / ClearStatsCommandProviderTest.java
index 73c99047a4339b5f58d0a179b06f6cd15de9361e..f6bd07f75eee0353feb73a11b3da276150fdd62e 100644 (file)
@@ -8,12 +8,12 @@
 
 package org.opendaylight.openflowplugin.impl.karaf;
 
-import com.google.common.base.Function;
-import javax.annotation.Nullable;
+import static org.mockito.ArgumentMatchers.anyString;
+
+import java.util.function.Function;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Test;
-import org.mockito.Matchers;
 import org.mockito.Mockito;
 import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageIntelligenceAgency;
 import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageSpy;
@@ -21,20 +21,16 @@ import org.opendaylight.openflowplugin.impl.OpenFlowPluginProviderImpl;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
 
 /**
- * Test for {@link ClearStatsCommandProvider}
+ * Test for {@link ClearStatsCommandProvider}.
  */
 public class ClearStatsCommandProviderTest extends AbstractKarafTest {
 
     private ClearStatsCommandProvider clearStatsCommandProvider;
-    private static final Function<String, Boolean> CHECK_NO_ACTIVITY_FUNCTION = new Function<String, Boolean>() {
-        @Nullable
-        @Override
-        public Boolean apply(String input) {
-            return input.endsWith(": no activity detected");
-        }
-    };
+    private static final Function<String, Boolean> CHECK_NO_ACTIVITY_FUNCTION =
+        input -> input.endsWith(": no activity detected");
     private MessageIntelligenceAgency mi5;
 
+    @Override
     public void doSetUp() {
         clearStatsCommandProvider = new ClearStatsCommandProvider();
         mi5 = OpenFlowPluginProviderImpl.getMessageIntelligenceAgency();
@@ -44,14 +40,12 @@ public class ClearStatsCommandProviderTest extends AbstractKarafTest {
 
     @After
     public void tearDown() {
-        Mockito.verify(console).print(Matchers.anyString());
+        Mockito.verify(console).print(anyString());
         mi5.resetStatistics();
     }
 
     /**
-     * test for {@link ClearStatsCommandProvider#doExecute()} when no stats were touched before
-     *
-     * @throws Exception
+     * Test for {@link ClearStatsCommandProvider#doExecute()} when no stats were touched before.
      */
     @Test
     public void testDoExecute_clean() throws Exception {
@@ -62,18 +56,16 @@ public class ClearStatsCommandProviderTest extends AbstractKarafTest {
     }
 
     /**
-     * test for {@link ClearStatsCommandProvider#doExecute()} when stats were touched before
-     *
-     * @throws Exception
+     * Test for {@link ClearStatsCommandProvider#doExecute()} when stats were touched before.
      */
     @Test
     public void testDoExecute_dirty() throws Exception {
-        final MessageIntelligenceAgency mi5 = OpenFlowPluginProviderImpl.getMessageIntelligenceAgency();
+        mi5 = OpenFlowPluginProviderImpl.getMessageIntelligenceAgency();
         Assert.assertTrue(checkNoActivity(mi5.provideIntelligence(), CHECK_NO_ACTIVITY_FUNCTION));
-        mi5.spyMessage(OfHeader.class, MessageSpy.STATISTIC_GROUP.FROM_SWITCH);
+        mi5.spyMessage(OfHeader.class, MessageSpy.StatisticsGroup.FROM_SWITCH);
         Assert.assertFalse(checkNoActivity(mi5.provideIntelligence(), CHECK_NO_ACTIVITY_FUNCTION));
 
         clearStatsCommandProvider.execute(cmdSession);
         Assert.assertTrue(checkNoActivity(mi5.provideIntelligence(), CHECK_NO_ACTIVITY_FUNCTION));
     }
-}
\ No newline at end of file
+}