Populate xpath/ hierarchy
[yangtools.git] / parser / yang-parser-rfc7950 / src / test / java / org / opendaylight / yangtools / yang / stmt / yin / YinFileLeafListStmtTest.java
1 /*
2  * Copyright (c) 2016 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.yangtools.yang.stmt.yin;
9
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertFalse;
12 import static org.junit.Assert.assertNotNull;
13
14 import java.util.Optional;
15 import org.junit.Test;
16 import org.opendaylight.yangtools.yang.common.QName;
17 import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
18 import org.opendaylight.yangtools.yang.model.api.Module;
19 import org.opendaylight.yangtools.yang.stmt.TestUtils;
20
21 public class YinFileLeafListStmtTest extends AbstractYinModulesTest {
22
23     @Test
24     public void testLeafList() {
25         final Module testModule = TestUtils.findModule(context, "ietf-netconf-monitoring").get();
26
27         final LeafListSchemaNode leafList = (LeafListSchemaNode) testModule.findDataChildByName(
28             QName.create(testModule.getQNameModule(), "netconf-state"),
29             QName.create(testModule.getQNameModule(), "capabilities"),
30             QName.create(testModule.getQNameModule(), "capability")).get();
31         assertNotNull(leafList);
32         assertEquals("uri", leafList.getType().getQName().getLocalName());
33         assertEquals(Optional.of("List of NETCONF capabilities supported by the server."), leafList.getDescription());
34         assertFalse(leafList.isUserOrdered());
35     }
36 }