Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests for Sets and GSets. #728

Open
wants to merge 15 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

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
GSets exception test when removing an item.
daniel020403 committed Dec 1, 2022
commit e18330179e000097dc7ca921895f16153bb0ea52
Original file line number Diff line number Diff line change
@@ -232,7 +232,7 @@ public void testSet() throws ExecutionException, InterruptedException {
assertFalse(removedItemSet.contains(BinaryValue.create("user4")));
}

@Test
@Test(expected = java.lang.Error.class)
public void testGSet() throws ExecutionException, InterruptedException {
Assume.assumeTrue(testGSetDataType);
resetAndEmptyBucket(uniqueUsersGSet);
@@ -260,5 +260,19 @@ public void testGSet() throws ExecutionException, InterruptedException {
assertTrue(updatedSet.contains(BinaryValue.create("user2")));
assertTrue(updatedSet.contains(BinaryValue.create("user3")));
assertFalse(updatedSet.contains(BinaryValue.create("user4")));

final FetchSet.Response removeItemResponse = client.execute(fetchSet);
Context ctx = removeItemResponse.getContext();
GSetUpdate suRemoveItem = new GSetUpdate().remove("user2");
UpdateSet updateRemove = new UpdateSet.Builder(location, suRemoveItem).withContext(ctx).build();
client.execute(updateRemove);

final FetchSet.Response removedResponse = client.execute(fetchSet);
Set<BinaryValue> removedItemSet = removedResponse.getDatatype().view();
assertTrue(removedItemSet.isEmpty());
assertTrue(removedItemSet.contains(BinaryValue.create("user1")));
assertTrue(removedItemSet.contains(BinaryValue.create("user2")));
assertTrue(removedItemSet.contains(BinaryValue.create("user3")));
assertFalse(removedItemSet.contains(BinaryValue.create("user4")));
}
}