From b8f86e7069a67031514c43caf8022e8553159fa7 Mon Sep 17 00:00:00 2001 From: Marek Gradzki Date: Fri, 28 Oct 2016 13:12:19 +0200 Subject: 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 --- .../io/fd/honeycomb/data/impl/PersistingDataTreeAdapterTest.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'infra/data-impl/src') 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)); } -- cgit 1.2.3-korg