Remove redundant exception declarations
[openflowplugin.git] / applications / bulk-o-matic / src / test / java / org / opendaylight / openflowplugin / applications / bulk / o / matic / FlowWriterTxChainTest.java
index d1cd249c8747925b83d29cda7eea9e8a5b2bc931..72e8576db3e40bec19a03e369cf49d186afa1b29 100644 (file)
@@ -1,18 +1,16 @@
-/**
+/*
  * Copyright (c) 2016, 2017 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.openflowplugin.applications.bulk.o.matic;
 
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
-import com.google.common.util.concurrent.Futures;
 import java.util.concurrent.ExecutorService;
 import org.junit.Before;
 import org.junit.Test;
@@ -20,12 +18,11 @@ import org.junit.runner.RunWith;
 import org.mockito.ArgumentMatchers;
 import org.mockito.Mock;
 import org.mockito.Mockito;
-import org.mockito.runners.MockitoJUnitRunner;
-import org.opendaylight.controller.md.sal.binding.api.BindingTransactionChain;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.TransactionChain;
+import org.opendaylight.mdsal.binding.api.WriteTransaction;
+import org.opendaylight.mdsal.common.api.CommitInfo;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.slf4j.Logger;
@@ -50,36 +47,36 @@ public class FlowWriterTxChainTest {
     private FlowWriterTxChain flowWriterTxChain;
 
     @Before
-    public void setUp() throws Exception {
+    public void setUp() {
 
         Mockito.doAnswer(invocation -> {
             ((Runnable) invocation.getArguments()[0]).run();
             return null;
-        }).when(mockFlowPusher).execute(ArgumentMatchers.<Runnable>any());
+        }).when(mockFlowPusher).execute(ArgumentMatchers.any());
 
-        final BindingTransactionChain mockedTxChain = mock(BindingTransactionChain.class);
+        final TransactionChain mockedTxChain = mock(TransactionChain.class);
         when(mockedTxChain.newWriteOnlyTransaction()).thenReturn(writeTransaction);
         doReturn(mockedTxChain).when(mockDataBroker)
-                .createTransactionChain(ArgumentMatchers.<TransactionChainListener>any());
+                .createTransactionChain(ArgumentMatchers.any());
 
-        when(writeTransaction.submit()).thenReturn(Futures.immediateCheckedFuture(null));
+        doReturn(CommitInfo.emptyFluentFuture()).when(writeTransaction).commit();
 
         flowWriterTxChain = new FlowWriterTxChain(mockDataBroker, mockFlowPusher);
     }
 
     @Test
-    public void testAddFlows() throws Exception {
+    public void testAddFlows() {
         flowWriterTxChain.addFlows(1, FLOWS_PER_DPN, 10, 10, 10, (short) 0, (short) 1, true);
-        Mockito.verify(writeTransaction, Mockito.times(FLOWS_PER_DPN)).put(ArgumentMatchers.<LogicalDatastoreType>any(),
-                ArgumentMatchers.<InstanceIdentifier<DataObject>>any(), ArgumentMatchers.<DataObject>any(),
+        Mockito.verify(writeTransaction, Mockito.times(FLOWS_PER_DPN)).put(ArgumentMatchers.any(),
+                ArgumentMatchers.any(), ArgumentMatchers.any(),
                 ArgumentMatchers.anyBoolean());
     }
 
     @Test
-    public void testDeleteFlows() throws Exception {
+    public void testDeleteFlows() {
         flowWriterTxChain.deleteFlows(1, FLOWS_PER_DPN, 10, (short) 0, (short) 1);
         Mockito.verify(writeTransaction, Mockito.times(FLOWS_PER_DPN))
-                .delete(ArgumentMatchers.<LogicalDatastoreType>any(),
+                .delete(ArgumentMatchers.any(),
                         ArgumentMatchers.<InstanceIdentifier<DataObject>>any());
     }
 }