public void documentUpdateRole()

in component-test/src/main/java/IdentityApiDocumentation.java [133:161]


  public void documentUpdateRole ( ) throws InterruptedException {

    try (final AutoUserContext ignore = loginAdmin()) {
      final String roleIdentifier = createRoleManagementRole();

      final Role role = getTestSubject().getRole(roleIdentifier);
      role.getPermissions().add(buildUserPermission());

      Gson gson = new Gson();
      role.getPermissions().remove(0);

      try {
        this.mockMvc.perform(put("/roles/" + role.getIdentifier())
                .accept(MediaType.APPLICATION_JSON_VALUE)
                .contentType(MediaType.APPLICATION_JSON_VALUE)
                .content(gson.toJson(role)))
                .andExpect(status().isAccepted())
                .andDo(document("document-update-role", preprocessRequest(prettyPrint()),
                        requestFields(
                                fieldWithPath("identifier").description("Identifier"),
                                fieldWithPath("permissions[].permittableEndpointGroupIdentifier").description("permittable endpoints"),
                                fieldWithPath("permissions[].allowedOperations").type("Set<AllowedOperation>").description("Set of allowed operations")
                        )
                ));
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
  }