Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add intersectSize test for SINTERCARD operation in DefaultReactiveSet…
…OperationsIntegrationTests Signed-off-by: Kiminni <imk0980@gmail.com>
  • Loading branch information
Kiminni committed Oct 1, 2025
commit bebdda7bfb2716c7d5d0d97ca4f9f5f3e50c7f9e
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
*
* @author Mark Paluch
* @author Christoph Strobl
* @author Mingi Lee
*/
@ParameterizedClass
@MethodSource("testParams")
Expand Down Expand Up @@ -230,6 +231,39 @@ void intersectAndStore() {
setOperations.isMember(destKey, shared).as(StepVerifier::create).expectNext(true).verifyComplete();
}

@Test
@EnabledOnCommand("SINTERCARD")
void intersectSize() {

K key = keyFactory.instance();
K otherKey = keyFactory.instance();
K thirdKey = keyFactory.instance();

V onlyInKey = valueFactory.instance();
V shared1 = valueFactory.instance();
V shared2 = valueFactory.instance();
V onlyInOtherKey = valueFactory.instance();

setOperations.add(key, onlyInKey, shared1, shared2).as(StepVerifier::create).expectNext(3L).verifyComplete();
setOperations.add(otherKey, onlyInOtherKey, shared1, shared2).as(StepVerifier::create).expectNext(3L)
.verifyComplete();
setOperations.add(thirdKey, shared1).as(StepVerifier::create).expectNext(1L).verifyComplete();

// Test intersectSize(key, otherKey)
setOperations.intersectSize(key, otherKey).as(StepVerifier::create).expectNext(2L).verifyComplete();

// Test intersectSize(key, Collection)
setOperations.intersectSize(key, Arrays.asList(otherKey)).as(StepVerifier::create).expectNext(2L).verifyComplete();

// Test intersectSize(Collection) with multiple keys
setOperations.intersectSize(Arrays.asList(key, otherKey, thirdKey)).as(StepVerifier::create).expectNext(1L)
.verifyComplete();

// Test with empty intersection
K emptyKey = keyFactory.instance();
setOperations.intersectSize(key, emptyKey).as(StepVerifier::create).expectNext(0L).verifyComplete();
}

@Test // DATAREDIS-602, DATAREDIS-873
void difference() {

Expand Down