RedisSet extends AbstractRedisData { long srem(ArrayList<ByteArrayWrapper> membersToRemove, Region<ByteArrayWrapper, RedisData> region, ByteArrayWrapper key) { membersToRemove.removeIf(memberToRemove -> !membersRemove(memberToRemove)); int membersRemoved = membersToRemove.size(); if (membersRemoved != 0) { storeChanges(region, key, new RemsDeltaInfo(membersToRemove)); } return membersRemoved; } @SuppressWarnings("unchecked")  RedisSet(Collection<ByteArrayWrapper> members);  RedisSet(); boolean sismember(ByteArrayWrapper member); int scard(); @Override synchronized void toData(DataOutput out); @Override void fromData(DataInput in); @Override RedisDataType getType(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static final NullRedisSet NULL_REDIS_SET; }
@SuppressWarnings("unchecked") @Test public void srem_stores_delta_that_is_stable() throws IOException { Region<ByteArrayWrapper, RedisData> region = mock(Region.class); RedisSet o1 = createRedisSet(1, 2); ByteArrayWrapper member1 = new ByteArrayWrapper(new byte[] {1}); ArrayList<ByteArrayWrapper> removes = new ArrayList<>(); removes.add(member1); o1.srem(removes, region, null); assertThat(o1.hasDelta()).isTrue(); HeapDataOutputStream out = new HeapDataOutputStream(100); o1.toDelta(out); assertThat(o1.hasDelta()).isFalse(); ByteArrayDataInput in = new ByteArrayDataInput(out.toByteArray()); RedisSet o2 = createRedisSet(1, 2); assertThat(o2).isNotEqualTo(o1); o2.fromDelta(in); assertThat(o2).isEqualTo(o1); }