Advertisement
Guest User

Untitled

a guest
Jan 17th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.88 KB | None | 0 0
  1. @Autowired
  2.     private UserService userService;
  3.  
  4.     @PostMapping("/register")
  5.     public ResponseEntity<?> register(@RequestBody PostRegisterRequestDto dto) {
  6.         userService.register(dto);
  7.         return new ResponseEntity<>(HttpStatus.OK);
  8.     }
  9.  
  10.  
  11.  
  12.  @Test
  13.     @WithMockUser(username = "test", password = "test", roles = "USER")
  14.     public void whenChuj_thenCHuj() throws Exception {
  15.         PostRegisterRequestDto dto = new PostRegisterRequestDto("Username,", "Password",
  16.                 "Phonenumber", "firstname", "lastname",
  17.                 "asdsadsa");
  18.         String dupa = objectMapper.writeValueAsString(dto);
  19.         this
  20.                 .mockMvc
  21.                 .perform(post("/user/register").contentType(MediaType.APPLICATION_JSON_VALUE)
  22.                         .content(objectMapper.writeValueAsString(dto)))
  23.                 .andExpect(status().isOk());
  24.  
  25.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement