Merge "Fix checkstyle warnings in netty-threadgroup-config."
[controller.git] / opendaylight / netconf / netconf-util / src / test / java / org / opendaylight / controller / netconf / util / messages / NetconfHelloMessageTest.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. 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.controller.netconf.util.messages;
10
11
12 import static org.junit.Assert.assertEquals;
13 import static org.junit.Assert.assertTrue;
14
15 import com.google.common.base.Optional;
16 import java.util.Set;
17 import org.junit.Before;
18 import org.junit.Test;
19 import org.mockito.internal.util.collections.Sets;
20 import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
21
22 public class NetconfHelloMessageTest {
23
24     Set<String> caps;
25
26     @Before
27     public void setUp() {
28         caps = Sets.newSet("cap1");
29     }
30
31     @Test
32     public void testConstructor() throws NetconfDocumentedException {
33         NetconfHelloMessageAdditionalHeader additionalHeader = new NetconfHelloMessageAdditionalHeader("name","host","1","transp","id");
34         NetconfHelloMessage message = NetconfHelloMessage.createClientHello(caps, Optional.of(additionalHeader));
35         assertTrue(NetconfHelloMessage.isHelloMessage(message));
36         assertEquals(Optional.of(additionalHeader), message.getAdditionalHeader());
37
38         NetconfHelloMessage serverMessage = NetconfHelloMessage.createServerHello(caps, 100L);
39         assertTrue(NetconfHelloMessage.isHelloMessage(serverMessage));
40     }
41 }