YANGTOOLS-706: Split out yang-parser-rfc7950
[yangtools.git] / yang / yang-parser-rfc7950 / src / test / java / org / opendaylight / yangtools / yang / stmt / Bug1413Test.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;
9
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertNotNull;
12 import static org.junit.Assert.assertTrue;
13
14 import java.util.List;
15 import org.junit.Test;
16 import org.opendaylight.yangtools.yang.model.api.ExtensionDefinition;
17 import org.opendaylight.yangtools.yang.model.api.Module;
18
19 /**
20  * Test ANTLR4 grammar capability to parse unknown node in extension argument
21  * declaration.
22  *
23  * <p>
24  * Note: Everything under unknown node is unknown node.
25  */
26 public class Bug1413Test {
27
28     @Test
29     public void test() throws Exception {
30         final Module bug1413 = TestUtils.findModule(
31             TestUtils.loadModules(getClass().getResource("/bugs/bug1413").toURI()), "bug1413").get();
32         assertNotNull(bug1413);
33
34         List<ExtensionDefinition> extensions = bug1413.getExtensionSchemaNodes();
35         assertEquals(1, extensions.size());
36
37         ExtensionDefinition info = extensions.get(0);
38         assertEquals("text", info.getArgument());
39         assertTrue(info.isYinElement());
40     }
41
42 }