|
40 | 40 | * |
41 | 41 | * @author Mark Paluch |
42 | 42 | * @author Christoph Strobl |
| 43 | + * @author Mingi Lee |
43 | 44 | */ |
44 | 45 | @ParameterizedClass |
45 | 46 | @MethodSource("testParams") |
@@ -230,6 +231,39 @@ void intersectAndStore() { |
230 | 231 | setOperations.isMember(destKey, shared).as(StepVerifier::create).expectNext(true).verifyComplete(); |
231 | 232 | } |
232 | 233 |
|
| 234 | + @Test |
| 235 | + @EnabledOnCommand("SINTERCARD") |
| 236 | + void intersectSize() { |
| 237 | + |
| 238 | + K key = keyFactory.instance(); |
| 239 | + K otherKey = keyFactory.instance(); |
| 240 | + K thirdKey = keyFactory.instance(); |
| 241 | + |
| 242 | + V onlyInKey = valueFactory.instance(); |
| 243 | + V shared1 = valueFactory.instance(); |
| 244 | + V shared2 = valueFactory.instance(); |
| 245 | + V onlyInOtherKey = valueFactory.instance(); |
| 246 | + |
| 247 | + setOperations.add(key, onlyInKey, shared1, shared2).as(StepVerifier::create).expectNext(3L).verifyComplete(); |
| 248 | + setOperations.add(otherKey, onlyInOtherKey, shared1, shared2).as(StepVerifier::create).expectNext(3L) |
| 249 | + .verifyComplete(); |
| 250 | + setOperations.add(thirdKey, shared1).as(StepVerifier::create).expectNext(1L).verifyComplete(); |
| 251 | + |
| 252 | + // Test intersectSize(key, otherKey) |
| 253 | + setOperations.intersectSize(key, otherKey).as(StepVerifier::create).expectNext(2L).verifyComplete(); |
| 254 | + |
| 255 | + // Test intersectSize(key, Collection) |
| 256 | + setOperations.intersectSize(key, Arrays.asList(otherKey)).as(StepVerifier::create).expectNext(2L).verifyComplete(); |
| 257 | + |
| 258 | + // Test intersectSize(Collection) with multiple keys |
| 259 | + setOperations.intersectSize(Arrays.asList(key, otherKey, thirdKey)).as(StepVerifier::create).expectNext(1L) |
| 260 | + .verifyComplete(); |
| 261 | + |
| 262 | + // Test with empty intersection |
| 263 | + K emptyKey = keyFactory.instance(); |
| 264 | + setOperations.intersectSize(key, emptyKey).as(StepVerifier::create).expectNext(0L).verifyComplete(); |
| 265 | + } |
| 266 | + |
233 | 267 | @Test // DATAREDIS-602, DATAREDIS-873 |
234 | 268 | void difference() { |
235 | 269 |
|
|
0 commit comments