use of io.jans.scim.model.scim2.user.InstantMessagingAddress in project jans by JanssenProject.
the class PatchReplaceUserTest method objectPatch.
@Test(dependsOnMethods = "jsonPathPatch2")
public void objectPatch() {
// Create a patch request by supplying a singleton list with one IMS object
InstantMessagingAddress ims = new InstantMessagingAddress();
ims.setDisplay("barbas");
ims.setPrimary(true);
ims.setType("escape");
ims.setValue("bjensen");
PatchOperation op = new PatchOperation();
op.setOperation("replace");
op.setPath("ims");
op.setValue(Collections.singleton(ims));
PatchRequest pr = new PatchRequest();
pr.setOperations(Collections.singletonList(op));
Response response = client.patchUser(pr, user.getId(), null, null);
assertEquals(response.getStatus(), OK.getStatusCode());
UserResource other = response.readEntity(usrClass);
for (int i = 0; i < 2; i++) {
// Verify different info appeared
InstantMessagingAddress newIms = other.getIms().get(0);
assertEquals(newIms.getDisplay(), ims.getDisplay());
assertEquals(newIms.getValue(), ims.getValue());
assertEquals(newIms.getType(), ims.getType());
assertEquals(newIms.getPrimary(), ims.getPrimary());
// Double check
response = client.getUserById(user.getId(), "ims", null);
other = response.readEntity(usrClass);
}
}
Aggregations