X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=parser%2Fyang-parser-rfc7950%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fyangtools%2Fyang%2Fstmt%2FBug8126Test.java;h=653d0f386c98898081233884ac1661e4eba5a47c;hb=ad338ff278f137696478df3d27675f1d1e78a8eb;hp=586baeda12f257ace36c9b27ea98ddfc2408e845;hpb=083ef931709258bed6e0fede5eea7fe3f63ddecc;p=yangtools.git diff --git a/parser/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug8126Test.java b/parser/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug8126Test.java index 586baeda12..653d0f386c 100644 --- a/parser/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug8126Test.java +++ b/parser/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug8126Test.java @@ -11,7 +11,6 @@ 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.assertThrows; import java.util.Optional; import org.junit.Test; @@ -19,17 +18,14 @@ import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.common.QNameModule; import org.opendaylight.yangtools.yang.common.XMLNamespace; import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode; -import org.opendaylight.yangtools.yang.model.api.stmt.ModuleEffectiveStatement; -import org.opendaylight.yangtools.yang.parser.spi.meta.InferenceException; -import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException; -public class Bug8126Test { +public class Bug8126Test extends AbstractYangTest { private static final XMLNamespace FOO_NS = XMLNamespace.of("foo"); private static final XMLNamespace BAR_NS = XMLNamespace.of("bar"); @Test - public void testValidAugments() throws Exception { - final ModuleEffectiveStatement fooModule = StmtTestUtils.parseYangSources("/bugs/bug8126/valid") + public void testValidAugments() { + final var fooModule = assertEffectiveModelDir("/bugs/bug8126/valid") .getModuleStatement(QNameModule.create(FOO_NS)); assertThat(fooModule.findSchemaTreeNode( foo("root"), bar("my-container"), bar("my-choice"), bar("one"), bar("one"), bar("mandatory-leaf")) @@ -45,31 +41,19 @@ public class Bug8126Test { @Test public void testAugmentMandatoryChoice() { - final ReactorException ex = assertThrows(ReactorException.class, - () -> StmtTestUtils.parseYangSources("/bugs/bug8126/inv-choice")); - final Throwable cause = ex.getCause(); - assertThat(cause, instanceOf(InferenceException.class)); - assertThat(cause.getMessage(), startsWith( + assertInferenceExceptionDir("/bugs/bug8126/inv-choice", startsWith( "An augment cannot add node 'mandatory-choice' because it is mandatory and in module different than ")); } @Test public void testAugmentMandatoryList() { - final ReactorException ex = assertThrows(ReactorException.class, - () -> StmtTestUtils.parseYangSources("/bugs/bug8126/inv-list")); - final Throwable cause = ex.getCause(); - assertThat(cause, instanceOf(InferenceException.class)); - assertThat(cause.getMessage(), startsWith( + assertInferenceExceptionDir("/bugs/bug8126/inv-list", startsWith( "An augment cannot add node 'mandatory-list' because it is mandatory and in module different than ")); } @Test public void testAugmentMandatoryContainer() { - final ReactorException ex = assertThrows(ReactorException.class, - () -> StmtTestUtils.parseYangSources("/bugs/bug8126/inv-cont")); - final Throwable cause = ex.getCause(); - assertThat(cause, instanceOf(InferenceException.class)); - assertThat(cause.getMessage(), startsWith( + assertInferenceExceptionDir("/bugs/bug8126/inv-cont", startsWith( "An augment cannot add node 'mandatory-leaf-3' because it is mandatory and in module different than ")); }