Bug 5085: Clean-up test and retest JUnit tests
[yangtools.git] / yang / yang-parser-impl / 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.net.URISyntaxException;
15 import java.util.Set;
16 import org.junit.Before;
17 import org.junit.Test;
18 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
19 import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
20 import org.opendaylight.yangtools.yang.model.api.Module;
21 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
22 import org.opendaylight.yangtools.yang.stmt.TestUtils;
23
24 public class YinFileLeafListStmtTest {
25
26     private Set<Module> modules;
27
28     @Before
29     public void init() throws URISyntaxException, ReactorException {
30         modules = TestUtils.loadYinModules(getClass().getResource
31                 ("/semantic-statement-parser/yin/modules").toURI());
32         assertEquals(9, modules.size());
33     }
34
35     @Test
36     public void testLeafList() {
37         Module testModule = TestUtils.findModule(modules, "ietf-netconf-monitoring");
38         assertNotNull(testModule);
39
40         ContainerSchemaNode container = (ContainerSchemaNode) testModule.getDataChildByName("netconf-state");
41         assertNotNull(container);
42
43         container = (ContainerSchemaNode) container.getDataChildByName("capabilities");
44         assertNotNull(container);
45
46         LeafListSchemaNode leafList = (LeafListSchemaNode) container.getDataChildByName("capability");
47         assertNotNull(leafList);
48         assertEquals("uri", leafList.getType().getQName().getLocalName());
49         assertEquals("List of NETCONF capabilities supported by the server.", leafList.getDescription());
50         assertFalse(leafList.isUserOrdered());
51     }
52 }