@RunWith(MockitoJUnitRunner.class)
public class HandshakeListenerImplTest {
- private final Short version = OFConstants.OFP_VERSION_1_3;
-
@Mock
private DeviceConnectedHandler deviceConnectedHandler;
@Mock
connectionContextSpy = Mockito.spy(new ConnectionContextImpl(connectionAdapter));
Mockito.when(connectionContextSpy.getConnectionAdapter()).thenReturn(connectionAdapter);
Mockito.when(features.getDatapathId()).thenReturn(BigInteger.TEN);
- Mockito.doNothing().when(connectionContextSpy).handshakeSuccessful();
handshakeListener = new HandshakeListenerImpl(connectionContextSpy, deviceConnectedHandler);
handshakeListener.setHandshakeContext(handshakeContext);
}
@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());