kjthorpe18 commented on code in PR #448:
URL: https://github.com/apache/directory-scimple/pull/448#discussion_r1428820471


##########
scim-core/src/test/java/org/apache/directory/scim/core/repository/PatchHandlerTest.java:
##########
@@ -465,6 +467,39 @@ public void deleteItemWithComplexFilter() throws 
FilterParseException {
     ));
   }
 
+  @Test
+  public void addItemToCollection() throws FilterParseException {
+    PatchOperation op = new PatchOperation();
+    op.setOperation(ADD);
+    op.setPath(PatchOperationPath.fromString("members"));
+    op.setValue(List.of(
+      Map.of(
+        "value", "9876",
+        "display", "testUser2",
+        "type", "User")
+    ));
+
+    ScimGroup updatedGroup = patchHandler.apply(group(), List.of(op));
+    assertThat(updatedGroup.getMembers().size()).isEqualTo(3);
+  }
+
+  /**
+   * This test covers Azure-style remove member operations, where a value is
+   * specified in the operation body, rather than in the path.
+   * For example: { "op": "remove", "path": "members", "value": [ { "value": 
"1234" } ] }
+   */
+  @Test
+  public void removeItemFromCollection() throws FilterParseException {
+    PatchOperation op = new PatchOperation();
+    op.setOperation(REMOVE);
+    op.setPath(PatchOperationPath.fromString("members"));
+    op.setValue(List.of(Map.of("value", "1234")));
+
+    ScimGroup updatedGroup = patchHandler.apply(group(), List.of(op));
+    assertThat(updatedGroup.getMembers()).isNotNull();
+    assertThat(updatedGroup.getMembers().size()).isEqualTo(1);

Review Comment:
   I've also really only used Hamcrest and JUnit assertions - this would be a 
good thing to add in a separate PR



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to