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
8 package org.opendaylight.netconf.api.messages;
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertTrue;
13 import java.util.Optional;
15 import org.junit.Test;
16 import org.opendaylight.netconf.api.NetconfDocumentedException;
18 public class NetconfHelloMessageTest {
19 private final Set<String> caps = Set.of("cap1");
22 public void testConstructor() throws NetconfDocumentedException {
23 var additionalHeader = new NetconfHelloMessageAdditionalHeader("name", "host", "1", "transp", "id");
24 var message = NetconfHelloMessage.createClientHello(caps, Optional.of(additionalHeader));
25 assertTrue(NetconfHelloMessage.isHelloMessage(message));
26 assertEquals(Optional.of(additionalHeader), message.getAdditionalHeader());
28 var serverMessage = NetconfHelloMessage.createServerHello(caps, 100L);
29 assertTrue(NetconfHelloMessage.isHelloMessage(serverMessage));