Remove redundant exception declarations
[openflowplugin.git] / openflowplugin-impl / src / test / java / org / opendaylight / openflowplugin / impl / mastership / MastershipChangeServiceManagerImplTest.java
index 2e0eaf43840bcb4321c1c2914c9f3f9e1d6ca84b..dc1faa98d119e3803f29a813da09c4b10d348acb 100644 (file)
@@ -7,7 +7,9 @@
  */
 package org.opendaylight.openflowplugin.impl.mastership;
 
-import com.google.common.util.concurrent.FutureCallback;
+import com.google.common.util.concurrent.Futures;
+import java.util.ArrayList;
+import java.util.List;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -17,13 +19,12 @@ import org.mockito.Mockito;
 import org.mockito.runners.MockitoJUnitRunner;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
 import org.opendaylight.openflowplugin.api.openflow.lifecycle.MasterChecker;
-import org.opendaylight.openflowplugin.api.openflow.mastership.*;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.rf.state.rev170713.ResultState;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.junit.Assert.*;
+import org.opendaylight.openflowplugin.api.openflow.mastership.MastershipChangeException;
+import org.opendaylight.openflowplugin.api.openflow.mastership.MastershipChangeRegistration;
+import org.opendaylight.openflowplugin.api.openflow.mastership.MastershipChangeService;
+import org.opendaylight.openflowplugin.api.openflow.mastership.MastershipChangeServiceManager;
+import org.opendaylight.openflowplugin.api.openflow.mastership.ReconciliationFrameworkEvent;
+import org.opendaylight.openflowplugin.api.openflow.mastership.ReconciliationFrameworkRegistration;
 
 @RunWith(MockitoJUnitRunner.class)
 public class MastershipChangeServiceManagerImplTest {
@@ -35,15 +36,13 @@ public class MastershipChangeServiceManagerImplTest {
     @Mock
     private DeviceInfo deviceInfo;
     @Mock
-    private FutureCallback<ResultState> resultStateFutureCallback;
-    @Mock
     private MasterChecker masterChecker;
     @Mock
     private ReconciliationFrameworkEvent event;
     @Mock
     private ReconciliationFrameworkEvent secondEvent;
 
-    final private MastershipChangeServiceManager manager = new MastershipChangeServiceManagerImpl();
+    private final MastershipChangeServiceManager manager = new MastershipChangeServiceManagerImpl();
     private MastershipChangeRegistration registration;
     private ReconciliationFrameworkRegistration registrationRF;
 
@@ -51,15 +50,17 @@ public class MastershipChangeServiceManagerImplTest {
     public void setUp() throws Exception {
         registration = manager.register(service);
         registrationRF = manager.reconciliationFrameworkRegistration(event);
+
+        Mockito.when(event.onDeviceDisconnected(Mockito.any())).thenReturn(Futures.immediateFuture(null));
     }
 
     @Test
-    public void register() throws Exception {
+    public void register() {
         Assert.assertNotNull(registration);
     }
 
     @Test
-    public void registerTwice() throws Exception {
+    public void registerTwice() {
         MastershipChangeRegistration registration2;
         registration2 = manager.register(secondService);
         Assert.assertNotNull(registration);
@@ -78,7 +79,7 @@ public class MastershipChangeServiceManagerImplTest {
     }
 
     @Test
-    public void reconciliationFrameworkRegistration() throws Exception {
+    public void reconciliationFrameworkRegistration() {
         Assert.assertNotNull(registrationRF);
     }
 
@@ -96,7 +97,7 @@ public class MastershipChangeServiceManagerImplTest {
     }
 
     @Test
-    public void becomeMaster() throws Exception {
+    public void becomeMaster() {
         manager.becomeMaster(deviceInfo);
         Mockito.verify(service).onBecomeOwner(deviceInfo);
         manager.becomeSlaveOrDisconnect(deviceInfo);
@@ -104,9 +105,9 @@ public class MastershipChangeServiceManagerImplTest {
     }
 
     @Test
-    public void becomeMasterBeforeDS() throws Exception {
-        manager.becomeMasterBeforeSubmittedDS(deviceInfo, resultStateFutureCallback);
-        Mockito.verify(event).onDevicePrepared(deviceInfo, resultStateFutureCallback);
+    public void becomeMasterBeforeDS() {
+        manager.becomeMasterBeforeSubmittedDS(deviceInfo);
+        Mockito.verify(event).onDevicePrepared(deviceInfo);
     }
 
     @Test
@@ -117,7 +118,7 @@ public class MastershipChangeServiceManagerImplTest {
     }
 
     @Test
-    public void evokeEventAfterRegistration() throws Exception {
+    public void evokeEventAfterRegistration() {
         List<DeviceInfo> deviceInfos = new ArrayList<>();
         deviceInfos.add(deviceInfo);
         manager.setMasterChecker(masterChecker);