Adjust test suite parser update to conform with API changes
[yangtools.git] / yang / yang-parser-impl / src / test / java / org / opendaylight / yangtools / yang / stmt / Bug7038Test.java
1 /*
2  * Copyright (c) 2017 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
9 package org.opendaylight.yangtools.yang.stmt;
10
11 import static org.junit.Assert.assertEquals;
12 import static org.junit.Assert.assertNotNull;
13 import static org.junit.Assert.assertTrue;
14
15 import org.junit.Test;
16 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
17 import org.opendaylight.yangtools.yang.parser.spi.meta.SomeModifiersUnresolvedException;
18
19 public class Bug7038Test {
20     @Test
21     public void unknownNodeTest() throws Exception {
22         final SchemaContext context = StmtTestUtils.parseYangSources("/bugs/bug7038");
23         assertNotNull(context);
24         assertEquals(1, context.getUnknownSchemaNodes().size());
25     }
26
27     @Test
28     public void testYang11() throws Exception {
29         final SchemaContext context = StmtTestUtils.parseYangSources("/bugs/bug7038/yang11");
30         assertNotNull(context);
31     }
32
33     @Test
34     public void testYang10() throws Exception {
35         try {
36             StmtTestUtils.parseYangSources("/bugs/bug7038/yang10");
37         } catch (final SomeModifiersUnresolvedException e) {
38             assertTrue(e.getCause().getMessage().startsWith("REQUIRE_INSTANCE is not valid for TYPE"));
39         }
40     }
41 }