@Test public void testGetCurrentTeamOfUserErrCndtn() { setSecuirtyContext(TEAMNAME, USERNAME); when(teamUserRepository.findByUserNameAndDefaultFlag(USERNAME, "Y")).thenReturn(null); MessageWrapper apiError = (MessageWrapper) teamUserController.getCurrentTeamOfUser(req).getBody(); assertEquals(HttpStatus.NOT_FOUND, apiError.getStatus()); assertEquals("TeamUser Not found for a User.", apiError.getStatusMessage()); }
@ApiOperation(value = "This API returns TeamUser Object present in Elastic Search for current user", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Returned TeamUser Object for current user"), @ApiResponse(code = 401, message = "User is not authorized to view requested object"), @ApiResponse(code = 404, message = "No TeamUser object found for current user") }) @RequestMapping(value = "/api/user/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Object> getCurrentTeamOfUser(HttpServletRequest request) { logger.debug("Fetching Current Team for user name."); TeamUser teamUser = userDetailsService.getCurrentTeamForUser(request); if (teamUser == null) { final String error = "TeamUser Not found for a User."; logger.debug(error); final MessageWrapper apiError = new MessageWrapper(HttpStatus.NOT_FOUND, error, error); return new ResponseEntity<>(apiError, new HttpHeaders(), apiError.getStatus()); } return new ResponseEntity<>(teamUser, HttpStatus.OK); }
TeamUserController { @ApiOperation(value = "This API returns TeamUser Object present in Elastic Search for current user", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Returned TeamUser Object for current user"), @ApiResponse(code = 401, message = "User is not authorized to view requested object"), @ApiResponse(code = 404, message = "No TeamUser object found for current user") }) @RequestMapping(value = "/api/user/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Object> getCurrentTeamOfUser(HttpServletRequest request) { logger.debug("Fetching Current Team for user name."); TeamUser teamUser = userDetailsService.getCurrentTeamForUser(request); if (teamUser == null) { final String error = "TeamUser Not found for a User."; logger.debug(error); final MessageWrapper apiError = new MessageWrapper(HttpStatus.NOT_FOUND, error, error); return new ResponseEntity<>(apiError, new HttpHeaders(), apiError.getStatus()); } return new ResponseEntity<>(teamUser, HttpStatus.OK); } }
TeamUserController { @ApiOperation(value = "This API returns TeamUser Object present in Elastic Search for current user", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Returned TeamUser Object for current user"), @ApiResponse(code = 401, message = "User is not authorized to view requested object"), @ApiResponse(code = 404, message = "No TeamUser object found for current user") }) @RequestMapping(value = "/api/user/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Object> getCurrentTeamOfUser(HttpServletRequest request) { logger.debug("Fetching Current Team for user name."); TeamUser teamUser = userDetailsService.getCurrentTeamForUser(request); if (teamUser == null) { final String error = "TeamUser Not found for a User."; logger.debug(error); final MessageWrapper apiError = new MessageWrapper(HttpStatus.NOT_FOUND, error, error); return new ResponseEntity<>(apiError, new HttpHeaders(), apiError.getStatus()); } return new ResponseEntity<>(teamUser, HttpStatus.OK); }  }
TeamUserController { @ApiOperation(value = "This API returns TeamUser Object present in Elastic Search for current user", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Returned TeamUser Object for current user"), @ApiResponse(code = 401, message = "User is not authorized to view requested object"), @ApiResponse(code = 404, message = "No TeamUser object found for current user") }) @RequestMapping(value = "/api/user/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Object> getCurrentTeamOfUser(HttpServletRequest request) { logger.debug("Fetching Current Team for user name."); TeamUser teamUser = userDetailsService.getCurrentTeamForUser(request); if (teamUser == null) { final String error = "TeamUser Not found for a User."; logger.debug(error); final MessageWrapper apiError = new MessageWrapper(HttpStatus.NOT_FOUND, error, error); return new ResponseEntity<>(apiError, new HttpHeaders(), apiError.getStatus()); } return new ResponseEntity<>(teamUser, HttpStatus.OK); }  @ApiOperation(value = "This API returns all TeamUser Objects present in Elastic Search", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Returned all TeamUser Objects"), @ApiResponse(code = 401, message = "User is not authorized to view requested object"), @ApiResponse(code = 404, message = "No TeamUser object found") }) @RequestMapping(value = "/api/users/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<Object> getAllUsers(); @ApiOperation(value = "This API returns TeamUser Object present in Elastic Search for current user", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Returned TeamUser Object for current user"), @ApiResponse(code = 401, message = "User is not authorized to view requested object"), @ApiResponse(code = 404, message = "No TeamUser object found for current user") }) @RequestMapping(value = "/api/user/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<Object> getCurrentTeamOfUser(HttpServletRequest request); @ApiOperation(value = "This API updates TeamUser Objects into Elastic Search for current user", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "TeamUser objects successfully updated into ES for current user"), @ApiResponse(code = 401, message = "User is not authorized to perform Update operation"), @ApiResponse(code = 404, message = "TeamUser object not found in ES for current user"), @ApiResponse(code = 400, message = "Input Request object is not valid") }) @RequestMapping(value = "/api/user/{newteamname}", method = RequestMethod.PUT, produces = "application/json") ResponseEntity<Object> updateTeamOfUser(HttpServletRequest request,
			@PathVariable("newteamname") String newteamname); }
TeamUserController { @ApiOperation(value = "This API returns TeamUser Object present in Elastic Search for current user", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Returned TeamUser Object for current user"), @ApiResponse(code = 401, message = "User is not authorized to view requested object"), @ApiResponse(code = 404, message = "No TeamUser object found for current user") }) @RequestMapping(value = "/api/user/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Object> getCurrentTeamOfUser(HttpServletRequest request) { logger.debug("Fetching Current Team for user name."); TeamUser teamUser = userDetailsService.getCurrentTeamForUser(request); if (teamUser == null) { final String error = "TeamUser Not found for a User."; logger.debug(error); final MessageWrapper apiError = new MessageWrapper(HttpStatus.NOT_FOUND, error, error); return new ResponseEntity<>(apiError, new HttpHeaders(), apiError.getStatus()); } return new ResponseEntity<>(teamUser, HttpStatus.OK); }  @ApiOperation(value = "This API returns all TeamUser Objects present in Elastic Search", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Returned all TeamUser Objects"), @ApiResponse(code = 401, message = "User is not authorized to view requested object"), @ApiResponse(code = 404, message = "No TeamUser object found") }) @RequestMapping(value = "/api/users/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<Object> getAllUsers(); @ApiOperation(value = "This API returns TeamUser Object present in Elastic Search for current user", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Returned TeamUser Object for current user"), @ApiResponse(code = 401, message = "User is not authorized to view requested object"), @ApiResponse(code = 404, message = "No TeamUser object found for current user") }) @RequestMapping(value = "/api/user/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<Object> getCurrentTeamOfUser(HttpServletRequest request); @ApiOperation(value = "This API updates TeamUser Objects into Elastic Search for current user", response = ResponseEntity.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "TeamUser objects successfully updated into ES for current user"), @ApiResponse(code = 401, message = "User is not authorized to perform Update operation"), @ApiResponse(code = 404, message = "TeamUser object not found in ES for current user"), @ApiResponse(code = 400, message = "Input Request object is not valid") }) @RequestMapping(value = "/api/user/{newteamname}", method = RequestMethod.PUT, produces = "application/json") ResponseEntity<Object> updateTeamOfUser(HttpServletRequest request,
			@PathVariable("newteamname") String newteamname);  }