Fix codestyle
[openflowplugin.git] / openflowplugin-impl / src / test / java / org / opendaylight / openflowplugin / impl / connection / listener / HandshakeListenerImplTest.java
index 5133a3d39cb6f71375c054b4c0b66a1f457326fc..9dede809beaba2e9476dd160d30806abf411b1d5 100644 (file)
@@ -40,8 +40,6 @@ import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
 @RunWith(MockitoJUnitRunner.class)
 public class HandshakeListenerImplTest {
 
-    private final Short version = OFConstants.OFP_VERSION_1_3;
-
     @Mock
     private DeviceConnectedHandler deviceConnectedHandler;
     @Mock
@@ -63,7 +61,6 @@ public class HandshakeListenerImplTest {
         connectionContextSpy = Mockito.spy(new ConnectionContextImpl(connectionAdapter));
         Mockito.when(connectionContextSpy.getConnectionAdapter()).thenReturn(connectionAdapter);
         Mockito.when(features.getDatapathId()).thenReturn(BigInteger.TEN);
-        Mockito.doNothing().when(connectionContextSpy).createDeviceInfo();
         handshakeListener = new HandshakeListenerImpl(connectionContextSpy, deviceConnectedHandler);
         handshakeListener.setHandshakeContext(handshakeContext);
     }
@@ -75,11 +72,11 @@ public class HandshakeListenerImplTest {
 
     @Test
     public void testOnHandshakeSuccessfull() throws Exception {
-        handshakeListener.onHandshakeSuccessful(features, version);
+        handshakeListener.onHandshakeSuccessful(features, OFConstants.OFP_VERSION_1_3);
         Mockito.verify(connectionContextSpy).changeStateToWorking();
         Mockito.verify(connectionContextSpy).setFeatures(Matchers.any(FeaturesReply.class));
         Mockito.verify(connectionContextSpy).setNodeId(nodeIdCaptor.capture());
-        Mockito.verify(connectionContextSpy).createDeviceInfo();
+        Mockito.verify(connectionContextSpy).handshakeSuccessful();
         Mockito.verify(deviceConnectedHandler).deviceConnected(connectionContextSpy);
         Mockito.verify(handshakeContext).close();
 
@@ -97,6 +94,7 @@ public class HandshakeListenerImplTest {
     @Test
     public void testOnHandshakeFailure2() throws Exception {
         Mockito.when(connectionAdapter.getRemoteAddress()).thenReturn(InetSocketAddress.createUnresolved("ut-ofp.example.org", 4242));
+        connectionContextSpy.setNodeId(new NodeId("openflow:1"));
         handshakeListener.onHandshakeFailure();
         Mockito.verify(handshakeContext).close();
         Mockito.verify(connectionContextSpy).closeConnection(false);