Add method to register listener for unknown msg
[openflowjava.git] / openflow-protocol-impl / src / test / java / org / opendaylight / openflowjava / protocol / impl / core / connection / ConnectionAdapterFactoryImplTest.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 package org.opendaylight.openflowjava.protocol.impl.core.connection;
9
10 import static org.mockito.Mockito.when;
11 import io.netty.channel.Channel;
12 import io.netty.channel.ChannelPipeline;
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 /**
20  *
21  * @author madamjak
22  *
23  */
24 public class ConnectionAdapterFactoryImplTest {
25
26     @Mock ChannelPipeline channnelPipe;
27     @Mock Channel channel;
28     @Mock InetSocketAddress address;
29
30     @Before
31     public void startUp(){
32         MockitoAnnotations.initMocks(this);
33         when(channel.pipeline()).thenReturn(channnelPipe);
34     }
35
36     @Test
37     public void test(){
38         final ConnectionAdapterFactoryImpl connAdapterFactory = new ConnectionAdapterFactoryImpl();
39         final ConnectionFacade connFacade = connAdapterFactory.createConnectionFacade(channel, address, true);
40         Assert.assertNotNull("Wrong - ConnectionFacade has not created.", connFacade);
41         Assert.assertEquals("Wrong - diffrence between channel.isOpen() and ConnectionFacade.isAlive()", channel.isOpen(), connFacade.isAlive());
42     }
43 }