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.netconf.api.messages;
11 import static org.junit.Assert.assertEquals;
12 import static org.junit.Assert.assertTrue;
14 import com.google.common.base.Optional;
16 import org.junit.Before;
17 import org.junit.Test;
18 import org.mockito.internal.util.collections.Sets;
19 import org.opendaylight.netconf.api.NetconfDocumentedException;
21 public class NetconfHelloMessageTest {
27 caps = Sets.newSet("cap1");
31 public void testConstructor() throws NetconfDocumentedException {
32 NetconfHelloMessageAdditionalHeader additionalHeader = new NetconfHelloMessageAdditionalHeader("name",
33 "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));