@PutMapping("/{id}")
    @RequiresPermissions("system:role:edit")
    public ShenyuAdminResult updateRole(@PathVariable("id") @Valid
                                        @Existed(provider = RoleMapper.class,
                                                message = "role is not existed") final String id,
                                        @Valid @RequestBody final RoleDTO roleDTO) {
        roleDTO.setId(id);
        return ShenyuAdminResult.success(ShenyuResultMessage.UPDATE_SUCCESS, roleService.createOrUpdate(roleDTO));
    }
@Test
    public void testUpdateRole() throws Exception {
        RoleDTO roleDTO = buildRoleDTO();
        given(roleService.createOrUpdate(roleDTO)).willReturn(1);
        SpringBeanUtils.getInstance().setApplicationContext(mock(ConfigurableApplicationContext.class));
        when(SpringBeanUtils.getInstance().getBean(RoleMapper.class)).thenReturn(roleMapper);
        when(roleMapper.existed(roleDTO.getId())).thenReturn(true);
        this.mockMvc.perform(MockMvcRequestBuilders.put("/role/{id}", roleDTO.getId())
            .contentType(MediaType.APPLICATION_JSON)
            .content(GsonUtils.getInstance().toJson(roleDTO)))
            .andExpect(status().isOk())
            .andExpect(jsonPath("$.message", is(ShenyuResultMessage.UPDATE_SUCCESS)))
            .andReturn();
    }