Further cleanup of tests
[yangtools.git] / parser / yang-parser-rfc7950 / src / test / java / org / opendaylight / yangtools / yang / stmt / Bug7038Test.java
index 34294e62e733d23a301a92a3eb5511e5463b9181..d75cb90e37880f7ce468ac955535357c0c5da3e1 100644 (file)
@@ -9,10 +9,10 @@
 package org.opendaylight.yangtools.yang.stmt;
 
 import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.CoreMatchers.startsWith;
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
 
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.common.QName;
@@ -24,12 +24,11 @@ import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
 import org.opendaylight.yangtools.yang.model.api.stmt.ModuleStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.UnrecognizedStatement;
 import org.opendaylight.yangtools.yang.model.api.type.LeafrefTypeDefinition;
-import org.opendaylight.yangtools.yang.parser.spi.meta.SomeModifiersUnresolvedException;
 
-public class Bug7038Test {
+public class Bug7038Test extends AbstractYangTest {
     @Test
-    public void unknownNodeTest() throws Exception {
-        final ModuleStatement bar = StmtTestUtils.parseYangSources("/bugs/bug7038")
+    public void unknownNodeTest() {
+        final ModuleStatement bar = assertEffectiveModelDir("/bugs/bug7038")
             .getModuleStatement(QNameModule.create(XMLNamespace.of("bar"))).getDeclared();
         final UnrecognizedStatement decimal64 = bar.findFirstDeclaredSubstatement(UnrecognizedStatement.class)
             .orElseThrow();
@@ -39,7 +38,7 @@ public class Bug7038Test {
 
     @Test
     public void testYang11() throws Exception {
-        final ContainerSchemaNode root = (ContainerSchemaNode) StmtTestUtils.parseYangSources("/bugs/bug7038/yang11")
+        final ContainerSchemaNode root = (ContainerSchemaNode) assertEffectiveModelDir("/bugs/bug7038/yang11")
             .getDataChildByName(QName.create("foo", "root"));
         final TypeDefinition<?> typedef = ((LeafSchemaNode) root.getDataChildByName(QName.create("foo", "my-leafref")))
             .getType();
@@ -49,10 +48,7 @@ public class Bug7038Test {
 
     @Test
     public void testYang10() throws Exception {
-        try {
-            StmtTestUtils.parseYangSources("/bugs/bug7038/yang10");
-        } catch (final SomeModifiersUnresolvedException e) {
-            assertTrue(e.getCause().getMessage().startsWith("REQUIRE_INSTANCE is not valid for TYPE"));
-        }
+        assertInvalidSubstatementExceptionDir("/bugs/bug7038/yang10",
+            startsWith("REQUIRE_INSTANCE is not valid for TYPE"));
     }
 }