Skip to content

Commit 8e9a645

Browse files
author
Gabriel Erzse
committed
Add tests for Stream pipelined commands
Also adapt some migration pipelined tests, to assert the exact content of collections, not just subsets.
1 parent f692aa5 commit 8e9a645

2 files changed

Lines changed: 1345 additions & 20 deletions

File tree

src/test/java/redis/clients/jedis/MigratePipeliningTest.java

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
import static org.hamcrest.MatcherAssert.assertThat;
44
import static org.hamcrest.Matchers.both;
5+
import static org.hamcrest.Matchers.contains;
56
import static org.hamcrest.Matchers.containsString;
67
import static org.hamcrest.Matchers.equalTo;
7-
import static org.hamcrest.Matchers.hasItems;
88
import static org.hamcrest.Matchers.hasToString;
99
import static org.hamcrest.Matchers.instanceOf;
1010
import static org.junit.Assert.assertArrayEquals;
@@ -72,7 +72,7 @@ public void noKey() {
7272
p.migrate(host, port, db, timeout, new MigrateParams(), bfoo1, bfoo2, bfoo3);
7373

7474
assertThat(p.syncAndReturnAll(),
75-
hasItems("NOKEY", "NOKEY", "NOKEY", "NOKEY"));
75+
contains("NOKEY", "NOKEY", "NOKEY", "NOKEY"));
7676
}
7777

7878
@Test
@@ -86,7 +86,7 @@ public void migrate() {
8686
p.get("foo");
8787

8888
assertThat(p.syncAndReturnAll(),
89-
hasItems("OK", "OK", null));
89+
contains("OK", "OK", null));
9090

9191
assertEquals("bar", dest.get("foo"));
9292
}
@@ -102,7 +102,7 @@ public void migrateBinary() {
102102
p.get(bfoo);
103103

104104
assertThat(p.syncAndReturnAll(),
105-
hasItems("OK", "OK", null));
105+
contains("OK", "OK", null));
106106

107107
assertArrayEquals(bbar, dest.get(bfoo));
108108
}
@@ -118,7 +118,7 @@ public void migrateEmptyParams() {
118118
p.get("foo");
119119

120120
assertThat(p.syncAndReturnAll(),
121-
hasItems("OK", "OK", null));
121+
contains("OK", "OK", null));
122122

123123
assertEquals("bar", dest.get("foo"));
124124
}
@@ -134,7 +134,7 @@ public void migrateEmptyParamsBinary() {
134134
p.get(bfoo);
135135

136136
assertThat(p.syncAndReturnAll(),
137-
hasItems("OK", "OK", null));
137+
contains("OK", "OK", null));
138138

139139
assertArrayEquals(bbar, dest.get(bfoo));
140140
}
@@ -150,7 +150,7 @@ public void migrateCopy() {
150150
p.get("foo");
151151

152152
assertThat(p.syncAndReturnAll(),
153-
hasItems("OK", "OK", "bar"));
153+
contains("OK", "OK", "bar"));
154154

155155
assertEquals("bar", dest.get("foo"));
156156
}
@@ -166,7 +166,7 @@ public void migrateCopyBinary() {
166166
p.get(bfoo);
167167

168168
assertThat(p.syncAndReturnAll(),
169-
hasItems("OK", "OK", bbar));
169+
contains("OK", "OK", bbar));
170170

171171
assertArrayEquals(bbar, dest.get(bfoo));
172172
}
@@ -184,7 +184,7 @@ public void migrateReplace() {
184184
p.get("foo");
185185

186186
assertThat(p.syncAndReturnAll(),
187-
hasItems("OK", "OK", null));
187+
contains("OK", "OK", null));
188188

189189
assertEquals("bar1", dest.get("foo"));
190190
}
@@ -202,7 +202,7 @@ public void migrateReplaceBinary() {
202202
p.get(bfoo);
203203

204204
assertThat(p.syncAndReturnAll(),
205-
hasItems("OK", "OK", null));
205+
contains("OK", "OK", null));
206206

207207
assertArrayEquals(bbar1, dest.get(bfoo));
208208
}
@@ -220,7 +220,7 @@ public void migrateCopyReplace() {
220220
p.get("foo");
221221

222222
assertThat(p.syncAndReturnAll(),
223-
hasItems("OK", "OK", "bar1"));
223+
contains("OK", "OK", "bar1"));
224224

225225
assertEquals("bar1", dest.get("foo"));
226226
}
@@ -238,7 +238,7 @@ public void migrateCopyReplaceBinary() {
238238
p.get(bfoo);
239239

240240
assertThat(p.syncAndReturnAll(),
241-
hasItems("OK", "OK", bbar1));
241+
contains("OK", "OK", bbar1));
242242

243243
assertArrayEquals(bbar1, dest.get(bfoo));
244244
}
@@ -254,7 +254,7 @@ public void migrateAuth() {
254254
p.get("foo");
255255

256256
assertThat(p.syncAndReturnAll(),
257-
hasItems("OK", "OK", null));
257+
contains("OK", "OK", null));
258258

259259
assertEquals("bar", destAuth.get("foo"));
260260
}
@@ -270,7 +270,7 @@ public void migrateAuthBinary() {
270270
p.get(bfoo);
271271

272272
assertThat(p.syncAndReturnAll(),
273-
hasItems("OK", "OK", null));
273+
contains("OK", "OK", null));
274274

275275
assertArrayEquals(bbar, destAuth.get(bfoo));
276276
}
@@ -287,7 +287,7 @@ public void migrateAuth2() {
287287
p.get("foo");
288288

289289
assertThat(p.syncAndReturnAll(),
290-
hasItems("OK", "OK", null));
290+
contains("OK", "OK", null));
291291

292292
assertEquals("bar", jedis.get("foo"));
293293
}
@@ -304,7 +304,7 @@ public void migrateAuth2Binary() {
304304
p.get(bfoo);
305305

306306
assertThat(p.syncAndReturnAll(),
307-
hasItems("OK", "OK", null));
307+
contains("OK", "OK", null));
308308

309309
assertArrayEquals(bbar, jedis.get(bfoo));
310310
}
@@ -321,7 +321,7 @@ public void migrateMulti() {
321321
p.migrate(host, port, db, timeout, new MigrateParams(), "foo1", "foo2", "foo3");
322322

323323
assertThat(p.syncAndReturnAll(),
324-
hasItems("OK", "OK"));
324+
contains("OK", "OK"));
325325

326326
assertEquals("bar1", dest.get("foo1"));
327327
assertEquals("bar2", dest.get("foo2"));
@@ -340,7 +340,7 @@ public void migrateMultiBinary() {
340340
p.migrate(host, port, db, timeout, new MigrateParams(), bfoo1, bfoo2, bfoo3);
341341

342342
assertThat(p.syncAndReturnAll(),
343-
hasItems("OK", "OK"));
343+
contains("OK", "OK"));
344344

345345
assertArrayEquals(bbar1, dest.get(bfoo1));
346346
assertArrayEquals(bbar2, dest.get(bfoo2));
@@ -361,7 +361,7 @@ public void migrateConflict() {
361361
p.migrate(host, port, db, timeout, new MigrateParams(), "foo1", "foo2", "foo3");
362362

363363
assertThat(p.syncAndReturnAll(),
364-
hasItems(
364+
contains(
365365
equalTo("OK"),
366366
both(instanceOf(JedisDataException.class)).and(hasToString(containsString("BUSYKEY")))
367367
));
@@ -385,7 +385,7 @@ public void migrateConflictBinary() {
385385
p.migrate(host, port, db, timeout, new MigrateParams(), bfoo1, bfoo2, bfoo3);
386386

387387
assertThat(p.syncAndReturnAll(),
388-
hasItems(
388+
contains(
389389
equalTo("OK"),
390390
both(instanceOf(JedisDataException.class)).and(hasToString(containsString("BUSYKEY")))
391391
));

0 commit comments

Comments
 (0)