Use ByteBuf.readRetainedSlice()
[openflowplugin.git] / openflowplugin-impl / src / test / java / org / opendaylight / openflowplugin / impl / services / MultipartRequestCallbackTest.java
index 81c22459b1f1e1f90d19a3c9e65302a1e763de43..110cf1d75f5e2ba7dfc613ac941068a3e2464d6d 100644 (file)
@@ -14,16 +14,15 @@ import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.ArgumentCaptor;
+import org.mockito.ArgumentMatchers;
 import org.mockito.Captor;
-import org.mockito.Matchers;
 import org.mockito.Mock;
 import org.mockito.Mockito;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.junit.MockitoJUnitRunner;
 import org.mockito.stubbing.OngoingStubbing;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.RequestContext;
 import org.opendaylight.openflowplugin.api.openflow.device.handlers.MultiMsgCollector;
-import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.EventIdentifier;
 import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageSpy;
 import org.opendaylight.openflowplugin.impl.services.multilayer.MultiLayerMultipartRequestCallback;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoOutputBuilder;
@@ -53,12 +52,12 @@ public class MultipartRequestCallbackTest {
     private AbstractMultipartRequestCallback<MultipartReply> multipartRequestCallback;
 
     @Before
-    public void setUp() throws Exception {
+    public void setUp() {
         Mockito.doNothing().when(requestContext).setResult(rpcResultCapt.capture());
         Mockito.when(deviceContext.getMessageSpy()).thenReturn(spy);
 
         final OngoingStubbing<MultiMsgCollector<MultipartReply>> when =
-            Mockito.when(deviceContext.getMultiMsgCollector(Matchers.any()));
+            Mockito.when(deviceContext.getMultiMsgCollector(ArgumentMatchers.any()));
         when.thenReturn(multiMsgCollector);
         multipartRequestCallback = new MultiLayerMultipartRequestCallback<>(requestContext,
                                                                             MultipartRequestInput.class,
@@ -70,16 +69,16 @@ public class MultipartRequestCallbackTest {
      * End collecting.
      */
     @Test
-    public void testOnSuccess1() throws Exception {
+    public void testOnSuccess1() {
         multipartRequestCallback.onSuccess(null);
-        Mockito.verify(multiMsgCollector).endCollecting(Matchers.<EventIdentifier>any());
+        Mockito.verify(multiMsgCollector).endCollecting(ArgumentMatchers.any());
     }
 
     /**
      * Fail adding to collection.
      */
     @Test
-    public void testOnSuccess2() throws Exception {
+    public void testOnSuccess2() {
         multipartRequestCallback.onSuccess(new EchoOutputBuilder().build());
         final RpcResult<List<MultipartReply>> rpcResult = rpcResultCapt.getValue();
         Assert.assertNotNull(rpcResult);
@@ -90,10 +89,10 @@ public class MultipartRequestCallbackTest {
      * Successfully added to collection.
      */
     @Test
-    public void testOnSuccess3() throws Exception {
+    public void testOnSuccess3() {
         final MultipartReplyMessage replyMessage = new MultipartReplyMessageBuilder().build();
         multipartRequestCallback.onSuccess(replyMessage);
         Mockito.verify(multiMsgCollector)
-                .addMultipartMsg(Matchers.eq(replyMessage), Matchers.eq(false), Matchers.any());
+                .addMultipartMsg(ArgumentMatchers.eq(replyMessage), ArgumentMatchers.eq(false), ArgumentMatchers.any());
     }
 }