Skip to content

Commit

Permalink
added nested
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonfagerberg-toast committed Jan 17, 2025
1 parent c016f37 commit fb2ee7b
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,26 @@ public void applyReplaceComplexAttribute() {
assertThat(updatedUser.getName().getGivenName()).isNotNull();
}

@Test
public void applyReplaceNestedComplexAttribute() {
// setup existing user
Name existingName = new Name();
existingName.setFamilyName("Family Name");
existingName.setGivenName("Given Name");
ScimUser user = user();
user.setName(existingName);

// setup patch ops
Map<String, Map<String, String>> newName = Map.of("name", Map.of("familyName", "New Family Name"));
PatchOperation op = patchOperation(REPLACE, null, newName);

//execute
ScimUser updatedUser = patchHandler.apply(user, List.of(op));
assertThat(updatedUser.getName().getFamilyName()).isEqualTo("New Family Name");
// assert that PATCH did not update fields not provided in PatchOperation
assertThat(updatedUser.getName().getGivenName()).isNotNull();
}

@Test
public void applyReplaceUserName() {
String newUserName = "[email protected]";
Expand Down

0 comments on commit fb2ee7b

Please sign in to comment.