e4280840cc01a94980e1a89a5df52d64563a72fd
[netconf.git] / netconf / netconf-api / src / test / java / org / opendaylight / netconf / api / 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 package org.opendaylight.netconf.api.messages;
9
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertTrue;
12
13 import java.util.Optional;
14 import java.util.Set;
15 import org.junit.Test;
16 import org.opendaylight.netconf.api.NetconfDocumentedException;
17
18 public class NetconfHelloMessageTest {
19     private final Set<String> caps = Set.of("cap1");
20
21     @Test
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());
27
28         var serverMessage = NetconfHelloMessage.createServerHello(caps, 100L);
29         assertTrue(NetconfHelloMessage.isHelloMessage(serverMessage));
30     }
31 }