From: Robert Varga Date: Sat, 2 Oct 2021 15:56:31 +0000 (+0200) Subject: Improve UsesAugmentTest X-Git-Tag: v8.0.0~212 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=8b4fe8c6fab6dd03adcecbd07ea57c784363eca3;p=yangtools.git Improve UsesAugmentTest We have two tests sharing the reactor, use beforeClass() build it only once and use better loading method to do that. Change-Id: I82993ea04087c2ee90da40f2aee786a0cde95ee8 Signed-off-by: Robert Varga --- diff --git a/parser/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/UsesAugmentTest.java b/parser/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/UsesAugmentTest.java index ba0737376f..4169541241 100644 --- a/parser/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/UsesAugmentTest.java +++ b/parser/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/UsesAugmentTest.java @@ -13,7 +13,7 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import java.util.Collection; -import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Test; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.common.QNameModule; @@ -38,11 +38,11 @@ public class UsesAugmentTest { private static final QNameModule GD = QNameModule.create( XMLNamespace.of("urn:opendaylight:params:xml:ns:yang:grouping-definitions"), Revision.of("2013-09-04")); - private SchemaContext context; + private static SchemaContext CONTEXT; - @Before - public void init() throws Exception { - context = TestUtils.loadModules(getClass().getResource("/grouping-test").toURI()); + @BeforeClass + public static void beforeClass() throws Exception { + CONTEXT = TestUtils.loadModules("/grouping-test"); } /* @@ -103,7 +103,7 @@ public class UsesAugmentTest { */ @Test public void testAugmentInUses() throws Exception { - final Module testModule = context.findModules("uses-grouping").iterator().next(); + final Module testModule = CONTEXT.findModules("uses-grouping").iterator().next(); // * notification pcreq final Collection notifications = testModule.getNotifications(); @@ -406,7 +406,7 @@ public class UsesAugmentTest { @Test public void testTypedefs() throws Exception { - final Module testModule = context.findModules("grouping-definitions").iterator().next(); + final Module testModule = CONTEXT.findModules("grouping-definitions").iterator().next(); final Collection> types = testModule.getTypeDefinitions(); TypeDefinition intExt = null;