UserController { @GetMapping("/privateProfile") @ApiOperation("Reads users' private profile") public UserPrivateProfileDTO getPrivateProfile(@RequestHeader String user, @RequestHeader String password) { ReadKeyPassword readKeyPassword = ReadKeyPasswordHelper.getForString(password); UserIDAuth auth = new UserIDAuth(new UserID(user), readKeyPassword); return UserPrivateProfileDTO.from(dataSafeService.userProfile().privateProfile(auth)); }  @PutMapping @ApiOperation("Creates new user") @ApiResponses(value = { @ApiResponse(code = 200, message = "User successfully created"), @ApiResponse(code = 400, message = "User already exists") }) void createUser(@Validated @RequestBody UserDTO userDTO); @PostMapping("/password") @ApiOperation("Change users' password") void changePassword(@RequestHeader String user,
                               @RequestHeader String password,
                               @Validated @RequestBody NewPasswordDTO newPassword); @GetMapping("/publicProfile") @ApiOperation("Reads users' profile") UserPublicProfileDTO getPublicProfile(@RequestHeader String user,
                                                 @RequestHeader String password); @GetMapping("/privateProfile") @ApiOperation("Reads users' private profile") UserPrivateProfileDTO getPrivateProfile(@RequestHeader String user,
                                                   @RequestHeader String password); @PostMapping("/publicProfile") @ApiOperation("Modifies users' profile") void updatePublicProfile(@RequestHeader String user,
                                    @RequestHeader String password,
                                    @Validated @RequestBody UserPublicProfileDTO profileDto); @PostMapping("/privateProfile") @ApiOperation("Modifies users' private profile") void updatePrivateProfile(@RequestHeader String user,
                                     @RequestHeader String password,
                                     @Validated @RequestBody UserPrivateProfileDTO profileDto); @PostMapping("/storages") @ApiOperation("Adds users' storage id and credentials") void addStorageCredentials(@RequestHeader String user,
                                      @RequestHeader String password,
                                      @Validated @RequestBody StorageCredsDTO creds); @DeleteMapping("/storages") @ApiOperation("Removes users' storage id and credentials") void removeStorageCredentials(@RequestHeader String user,
                                         @RequestHeader String password,
                                         @RequestHeader String storageId); @DeleteMapping @ApiOperation("Deletes existing user") @ApiResponses(value = { @ApiResponse(code = 200, message = "User successfully deleted"), @ApiResponse(code = 404, message = "User does not exist") }) void deleteUser(@RequestHeader String user,
                           @RequestHeader String password);  }
@SneakyThrows @Test void getPrivateProfileTest() { when(userProfile.privateProfile(eq(new UserIDAuth(TEST_USER, TEST_PASS)))) .thenReturn(mock(UserPrivateProfile.class)); mvc.perform(get("/user/privateProfile") .contentType(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON) .characterEncoding("UTF-8") .header("user", TEST_USER) .header("password", TEST_PASS) .header("token", token) ) .andExpect(status().isOk()); verify(userProfile).privateProfile( eq(new UserIDAuth(TEST_USER, TEST_PASS)) ); }