Cleanup yang-data-impl tests
[yangtools.git] / yang / yang-data-impl / src / test / java / org / opendaylight / yangtools / yang / data / impl / schema / tree / Bug4454Test.java
index 90973e93d462c580884f72739c04d3cd75a6e03e..b1830dcd8bf9ab158ab434e8c5b868b1b15f4755 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.yangtools.yang.data.impl.schema.tree;
 
 import static junit.framework.TestCase.assertFalse;
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
@@ -17,7 +16,9 @@ import com.google.common.collect.ImmutableMap;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Optional;
+import org.junit.AfterClass;
 import org.junit.Before;
+import org.junit.BeforeClass;
 import org.junit.Test;
 import org.opendaylight.yangtools.util.UnmodifiableCollection;
 import org.opendaylight.yangtools.yang.common.QName;
@@ -98,12 +99,22 @@ public class Bug4454Test {
             .withNodeIdentifier(new NodeIdentifier(MIN_MAX_LIST_QNAME))
             .withChild(bazEntryNode).build();
 
+    private static SchemaContext schemaContext;
+
     private DataTree inMemoryDataTree;
 
+    @BeforeClass
+    public static void beforeClass() {
+        schemaContext = YangParserTestUtils.parseYangResource("/bug-4454-test.yang");
+    }
+
+    @AfterClass
+    public static void afterClass() {
+        schemaContext = null;
+    }
+
     @Before
     public void prepare() {
-        SchemaContext schemaContext = createTestContext();
-        assertNotNull("Schema context must not be null.", schemaContext);
         inMemoryDataTree =  new InMemoryDataTreeFactory().create(DataTreeConfiguration.DEFAULT_OPERATIONAL,
             schemaContext);
         final DataTreeSnapshot initialDataTreeSnapshot = inMemoryDataTree.takeSnapshot();
@@ -114,10 +125,6 @@ public class Bug4454Test {
         inMemoryDataTree.commit(inMemoryDataTree.prepare(modificationTree));
     }
 
-    public static SchemaContext createTestContext() {
-        return YangParserTestUtils.parseYangResource("/bug-4454-test.yang");
-    }
-
     @Test
     public void minMaxListDeleteWriteTest() throws DataValidationFailedException {
         final DataTreeModification modificationTree1 = inMemoryDataTree.takeSnapshot().newModification();