Make DataTreeTip.prepare() throw a checked exception
[yangtools.git] / yang / yang-data-impl / src / test / java / org / opendaylight / yangtools / yang / data / impl / schema / tree / Bug3674Test.java
index 31355ff8b82b879533b36b86c016e81c1a503a11..cd9c35f577da93b816b99d2f33adeb3cdea1d82d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -8,12 +8,15 @@
 package org.opendaylight.yangtools.yang.data.impl.schema.tree;
 
 import static org.junit.Assert.assertEquals;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
+import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeConfiguration;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
+import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.ModificationType;
 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
 
@@ -22,13 +25,12 @@ import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
  *           DataTreeModification, but should appear as UNMODIFIED in the
  *           resulting DataTreeCandidate.
  */
-public class Bug3674Test {
+public class Bug3674Test extends AbstractTestModelTest {
     private DataTree tree;
 
     @Before
-    public void setUp() {
-        tree = InMemoryDataTreeFactory.getInstance().create();
-        tree.setSchemaContext(TestModel.createTestContext());
+    public void setUp() throws DataValidationFailedException {
+        tree = new InMemoryDataTreeFactory().create(DataTreeConfiguration.DEFAULT_OPERATIONAL, SCHEMA_CONTEXT);
 
         // Create the top-level container
         final DataTreeModification mod = tree.takeSnapshot().newModification();
@@ -38,7 +40,7 @@ public class Bug3674Test {
     }
 
     @Test
-    public void testDeleteOfNonExistingNode() {
+    public void testDeleteOfNonExistingNode() throws DataValidationFailedException {
         final DataTreeModification mod = tree.takeSnapshot().newModification();
         mod.delete(TestModel.OUTER_LIST_PATH);
         mod.ready();