erant10 commented on code in PR #251:
URL: https://github.com/apache/directory-scimple/pull/251#discussion_r1098052982
##########
scim-core/src/test/java/org/apache/directory/scim/core/repository/PatchHandlerTest.java:
##########
@@ -127,6 +127,57 @@ public void applyAddToMultiValuedComplexAttribute() {
assertThat(updatedUser.getAddresses()).isEqualTo(expectedAddresses);
}
+ @Test
+ public void applyAddSingleComplexAttribute() {
+ ScimUser user = user();
+ PatchOperation op = patchOperation(ADD, "name.honorificSuffix", "II");
+ ScimUser updatedUser = patchHandler.apply(user, List.of(op));
+ Name expectedName = new Name()
+ .setFormatted(user.getName().getFormatted())
+ .setHonorificSuffix("II");
+ assertThat(updatedUser.getName()).isEqualTo(expectedName);
+ }
+
+ @Test
+ public void applyReplaceSingleComplexAttribute() {
+ ScimUser user = user();
+ PatchOperation op = patchOperation(REPLACE, "name.formatted", "Charlie");
+ ScimUser updatedUser = patchHandler.apply(user, List.of(op));
+ Name expectedName = new Name()
+ .setFormatted("Charlie");
+ assertThat(updatedUser.getName()).isEqualTo(expectedName);
+ }
+
+ @Test
+ public void applyAddToMissingSingleComplexAttribute() {
+ ScimUser user = user();
+ PatchOperation op = patchOperation(ADD, "addresses[type eq
\"work\"].postalCode", "ko4 8qq");
+ ScimUser updatedUser = patchHandler.apply(user, List.of(op));
+ List<Address> expectedAddresses = List.of(
+ new Address()
+ .setType("work")
+ .setPostalCode("ko4 8qq"));
+ assertThat(updatedUser.getAddresses()).isEqualTo(expectedAddresses);
+ }
+
+ @Test
+ public void settingPrimaryOnMultiValuedShouldResetAllOthersToFalse() {
+ // https://www.rfc-editor.org/rfc/rfc7644#section-3.5.2
+ ScimUser user = user();
+ PatchOperation op = patchOperation(REPLACE, "emails[type eq
\"home\"].primary", true);
Review Comment:
Neither did I lol
I'll pass the message on to my teammate @photonicworld
--
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]