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;
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();
@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();
@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"));
}
}