Introduce yangtools.binding.meta
[yangtools.git] / parser / yang-parser-rfc7950 / src / test / java / org / opendaylight / yangtools / yang / stmt / YT971Test.java
index 3644bd3daaab9cb7cd1f3afc5f4066c4be59f996..2078e4580c497f05377c508f510bc58b9aa4f154 100644 (file)
@@ -7,50 +7,40 @@
  */
 package org.opendaylight.yangtools.yang.stmt;
 
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.IsInstanceOf.instanceOf;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
 
 import java.util.Optional;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.QNameModule;
-import org.opendaylight.yangtools.yang.common.Revision;
-import org.opendaylight.yangtools.yang.common.XMLNamespace;
 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.api.type.Int16TypeDefinition;
 import org.opendaylight.yangtools.yang.model.api.type.Int32TypeDefinition;
 
-public class YT971Test {
-    private static final QNameModule NAMESPACE = QNameModule.create(XMLNamespace.of("test"), Revision.of("2019-03-25"));
+class YT971Test extends AbstractYangTest {
+    private static final QNameModule NAMESPACE = QNameModule.of("test", "2019-03-25");
 
     @Test
-    public void testEscapeLexer() throws Exception {
-        final SchemaContext schemaContext = StmtTestUtils.parseYangSource("/bugs/YT971/test.yang");
-        assertNotNull(schemaContext);
+    void testEscapeLexer() {
+        final var context = assertEffectiveModel("/bugs/YT971/test.yang");
 
-        final DataSchemaNode someContainer = schemaContext.getDataChildByName(
+        final DataSchemaNode someContainer = context.getDataChildByName(
             QName.create(NAMESPACE, "some-container"));
-        assertThat(someContainer, instanceOf(ContainerSchemaNode.class));
-        final ContainerSchemaNode containerSchemaNode = (ContainerSchemaNode) someContainer;
-
+        final ContainerSchemaNode containerSchemaNode = assertInstanceOf(ContainerSchemaNode.class, someContainer);
         final DataSchemaNode someLeaf = containerSchemaNode.getDataChildByName(QName.create(NAMESPACE, "some-leaf"));
-        assertThat(someLeaf, instanceOf(LeafSchemaNode.class));
-        final LeafSchemaNode leafSchemaNode = (LeafSchemaNode) someLeaf;
+        final LeafSchemaNode leafSchemaNode = assertInstanceOf(LeafSchemaNode.class, someLeaf);
         assertEquals(Optional.of("Some string that ends with a backslash (with escape backslash too) \\"),
-                     leafSchemaNode.getDescription());
-        assertThat(leafSchemaNode.getType(), instanceOf(Int16TypeDefinition.class));
+            leafSchemaNode.getDescription());
+        assertInstanceOf(Int16TypeDefinition.class, leafSchemaNode.getType());
 
         final DataSchemaNode someOtherLeaf = containerSchemaNode.getDataChildByName(
             QName.create(NAMESPACE, "some-other-leaf"));
-        assertThat(someOtherLeaf, instanceOf(LeafSchemaNode.class));
 
-        final LeafSchemaNode otherLeafSchemaNode = (LeafSchemaNode) someOtherLeaf;
+        final LeafSchemaNode otherLeafSchemaNode = assertInstanceOf(LeafSchemaNode.class, someOtherLeaf);
         assertEquals(Optional.of("Some string after the double backslash"), otherLeafSchemaNode.getDescription());
-        assertThat(otherLeafSchemaNode.getType(), instanceOf(Int32TypeDefinition.class));
+        assertInstanceOf(Int32TypeDefinition.class, otherLeafSchemaNode.getType());
     }
 }