@Ignore @Test @WithMockUser public void test_should_create_citizen() throws Exception { final Date expectedDate = toDate(LocalDateTime.of(1986, 8, 4, 5, 30)); final org.egov.user.domain.model.User user = org.egov.user.domain.model.User.builder() .username("userName") .name("foo") .dob(expectedDate) .guardian("name of relative") .build(); when(userService.createCitizen(any())).thenReturn(user); mockMvc.perform(post("/citizen/_create") .contentType(MediaType.APPLICATION_JSON_UTF8) .content(getFileContents("userCreateRequest.json"))) .andExpect(status().isOk()) .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON_UTF8)) .andExpect(content().json(getFileContents("userCreateSuccessResponse.json"))); }
@PostMapping("/citizen/_create") public Object createCitizen(@RequestBody CreateUserRequest createUserRequest) { log.info("Received Citizen Registration Request " + createUserRequest); User user = createUserRequest.toDomain(true); user.setOtpValidationMandatory(IsValidationMandatory); if(isRegWithLoginEnabled) { Object object = userService.registerWithLogin(user); return new ResponseEntity<>(object, HttpStatus.OK); } User createdUser = userService.createCitizen(user); return createResponse(createdUser); }
UserController { @PostMapping("/citizen/_create") public Object createCitizen(@RequestBody CreateUserRequest createUserRequest) { log.info("Received Citizen Registration Request " + createUserRequest); User user = createUserRequest.toDomain(true); user.setOtpValidationMandatory(IsValidationMandatory); if(isRegWithLoginEnabled) { Object object = userService.registerWithLogin(user); return new ResponseEntity<>(object, HttpStatus.OK); } User createdUser = userService.createCitizen(user); return createResponse(createdUser); } }
UserController { @PostMapping("/citizen/_create") public Object createCitizen(@RequestBody CreateUserRequest createUserRequest) { log.info("Received Citizen Registration Request " + createUserRequest); User user = createUserRequest.toDomain(true); user.setOtpValidationMandatory(IsValidationMandatory); if(isRegWithLoginEnabled) { Object object = userService.registerWithLogin(user); return new ResponseEntity<>(object, HttpStatus.OK); } User createdUser = userService.createCitizen(user); return createResponse(createdUser); } @Autowired  UserController(UserService userService, TokenService tokenService); }
UserController { @PostMapping("/citizen/_create") public Object createCitizen(@RequestBody CreateUserRequest createUserRequest) { log.info("Received Citizen Registration Request " + createUserRequest); User user = createUserRequest.toDomain(true); user.setOtpValidationMandatory(IsValidationMandatory); if(isRegWithLoginEnabled) { Object object = userService.registerWithLogin(user); return new ResponseEntity<>(object, HttpStatus.OK); } User createdUser = userService.createCitizen(user); return createResponse(createdUser); } @Autowired  UserController(UserService userService, TokenService tokenService); @PostMapping("/citizen/_create") Object createCitizen(@RequestBody CreateUserRequest createUserRequest); @PostMapping("/users/_createnovalidate") UserDetailResponse createUserWithoutValidation(@RequestBody CreateUserRequest createUserRequest,
			@RequestHeader HttpHeaders headers); @PostMapping("/_search") UserSearchResponse get(@RequestBody UserSearchRequest request, @RequestHeader HttpHeaders headers); @PostMapping("/v1/_search") UserSearchResponse getV1(@RequestBody UserSearchRequest request, @RequestHeader HttpHeaders headers); @PostMapping("/_details") CustomUserDetails getUser(@RequestParam(value = "access_token") String accessToken); @PostMapping("/users/_updatenovalidate") UserDetailResponse updateUserWithoutValidation(@RequestBody final CreateUserRequest createUserRequest,
														  @RequestHeader HttpHeaders headers); @PostMapping("/profile/_update") UserDetailResponse patch(@RequestBody final CreateUserRequest createUserRequest); }
UserController { @PostMapping("/citizen/_create") public Object createCitizen(@RequestBody CreateUserRequest createUserRequest) { log.info("Received Citizen Registration Request " + createUserRequest); User user = createUserRequest.toDomain(true); user.setOtpValidationMandatory(IsValidationMandatory); if(isRegWithLoginEnabled) { Object object = userService.registerWithLogin(user); return new ResponseEntity<>(object, HttpStatus.OK); } User createdUser = userService.createCitizen(user); return createResponse(createdUser); } @Autowired  UserController(UserService userService, TokenService tokenService); @PostMapping("/citizen/_create") Object createCitizen(@RequestBody CreateUserRequest createUserRequest); @PostMapping("/users/_createnovalidate") UserDetailResponse createUserWithoutValidation(@RequestBody CreateUserRequest createUserRequest,
			@RequestHeader HttpHeaders headers); @PostMapping("/_search") UserSearchResponse get(@RequestBody UserSearchRequest request, @RequestHeader HttpHeaders headers); @PostMapping("/v1/_search") UserSearchResponse getV1(@RequestBody UserSearchRequest request, @RequestHeader HttpHeaders headers); @PostMapping("/_details") CustomUserDetails getUser(@RequestParam(value = "access_token") String accessToken); @PostMapping("/users/_updatenovalidate") UserDetailResponse updateUserWithoutValidation(@RequestBody final CreateUserRequest createUserRequest,
														  @RequestHeader HttpHeaders headers); @PostMapping("/profile/_update") UserDetailResponse patch(@RequestBody final CreateUserRequest createUserRequest);  }