summaryrefslogtreecommitdiffstats
path: root/infra/data-impl/src/test
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2016-10-28 13:12:19 +0200
committerMarek Gradzki <mgradzki@cisco.com>2016-11-01 20:59:57 +0100
commitb8f86e7069a67031514c43caf8022e8553159fa7 (patch)
treed112017e36341e114fea4cdefdc5b2a8a90b2030 /infra/data-impl/src/test
parent80804f713cdd8d3c30c7e2dd19cbc2a61a1a70c0 (diff)
HONEYCOMB-272: bump mockito version to 2.2.9
ArgumentMatchers.any() does not match null anymore, so some of the tests has been updated. Change-Id: I5de0fdfe87fc8e5c8ce24bfae8daeaba032195ff Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'infra/data-impl/src/test')
-rw-r--r--infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/PersistingDataTreeAdapterTest.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/PersistingDataTreeAdapterTest.java b/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/PersistingDataTreeAdapterTest.java
index 8430073ac..ed3529530 100644
--- a/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/PersistingDataTreeAdapterTest.java
+++ b/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/PersistingDataTreeAdapterTest.java
@@ -22,8 +22,10 @@ import static org.mockito.Matchers.any;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
import com.google.common.base.Optional;
import java.io.IOException;
@@ -69,7 +71,7 @@ public class PersistingDataTreeAdapterTest {
doThrow(new IllegalStateException("testing errors")).when(delegatingDataTree).commit(any(DataTreeCandidate.class));
try {
- persistingDataTreeAdapter.commit(null);
+ persistingDataTreeAdapter.commit(mock(DataTreeCandidate.class));
fail("Exception expected");
} catch (IllegalStateException e) {
verify(delegatingDataTree, times(0)).takeSnapshot();
@@ -80,7 +82,10 @@ public class PersistingDataTreeAdapterTest {
@Test
public void testPersist() throws Exception {
persistingDataTreeAdapter = new PersistingDataTreeAdapter(delegatingDataTree, persister);
- persistingDataTreeAdapter.commit(null);
+ final DataTreeSnapshot snapshot = mock(DataTreeSnapshot.class);
+ when(snapshot.readNode(any())).thenReturn(Optional.absent());
+ when(delegatingDataTree.takeSnapshot()).thenReturn(snapshot);
+ persistingDataTreeAdapter.commit(mock(DataTreeCandidate.class));
verify(delegatingDataTree).takeSnapshot();
verify(persister).persistCurrentData(any(Optional.class));
}