8cdca399f99e36f15d69ac094228b73afd250a2e
[openflowjava.git] / openflow-protocol-impl / src / test / java / org / opendaylight / openflowjava / protocol / impl / core / VersionMessageUdpWrapperTest.java
1 /*
2  * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.openflowjava.protocol.impl.core;
10
11 import io.netty.buffer.ByteBuf;
12 import java.net.InetSocketAddress;
13 import org.junit.Before;
14 import org.junit.Test;
15 import org.junit.Assert;
16 import org.mockito.Mock;
17 import org.mockito.MockitoAnnotations;
18
19 /**
20  * 
21  * @author madamjak
22  *
23  */
24
25 public class VersionMessageUdpWrapperTest {
26
27     @Mock ByteBuf byteBuff;
28     @Before
29     public void startUp(){
30         MockitoAnnotations.initMocks(this);
31     }
32     
33     @Test
34     public void test(){
35         short version = 35;
36         int port = 9876;
37         String host ="localhost";
38         InetSocketAddress inetSockAddr = InetSocketAddress.createUnresolved(host, port);
39         VersionMessageUdpWrapper wrapper = new VersionMessageUdpWrapper(version,byteBuff,inetSockAddr);
40
41         Assert.assertEquals("Wrong getAddress", inetSockAddr, wrapper.getAddress());
42         Assert.assertEquals("Wrong getVersion", version, wrapper.getVersion());
43         Assert.assertEquals("Wrong getVersion", byteBuff, wrapper.getMessageBuffer());
44     }
45 }