AccountController { @PreAuthorize("hasRole('ROLE_ADMIN')") @RequestMapping(value = "/user", method = RequestMethod.GET) @ResponseBody public List<OadrUserDto> listUser() { List<OadrUser> find = oadrUserService.findAll(); return dtoMapper.mapList(find, OadrUserDto.class); }  @RequestMapping(value = "/", method = RequestMethod.GET) @ResponseBody @PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_DEVICE_MANAGER') or hasRole('ROLE_DRPROGRAM')") AbstractUserWithRoleDto registeredUser(Principal principal); @PreAuthorize("hasRole('ROLE_ADMIN')") @RequestMapping(value = "/user", method = RequestMethod.GET) @ResponseBody List<OadrUserDto> listUser(); @PreAuthorize("hasRole('ROLE_ADMIN')") @RequestMapping(value = "/user", method = RequestMethod.POST) @ResponseBody ResponseEntity<InputStreamResource> createUser(@RequestBody OadrUserCreateDto dto,
			HttpServletResponse response); @PreAuthorize("hasRole('ROLE_ADMIN')") @RequestMapping(value = "/user/{username}", method = RequestMethod.DELETE) @ResponseBody void deleteUser(@PathVariable("username") String username, HttpServletResponse response); @PreAuthorize("hasRole('ROLE_ADMIN')") @RequestMapping(value = "/app", method = RequestMethod.GET) @ResponseBody List<OadrAppDto> listApp(); @PreAuthorize("hasRole('ROLE_ADMIN')") @RequestMapping(value = "/app", method = RequestMethod.POST) @ResponseBody ResponseEntity<InputStreamResource> createApp(@RequestBody OadrAppCreateDto dto,
			HttpServletResponse response); @PreAuthorize("hasRole('ROLE_ADMIN')") @RequestMapping(value = "/app/{username}", method = RequestMethod.DELETE) @ResponseBody void deleteApp(@PathVariable("username") String username, HttpServletResponse response);  }
@Test public void listUserTest() throws Exception { this.mockMvc.perform( MockMvcRequestBuilders.get(ACCOUNT_USER_URL).header("Content-Type", "application/json").with(user)) .andExpect(MockMvcResultMatchers.status().is(HttpStatus.FORBIDDEN_403)); MvcResult andReturn = this.mockMvc.perform( MockMvcRequestBuilders.get(ACCOUNT_USER_URL).header("Content-Type", "application/json").with(admin)) .andExpect(MockMvcResultMatchers.status().is(HttpStatus.OK_200)).andReturn(); List<OadrUserDto> convertMvcResultToOadrUserDtoList = convertMvcResultToList(andReturn, userListRef); assertEquals(1, convertMvcResultToOadrUserDtoList.size()); assertEquals("admin", convertMvcResultToOadrUserDtoList.get(0).getUsername()); }