Add new tests, fix several mistakes, add and edit copyright comments
[openflowjava.git] / openflow-protocol-impl / src / test / java / org / opendaylight / openflowjava / protocol / impl / connection / UdpMessageListenerWrapperTest.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.connection;
10
11 import io.netty.util.concurrent.Future;
12 import io.netty.util.concurrent.GenericFutureListener;
13 import java.net.InetSocketAddress;
14 import org.junit.Assert;
15 import org.junit.Before;
16 import org.junit.Test;
17 import org.mockito.Mock;
18 import org.mockito.MockitoAnnotations;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
20
21 /**
22  * 
23  * @author madamjak
24  *
25  */
26 public class UdpMessageListenerWrapperTest {
27
28     @Mock GenericFutureListener<Future<Void>> listener;
29     @Mock OfHeader msg;
30     
31     @Before
32     public void startUp(){
33         MockitoAnnotations.initMocks(this);
34     }
35     /**
36      * Getters test
37      */
38     @Test
39     public void test(){
40         int port = 9876;
41         String host ="localhost";
42         InetSocketAddress inetSockAddr = InetSocketAddress.createUnresolved(host, port);
43         UdpMessageListenerWrapper wrapper = new UdpMessageListenerWrapper(msg,listener,inetSockAddr);
44
45         Assert.assertEquals("Wrong getAddress", inetSockAddr, wrapper.getAddress());
46         Assert.assertEquals("Wrong getListener", listener, wrapper.getListener());
47         Assert.assertEquals("Wrong getMsg", msg, wrapper.getMsg());
48     }
49
50 }