You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by se...@apache.org on 2019/11/06 20:42:50 UTC

[flink] 03/04: [hotfix][tests] Replace mockito-based verification with property verification.

This is an automated email from the ASF dual-hosted git repository.

sewen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git

commit 60a066abb5509b97915618d4d1a2729acced6e94
Author: Stephan Ewen <se...@apache.org>
AuthorDate: Wed Nov 6 13:41:30 2019 +0100

    [hotfix][tests] Replace mockito-based verification with property verification.
---
 .../flink/runtime/state/heap/CopyOnWriteStateMapTest.java      | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/state/heap/CopyOnWriteStateMapTest.java b/flink-runtime/src/test/java/org/apache/flink/runtime/state/heap/CopyOnWriteStateMapTest.java
index 6479ee9..d761808 100644
--- a/flink-runtime/src/test/java/org/apache/flink/runtime/state/heap/CopyOnWriteStateMapTest.java
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/state/heap/CopyOnWriteStateMapTest.java
@@ -27,10 +27,9 @@ import org.apache.flink.runtime.state.StateTransformationFunction;
 import org.apache.flink.runtime.state.internal.InternalKvState.StateIncrementalVisitor;
 import org.apache.flink.util.TestLogger;
 
+import org.hamcrest.Matchers;
 import org.junit.Assert;
 import org.junit.Test;
-import org.mockito.Matchers;
-import org.mockito.Mockito;
 
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -402,7 +401,7 @@ public class CopyOnWriteStateMapTest extends TestLogger {
 	@Test
 	public void testSnapshotRelease() {
 		final CopyOnWriteStateMap<Integer, Integer, Integer> stateMap =
-			Mockito.spy(new CopyOnWriteStateMap<>(IntSerializer.INSTANCE));
+			new CopyOnWriteStateMap<>(IntSerializer.INSTANCE);
 
 		for (int i = 0; i < 10; i++) {
 			stateMap.put(i, i, i);
@@ -410,14 +409,15 @@ public class CopyOnWriteStateMapTest extends TestLogger {
 
 		CopyOnWriteStateMapSnapshot<Integer, Integer, Integer> snapshot = stateMap.stateSnapshot();
 		Assert.assertFalse(snapshot.isReleased());
+		Assert.assertThat(stateMap.getSnapshotVersions(), Matchers.contains(snapshot.getSnapshotVersion()));
 
 		snapshot.release();
 		Assert.assertTrue(snapshot.isReleased());
-		Mockito.verify(stateMap, Mockito.times(1)).releaseSnapshot(Matchers.same(snapshot));
+		Assert.assertThat(stateMap.getSnapshotVersions(), Matchers.empty());
 
 		// verify that snapshot will release itself only once
 		snapshot.release();
-		Mockito.verify(stateMap, Mockito.times(1)).releaseSnapshot(Matchers.same(snapshot));
+		Assert.assertThat(stateMap.getSnapshotVersions(), Matchers.empty());
 	}
 
 	@SuppressWarnings("unchecked")