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;
12 import static org.junit.Assert.assertEquals;
13 import static org.junit.Assert.assertTrue;
15 import com.google.common.base.Optional;
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;
22 public class NetconfHelloMessageTest {
28 caps = Sets.newSet("cap1");
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());
38 NetconfHelloMessage serverMessage = NetconfHelloMessage.createServerHello(caps, 100L);
39 assertTrue(NetconfHelloMessage.isHelloMessage(serverMessage));