Bump odlparent/yangtools versions to 4.0.0/2.1.0-SNAPSHOT
[mdsal.git] / dom / mdsal-dom-spi / src / test / java / org / opendaylight / mdsal / dom / spi / store / SnapshotBackedWriteTransactionTest.java
index 07e5b0c8e3c96661109011a162ece8a9ee064fa5..9a072b50ca123f5ede6886c3a481a955d0f1a97c 100644 (file)
@@ -9,9 +9,10 @@ package org.opendaylight.mdsal.dom.spi.store;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Matchers.same;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.ArgumentMatchers.same;
+import static org.mockito.Mockito.doAnswer;
 import static org.mockito.Mockito.doNothing;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.doThrow;
@@ -98,19 +99,25 @@ public class SnapshotBackedWriteTransactionTest {
 
     @Test(expected = IllegalArgumentException.class)
     public void writeWithException() throws Exception {
-        doThrow(TestException.class).when(DATA_TREE_MODIFICATION).write(any(), any());
+        doAnswer(inv -> {
+            throw new TestException();
+        }).when(DATA_TREE_MODIFICATION).write(any(), any());
         snapshotBackedWriteTransaction.write(YangInstanceIdentifier.EMPTY, NORMALIZED_NODE);
     }
 
     @Test(expected = IllegalArgumentException.class)
     public void mergeWithException() throws Exception {
-        doThrow(TestException.class).when(DATA_TREE_MODIFICATION).merge(any(), any());
+        doAnswer(inv -> {
+            throw new TestException();
+        }).when(DATA_TREE_MODIFICATION).merge(any(), any());
         snapshotBackedWriteTransaction.merge(YangInstanceIdentifier.EMPTY, NORMALIZED_NODE);
     }
 
     @Test(expected = IllegalArgumentException.class)
     public void deleteWithException() throws Exception {
-        doThrow(TestException.class).when(DATA_TREE_MODIFICATION).delete(any());
+        doAnswer(inv -> {
+            throw new TestException();
+        }).when(DATA_TREE_MODIFICATION).delete(any());
         snapshotBackedWriteTransaction.delete(YangInstanceIdentifier.EMPTY);
     }