@PutMapping("/{id}")
    @RequiresPermissions(value = {"system:resource:editMenu", "system:resource:editButton"}, logical = Logical.OR)
    public ShenyuAdminResult updateResource(@PathVariable("id") @Valid
                                            @Existed(provider = ResourceMapper.class,
                                                    message = "resource not existed") final String id,
                                            @RequestBody final ResourceDTO resourceDTO) {
        resourceDTO.setId(id);
        return ShenyuAdminResult.success(ShenyuResultMessage.UPDATE_SUCCESS, resourceService.update(resourceDTO));
    }
@Test
    public void testUpdateResource() throws Exception {
        final String mockId = "mock-id";
        final ResourceDTO resourceDTO = new ResourceDTO();
        resourceDTO.setId(mockId);
        fill(resourceDTO);
        SpringBeanUtils.getInstance().setApplicationContext(mock(ConfigurableApplicationContext.class));
        given(resourceService.update(resourceDTO)).willReturn(1);

        this.mockMvc.perform(MockMvcRequestBuilders.put("/resource/" + mockId)
                .contentType(MediaType.APPLICATION_JSON)
                .content(GsonUtils.getInstance().toJson(resourceDTO)))
                .andExpect(content().json(GsonUtils.getInstance().toJson(ShenyuAdminResult.success(ShenyuResultMessage.UPDATE_SUCCESS, 1))))
                .andReturn();
    }