BUG 2970 : Handle SchemaValidationFailedException instead of IllegalArgumentException
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / datastore / utils / PruningDataTreeModificationTest.java
index b5e6caee9aa2353f399b26e8f5a64e071139d6a7..67f60485df87b68eb9aaf304b3b82ba31a722503 100644 (file)
@@ -18,6 +18,7 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModificationCursor;
+import org.opendaylight.yangtools.yang.data.impl.schema.tree.SchemaValidationFailedException;
 
 public class PruningDataTreeModificationTest {
 
@@ -53,7 +54,7 @@ public class PruningDataTreeModificationTest {
     @Test
     public void testDeleteOnException(){
         YangInstanceIdentifier path = CarsModel.BASE_PATH;
-        doThrow(IllegalArgumentException.class).when(delegate).delete(path);
+        doThrow(SchemaValidationFailedException.class).when(delegate).delete(path);
 
         pruningDataTreeModification.delete(path);
 
@@ -75,7 +76,7 @@ public class PruningDataTreeModificationTest {
         NormalizedNode<?, ?> normalizedNode = CarsModel.create();
         YangInstanceIdentifier path = CarsModel.BASE_PATH;
 
-        doThrow(IllegalArgumentException.class).when(delegate).merge(path, normalizedNode);
+        doThrow(SchemaValidationFailedException.class).when(delegate).merge(path, normalizedNode);
         doReturn(true).when(validNamespaces).contains(any(YangInstanceIdentifier.PathArgument.class));
 
         pruningDataTreeModification.merge(path, normalizedNode);
@@ -98,7 +99,7 @@ public class PruningDataTreeModificationTest {
         NormalizedNode<?, ?> normalizedNode = CarsModel.create();
         YangInstanceIdentifier path = CarsModel.BASE_PATH;
 
-        doThrow(IllegalArgumentException.class).when(delegate).write(path, normalizedNode);
+        doThrow(SchemaValidationFailedException.class).when(delegate).write(path, normalizedNode);
         doReturn(true).when(validNamespaces).contains(any(YangInstanceIdentifier.PathArgument.class));
 
         pruningDataTreeModification.write(path, normalizedNode);