@PutMapping("/{id}")
    @RequiresPermissions("system:dict:edit")
    public ShenyuAdminResult updateShenyuDict(@PathVariable("id") @Valid
                                              @Existed(provider = ShenyuDictMapper.class,
                                                      message = "dict is not existed") final String id,
                                              @Valid @NotNull @RequestBody final ShenyuDictDTO shenyuDictDTO) {
        shenyuDictDTO.setId(id);
        return ShenyuAdminResult.success(ShenyuResultMessage.UPDATE_SUCCESS, shenyuDictService.createOrUpdate(shenyuDictDTO));
    }
@Test
    public void testUpdateShenyuDict() throws Exception {
        ShenyuDictDTO shenyuDictDTO = buildTestDict();
        
        SpringBeanUtils.getInstance().setApplicationContext(mock(ConfigurableApplicationContext.class));
        when(SpringBeanUtils.getInstance().getBean(ShenyuDictMapper.class)).thenReturn(shenyuDictMapper);
        when(shenyuDictMapper.existed(shenyuDictDTO.getId())).thenReturn(true);
        
        given(this.shenyuDictService.createOrUpdate(shenyuDictDTO)).willReturn(1);
        this.mockMvc.perform(MockMvcRequestBuilders.put("/shenyu-dict/{id}", "123")
                .contentType(MediaType.APPLICATION_JSON)
                .content(GsonUtils.getInstance().toJson(shenyuDictDTO)))
                .andExpect(status().isOk())
                .andExpect(jsonPath("$.message", is(ShenyuResultMessage.UPDATE_SUCCESS)))
                .andReturn();
    }