Replace calls of StmtTestUtils.parseYangSource(String)
[yangtools.git] / parser / yang-parser-rfc7950 / src / test / java / org / opendaylight / yangtools / yang / stmt / YT857Test.java
index 834aeac605b78a96b71c936128ed2f497d6ef6a3..c9e2c680b9e720e3885ad243e76826f1eb3b2b52 100644 (file)
@@ -7,26 +7,14 @@
  */
 package org.opendaylight.yangtools.yang.stmt;
 
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.instanceOf;
 import static org.hamcrest.Matchers.startsWith;
-import static org.junit.Assert.fail;
 
 import org.junit.Test;
-import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
-import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
 
-public class YT857Test {
+public class YT857Test extends AbstractYangTest {
     @Test
-    public void testConflictDetection() throws Exception {
-        try {
-            StmtTestUtils.parseYangSource("/bugs/YT857/foo.yang");
-            fail("Conflict on models should have been detected");
-        } catch (ReactorException e) {
-            final Throwable cause = e.getCause();
-            assertThat(cause, instanceOf(SourceException.class));
-            assertThat(cause.getMessage(),
-                startsWith("Cannot add data tree child with name (foo)one, a conflicting child already exists"));
-        }
+    public void testConflictDetection() {
+        assertSourceException(startsWith("Cannot add data tree child with name (foo)one, a conflicting"
+                + " child already exists"), "/bugs/YT857/foo.yang");
     }
 }