-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed issue with PATCH incorrectly replacing entire complex attr
- Loading branch information
1 parent
a639001
commit c016f37
Showing
2 changed files
with
31 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,6 +56,26 @@ public PatchHandlerTest() { | |
this.patchHandler = new DefaultPatchHandler(schemaRegistry); | ||
} | ||
|
||
@Test | ||
public void applyReplaceComplexAttribute() { | ||
// 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, String> newName = Map.of("familyName", "New Family Name"); | ||
PatchOperation op = patchOperation(REPLACE, "name", 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]"; | ||
|