2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
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
9 package org.opendaylight.controller.netconf.util.messages;
11 import org.junit.Before;
12 import org.junit.Test;
14 import static org.junit.Assert.assertEquals;
16 public class NetconfHelloMessageAdditionalHeaderTest {
19 private String customHeader = "[user;1.1.1.1:40;tcp;client;]";
20 private NetconfHelloMessageAdditionalHeader header;
23 public void setUp() throws Exception {
24 header = new NetconfHelloMessageAdditionalHeader("user", "1.1.1.1", "40", "tcp", "client");
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");
37 public void testStaticConstructor() throws Exception {
38 NetconfHelloMessageAdditionalHeader h = NetconfHelloMessageAdditionalHeader.fromString(customHeader);
39 assertEquals(h.toString(), header.toString());
40 assertEquals(h.toFormattedString(), header.toFormattedString());