Merge "BUG 1839 - HTTP delete of non existing data"
[controller.git] / opendaylight / netconf / netconf-util / src / test / java / org / opendaylight / controller / netconf / util / messages / NetconfHelloMessageAdditionalHeaderTest.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 import org.junit.Before;
12 import org.junit.Test;
13
14 import static org.junit.Assert.assertEquals;
15
16 public class NetconfHelloMessageAdditionalHeaderTest {
17
18
19     private String customHeader = "[user;1.1.1.1:40;tcp;client;]";
20     private NetconfHelloMessageAdditionalHeader header;
21
22     @Before
23     public void setUp() throws Exception {
24         header = new NetconfHelloMessageAdditionalHeader("user", "1.1.1.1", "40", "tcp", "client");
25     }
26
27     @Test
28     public void testGetters() throws Exception {
29         assertEquals(header.getAddress(), "1.1.1.1");
30         assertEquals(header.getUserName(), "user");
31         assertEquals(header.getPort(), "40");
32         assertEquals(header.getTransport(), "tcp");
33         assertEquals(header.getSessionIdentifier(), "client");
34     }
35
36     @Test
37     public void testStaticConstructor() throws Exception {
38         NetconfHelloMessageAdditionalHeader h = NetconfHelloMessageAdditionalHeader.fromString(customHeader);
39         assertEquals(h.toString(), header.toString());
40         assertEquals(h.toFormattedString(), header.toFormattedString());
41     }
42 }