You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2021/05/10 20:48:38 UTC
[ignite-3] 09/09: IGNITE-14389 Fixed WatchAggregatorTest
This is an automated email from the ASF dual-hosted git repository.
agura pushed a commit to branch ignite-14389
in repository https://gitbox.apache.org/repos/asf/ignite-3.git
commit fd1ae78ca056247477e7640a791374136cd47014
Author: Andrey Gura <ag...@apache.org>
AuthorDate: Mon May 10 20:07:39 2021 +0300
IGNITE-14389 Fixed WatchAggregatorTest
---
.../ignite/internal/metastorage/WatchAggregatorTest.java | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/modules/metastorage/src/test/java/org/apache/ignite/internal/metastorage/WatchAggregatorTest.java b/modules/metastorage/src/test/java/org/apache/ignite/internal/metastorage/WatchAggregatorTest.java
index 038b774..0ff023a 100644
--- a/modules/metastorage/src/test/java/org/apache/ignite/internal/metastorage/WatchAggregatorTest.java
+++ b/modules/metastorage/src/test/java/org/apache/ignite/internal/metastorage/WatchAggregatorTest.java
@@ -28,6 +28,8 @@ import org.apache.ignite.metastorage.client.WatchListener;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.junit.jupiter.api.Test;
+import org.mockito.ArgumentCaptor;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
@@ -49,19 +51,20 @@ public class WatchAggregatorTest {
entry("1", "value1n", 1)
);
- var watchEvent1 = new WatchEvent(entryEvt1);
-
var entryEvt2 = new EntryEvent(
entry("2", "value2", 1),
entry("2", "value2n", 1)
);
- var watchEvent2 = new WatchEvent(entryEvt2);
-
watchAggregator.watch(1, (v1, v2) -> {}).get().listener().onUpdate(new WatchEvent(List.of(entryEvt1, entryEvt2)));
- verify(lsnr1).onUpdate(watchEvent1);
- verify(lsnr2).onUpdate(watchEvent2);
+ var watchEvt1Res = ArgumentCaptor.forClass(WatchEvent.class);
+ verify(lsnr1).onUpdate(watchEvt1Res.capture());
+ assertEquals(List.of(entryEvt1), watchEvt1Res.getValue().entryEvents());
+
+ var watchEvt2Res = ArgumentCaptor.forClass(WatchEvent.class);
+ verify(lsnr2).onUpdate(watchEvt2Res.capture());
+ assertEquals(List.of(entryEvt2), watchEvt2Res.getValue().entryEvents());
}
@Test