@GetMapping("/{id}")
    @RequiresPermissions("system:role:edit")
    public ShenyuAdminResult detailRole(@PathVariable("id") @Valid
                                        @Existed(provider = RoleMapper.class,
                                                message = "role is not existed") final String id) {
        RoleEditVO roleEditVO = roleService.findById(id);
        return Optional.ofNullable(roleEditVO)
                .map(item -> ShenyuAdminResult.success(ShenyuResultMessage.DETAIL_SUCCESS, item))
                .orElse(ShenyuAdminResult.error(ShenyuResultMessage.DETAIL_FAILED));
    }
@Test
    public void testDetailRole() throws Exception {
        given(roleService.findById(anyString())).willReturn(null);
        String urlTemplate = "/role/{id}";
        this.mockMvc.perform(MockMvcRequestBuilders.get(urlTemplate, "test_id"))
            .andExpect(status().isOk())
            .andExpect(jsonPath("$.message", is(ShenyuResultMessage.DETAIL_FAILED)))
            .andReturn();
        RoleEditVO roleEditVO = buildRoleEditVO();
        given(roleService.findById(roleEditVO.getSysRole().getId())).willReturn(roleEditVO);
        urlTemplate = "/role/{id}";
        this.mockMvc.perform(MockMvcRequestBuilders.get(urlTemplate, roleEditVO.getSysRole().getId()))
            .andExpect(status().isOk())
            .andExpect(jsonPath("$.message", is(ShenyuResultMessage.DETAIL_SUCCESS)))
            .andReturn();
    }