*/
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.assertInstanceOf;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.opendaylight.yangtools.yang.stmt.StmtTestUtils.sourceForResource;
-import java.io.FileNotFoundException;
-import java.net.URISyntaxException;
-import java.util.Collection;
-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.XMLNamespace;
import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
import org.opendaylight.yangtools.yang.model.api.GroupingDefinition;
import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.opendaylight.yangtools.yang.parser.rfc7950.reactor.RFC7950Reactors;
import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
import org.opendaylight.yangtools.yang.parser.spi.source.StatementStreamSource;
-public class EffectiveBuildTest {
+class EffectiveBuildTest {
private static final StatementStreamSource SIMPLE_MODULE = sourceForResource(
- "/stmt-test/effective-build/simple-module.yang");
+ "/stmt-test/effective-build/simple-module.yang");
private static final QNameModule SIMPLE_MODULE_QNAME = QNameModule.create(XMLNamespace.of("simple.yang"));
private static final StatementStreamSource YANG_EXT = sourceForResource(
- "/stmt-test/extensions/yang-ext.yang");
+ "/stmt-test/extensions/yang-ext.yang");
@Test
- public void effectiveBuildTest() throws ReactorException {
- SchemaContext result = RFC7950Reactors.defaultReactor().newBuild().addSources(SIMPLE_MODULE)
- .buildEffective();
+ void effectiveBuildTest() throws ReactorException {
+ var result = RFC7950Reactors.defaultReactor().newBuild().addSources(SIMPLE_MODULE)
+ .buildEffective();
assertNotNull(result);
}
@Test
- public void extensionsTest() throws ReactorException {
- SchemaContext result = RFC7950Reactors.defaultReactor().newBuild().addSource(YANG_EXT).buildEffective();
+ void extensionsTest() throws ReactorException {
+ var result = RFC7950Reactors.defaultReactor().newBuild().addSource(YANG_EXT).buildEffective();
assertNotNull(result);
- Collection<? extends GroupingDefinition> groupings = result.getGroupings();
+ var groupings = result.getGroupings();
assertEquals(1, groupings.size());
- GroupingDefinition grp = groupings.iterator().next();
+ var grp = groupings.iterator().next();
- Collection<? extends DataSchemaNode> childNodes = grp.getChildNodes();
+ var childNodes = grp.getChildNodes();
assertEquals(1, childNodes.size());
- DataSchemaNode child = childNodes.iterator().next();
- assertTrue(child instanceof LeafSchemaNode);
- LeafSchemaNode leaf = (LeafSchemaNode) child;
+ LeafSchemaNode leaf = assertInstanceOf(LeafSchemaNode.class, childNodes.iterator().next());
assertNotNull(leaf.getType());
}
@Test
- public void mockTest() throws ReactorException, FileNotFoundException, URISyntaxException {
- SchemaContext result = RFC7950Reactors.defaultReactor().newBuild().addSource(YANG_EXT).buildEffective();
+ void mockTest() throws Exception {
+ var result = RFC7950Reactors.defaultReactor().newBuild().addSource(YANG_EXT).buildEffective();
assertNotNull(result);
}
}