@Test public void getUserByEmailIdTest() throws Exception { UserDetails userDetails = getUserDetails(); when(userService.getUserByEmailId(anyString())).thenReturn(userDetails); mockMvc.perform(get("/users/list") .param("emailId", StringUtils.EMPTY)) .andExpect(status().isOk()) .andExpect(jsonPath("$.message", is("success"))); }
@ApiOperation(httpMethod = "GET", value = "API to get user details by email id", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE) @PreAuthorize("@securityService.hasPermission(authentication, 'ROLE_ADMIN')") @RequestMapping(path = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Object> getUserByEmailId( @ApiParam(value = "provide valid user email id", required = true) @RequestParam(name = "emailId", required = true) String emailId) { try { return ResponseUtils.buildSucessResponse(userService.getUserByEmailId(emailId)); } catch (Exception exception) { log.error(UNEXPECTED_ERROR_OCCURRED, exception); return ResponseUtils.buildFailureResponse(new Exception(UNEXPECTED_ERROR_OCCURRED), exception.getMessage()); } }
UserController { @ApiOperation(httpMethod = "GET", value = "API to get user details by email id", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE) @PreAuthorize("@securityService.hasPermission(authentication, 'ROLE_ADMIN')") @RequestMapping(path = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Object> getUserByEmailId( @ApiParam(value = "provide valid user email id", required = true) @RequestParam(name = "emailId", required = true) String emailId) { try { return ResponseUtils.buildSucessResponse(userService.getUserByEmailId(emailId)); } catch (Exception exception) { log.error(UNEXPECTED_ERROR_OCCURRED, exception); return ResponseUtils.buildFailureResponse(new Exception(UNEXPECTED_ERROR_OCCURRED), exception.getMessage()); } } }
UserController { @ApiOperation(httpMethod = "GET", value = "API to get user details by email id", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE) @PreAuthorize("@securityService.hasPermission(authentication, 'ROLE_ADMIN')") @RequestMapping(path = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Object> getUserByEmailId( @ApiParam(value = "provide valid user email id", required = true) @RequestParam(name = "emailId", required = true) String emailId) { try { return ResponseUtils.buildSucessResponse(userService.getUserByEmailId(emailId)); } catch (Exception exception) { log.error(UNEXPECTED_ERROR_OCCURRED, exception); return ResponseUtils.buildFailureResponse(new Exception(UNEXPECTED_ERROR_OCCURRED), exception.getMessage()); } }  }
UserController { @ApiOperation(httpMethod = "GET", value = "API to get user details by email id", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE) @PreAuthorize("@securityService.hasPermission(authentication, 'ROLE_ADMIN')") @RequestMapping(path = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Object> getUserByEmailId( @ApiParam(value = "provide valid user email id", required = true) @RequestParam(name = "emailId", required = true) String emailId) { try { return ResponseUtils.buildSucessResponse(userService.getUserByEmailId(emailId)); } catch (Exception exception) { log.error(UNEXPECTED_ERROR_OCCURRED, exception); return ResponseUtils.buildFailureResponse(new Exception(UNEXPECTED_ERROR_OCCURRED), exception.getMessage()); } }  @ApiOperation(httpMethod = "GET", value = "API to get user details by email id", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE) @PreAuthorize("@securityService.hasPermission(authentication, 'ROLE_ADMIN')") @RequestMapping(path = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<Object> getUserByEmailId(
		@ApiParam(value = "provide valid user email id", required = true) @RequestParam(name = "emailId", required = true) String emailId); @ApiOperation(httpMethod = "GET", value = "API to get all sign-in users", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE) @PreAuthorize("@securityService.hasPermission(authentication, 'ROLE_ADMIN')") @RequestMapping(path = "/list-users", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<Object> getAllLoginUsers(); }
UserController { @ApiOperation(httpMethod = "GET", value = "API to get user details by email id", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE) @PreAuthorize("@securityService.hasPermission(authentication, 'ROLE_ADMIN')") @RequestMapping(path = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Object> getUserByEmailId( @ApiParam(value = "provide valid user email id", required = true) @RequestParam(name = "emailId", required = true) String emailId) { try { return ResponseUtils.buildSucessResponse(userService.getUserByEmailId(emailId)); } catch (Exception exception) { log.error(UNEXPECTED_ERROR_OCCURRED, exception); return ResponseUtils.buildFailureResponse(new Exception(UNEXPECTED_ERROR_OCCURRED), exception.getMessage()); } }  @ApiOperation(httpMethod = "GET", value = "API to get user details by email id", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE) @PreAuthorize("@securityService.hasPermission(authentication, 'ROLE_ADMIN')") @RequestMapping(path = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<Object> getUserByEmailId(
		@ApiParam(value = "provide valid user email id", required = true) @RequestParam(name = "emailId", required = true) String emailId); @ApiOperation(httpMethod = "GET", value = "API to get all sign-in users", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE) @PreAuthorize("@securityService.hasPermission(authentication, 'ROLE_ADMIN')") @RequestMapping(path = "/list-users", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<Object> getAllLoginUsers();  }