Migrate MockitoJUnitRunner
[openflowplugin.git] / openflowplugin-impl / src / test / java / org / opendaylight / openflowplugin / impl / connection / ConnectionContextImplTest.java
index bca7a967fba435e0c4f6159102529cfcbfd3b400..42c89b5f99934fe066ae45b71c07ffd9072e1bca 100644 (file)
@@ -15,10 +15,11 @@ import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
 import org.mockito.Mockito;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.junit.MockitoJUnitRunner;
 import org.opendaylight.openflowjava.protocol.api.connection.ConnectionAdapter;
 import org.opendaylight.openflowjava.protocol.api.connection.OutboundQueueHandlerRegistration;
 import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext;
+import org.opendaylight.openflowplugin.api.openflow.connection.DeviceConnectionStatusProvider;
 import org.opendaylight.openflowplugin.api.openflow.connection.HandshakeContext;
 import org.opendaylight.openflowplugin.api.openflow.connection.OutboundQueueProvider;
 import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceDisconnectedHandler;
@@ -40,16 +41,18 @@ public class ConnectionContextImplTest {
     private DeviceDisconnectedHandler deviceDisconnectedHandler;
     @Mock
     private OutboundQueueProvider outboundQueueProvider;
+    @Mock
+    private DeviceConnectionStatusProvider deviceConnectionStatusProvider;
 
     private ConnectionContextImpl connectionContext;
 
     @Before
-    public void setUp() throws Exception {
+    public void setUp() {
         Mockito.when(connetionAdapter.getRemoteAddress())
                 .thenReturn(InetSocketAddress.createUnresolved("ofp-ut.example.org", 4242));
         Mockito.when(connetionAdapter.isAlive()).thenReturn(true);
 
-        connectionContext = new ConnectionContextImpl(connetionAdapter);
+        connectionContext = new ConnectionContextImpl(connetionAdapter, deviceConnectionStatusProvider);
         connectionContext.setHandshakeContext(handshakeContext);
         connectionContext.setNodeId(new NodeId("ut-node:123"));
         connectionContext.setOutboundQueueHandleRegistration(outboundQueueRegistration);
@@ -59,7 +62,7 @@ public class ConnectionContextImplTest {
     }
 
     @Test
-    public void testCloseConnection1() throws Exception {
+    public void testCloseConnection1() {
         connectionContext.closeConnection(true);
         Mockito.verify(outboundQueueRegistration).close();
         Mockito.verify(handshakeContext).close();
@@ -70,7 +73,7 @@ public class ConnectionContextImplTest {
     }
 
     @Test
-    public void testCloseConnection2() throws Exception {
+    public void testCloseConnection2() {
         connectionContext.closeConnection(false);
         Mockito.verify(outboundQueueRegistration).close();
         Mockito.verify(handshakeContext).close();
@@ -81,7 +84,7 @@ public class ConnectionContextImplTest {
     }
 
     @Test
-    public void testOnConnectionClosed() throws Exception {
+    public void testOnConnectionClosed() {
         connectionContext.onConnectionClosed();
         Assert.assertEquals(ConnectionContext.CONNECTION_STATE.RIP, connectionContext.getConnectionState());
         Mockito.verify(outboundQueueRegistration).close();
@@ -91,19 +94,19 @@ public class ConnectionContextImplTest {
     }
 
     @Test
-    public void testChangeStateToHandshaking() throws Exception {
+    public void testChangeStateToHandshaking() {
         connectionContext.changeStateToHandshaking();
         Assert.assertEquals(ConnectionContext.CONNECTION_STATE.HANDSHAKING, connectionContext.getConnectionState());
     }
 
     @Test
-    public void testChangeStateToTimeouting() throws Exception {
+    public void testChangeStateToTimeouting() {
         connectionContext.changeStateToTimeouting();
         Assert.assertEquals(ConnectionContext.CONNECTION_STATE.TIMEOUTING, connectionContext.getConnectionState());
     }
 
     @Test
-    public void testChangeStateToWorking() throws Exception {
+    public void testChangeStateToWorking() {
         connectionContext.changeStateToWorking();
         Assert.assertEquals(ConnectionContext.CONNECTION_STATE.WORKING, connectionContext.getConnectionState());
     }