Add AbstractYangTest
[yangtools.git] / parser / yang-parser-rfc7950 / src / test / java / org / opendaylight / yangtools / yang / stmt / Bug8831Test.java
index fd513b5b181955061ec26129e3ef2513ecad756e..3e63fdaf6750752857f175f5dfa57a5dd94df6cf 100644 (file)
@@ -8,36 +8,24 @@
 package org.opendaylight.yangtools.yang.stmt;
 
 import static org.hamcrest.CoreMatchers.containsString;
-import static org.hamcrest.CoreMatchers.instanceOf;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThrows;
 
 import org.junit.Test;
-import org.opendaylight.yangtools.yang.parser.spi.meta.SomeModifiersUnresolvedException;
-import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
 
-public class Bug8831Test {
+public class Bug8831Test extends AbstractYangTest {
     @Test
     public void test() throws Exception {
-        assertNotNull(TestUtils.loadModules("/bugs/bug8831/valid"));
+        assertEffectiveModelDir("/bugs/bug8831/valid");
     }
 
     @Test
     public void invalidModelsTest() {
-        final var ex = assertThrows(SomeModifiersUnresolvedException.class,
-            () -> TestUtils.parseYangSource("/bugs/bug8831/invalid/inv-model.yang"));
-        final var cause = ex.getCause();
-        assertThat(cause, instanceOf(SourceException.class));
-        assertThat(cause.getMessage(), containsString("has default value 'any' marked with an if-feature statement"));
+        assertSourceException(containsString("has default value 'any' marked with an if-feature statement"),
+            "/bugs/bug8831/invalid/inv-model.yang");
     }
 
     @Test
     public void invalidModelsTest2() {
-        final var ex = assertThrows(SomeModifiersUnresolvedException.class,
-            () -> TestUtils.parseYangSource("/bugs/bug8831/invalid/inv-model2.yang"));
-        final var cause = ex.getCause();
-        assertThat(cause, instanceOf(SourceException.class));
-        assertThat(cause.getMessage(), containsString("has default value 'any' marked with an if-feature statement"));
+        assertSourceException(containsString("has default value 'any' marked with an if-feature statement"),
+            "/bugs/bug8831/invalid/inv-model2.yang");
     }
 }