Port yang-parser-rfc7950 to JUnit 5
[yangtools.git] / parser / yang-parser-rfc7950 / src / test / java / org / opendaylight / yangtools / yang / stmt / Bug9244Test.java
index e4a81c1bc89421762c2f7b98d1b878ffcc87841a..d1681b07b03c0c164ba112cee782e70bb76593f8 100644 (file)
@@ -7,12 +7,11 @@
  */
 package org.opendaylight.yangtools.yang.stmt;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 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.Revision;
 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
@@ -20,31 +19,25 @@ import org.opendaylight.yangtools.yang.model.api.ElementCountConstraint;
 import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-
-public class Bug9244Test {
 
+class Bug9244Test extends AbstractYangTest {
     @Test
-    public void testDeviateReplaceOfImplicitSubstatements() throws Exception {
-        final SchemaContext schemaContext = StmtTestUtils.parseYangSources("/bugs/bug9244/");
-        assertNotNull(schemaContext);
+    void testDeviateReplaceOfImplicitSubstatements() {
+        final var schemaContext = assertEffectiveModelDir("/bugs/bug9244/");
 
         final Module barModule = schemaContext.findModule("bar", Revision.of("2017-10-13")).get();
         final ContainerSchemaNode barCont = (ContainerSchemaNode) barModule.getDataChildByName(
-                QName.create(barModule.getQNameModule(), "bar-cont"));
-        assertNotNull(barCont);
+            QName.create(barModule.getQNameModule(), "bar-cont"));
         assertEquals(Optional.of(Boolean.FALSE), barCont.effectiveConfig());
 
         final LeafListSchemaNode barLeafList = (LeafListSchemaNode) barModule.getDataChildByName(
-                QName.create(barModule.getQNameModule(), "bar-leaf-list"));
-        assertNotNull(barLeafList);
+            QName.create(barModule.getQNameModule(), "bar-leaf-list"));
         final ElementCountConstraint constraint = barLeafList.getElementCountConstraint().get();
-        assertEquals((Object) 5, constraint.getMinElements());
-        assertEquals((Object) 10, constraint.getMaxElements());
+        assertEquals(5, constraint.getMinElements());
+        assertEquals(10, constraint.getMaxElements());
 
         final LeafSchemaNode barLeaf = (LeafSchemaNode) barModule.getDataChildByName(
-                QName.create(barModule.getQNameModule(), "bar-leaf"));
-        assertNotNull(barLeaf);
+            QName.create(barModule.getQNameModule(), "bar-leaf"));
         assertTrue(barLeaf.isMandatory());
     }
 }