### Question:
RequestController extends AbstractController { @PostMapping("/requests/{id}/claim") public ModelAndView claimRequest(Principal principal, @PathVariable Long id, @Valid UserClaimRequest userClaimRequest, RedirectAttributes redirectAttributes) { if (!profileService.getUserProfile(principal).userOwnsAddress(userClaimRequest.getAddress())) { return redirectView(redirectAttributes) .withDangerMessage("Please update <a href=\"/profile\">your profile</a> with a correct ether address.") .url("/requests/" + id) .build(); } RequestDto request = requestService.findRequest(id); claimService.claim(principal, userClaimRequest); return redirectView(redirectAttributes) .withSuccessMessage("Your claim has been requested and is waiting for approval.") .url("/requests/" + id) .build(); } RequestController(final SecurityContextService securityContextService,
                             final RequestService requestService,
                             final PendingFundService pendingFundService,
                             final StatisticsService statisticsService,
                             final ProfileService profileService, FundService fundService,
                             final RefundService refundService,
                             final ClaimService claimService,
                             final FiatService fiatService,
                             final PlatformIssueService platformIssueService,
                             final ObjectMapper objectMapper,
                             final Mappers mappers); @GetMapping("/requests") ModelAndView requests(); @RequestMapping("/requests/{type}") ModelAndView details(@PathVariable String type, @RequestParam Map<String, String> queryParameters); @GetMapping("/requests/{id}") ModelAndView details(@PathVariable Long id, Model model); @GetMapping("/requests/github/{owner}/{repo}/{number}") ModelAndView details(@PathVariable String owner, @PathVariable String repo, @PathVariable String number, Model model); @GetMapping(value = "/requests/{id}/badge", produces = "image/svg+xml") ModelAndView detailsBadge(@PathVariable final Long id, final Model model, final HttpServletResponse response); @PostMapping("/requests/{id}/claim") ModelAndView claimRequest(Principal principal, @PathVariable Long id, @Valid UserClaimRequest userClaimRequest, RedirectAttributes redirectAttributes); @GetMapping("/requests/{id}/actions") ModelAndView detailActions(final Principal principal, @PathVariable final Long id); @PostMapping(value = {"/requests/{id}/watch"}, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ResponseBody String toggleWatchRequest(Principal principal, @PathVariable Long id); @GetMapping("/user/requests") ModelAndView userRequests(Principal principal); @PostMapping(value = {"/rest/requests/erc67/fund"}, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) @ResponseBody ERC67FundDto generateERC67ForFunding(@RequestBody @Valid CreateERC67FundRequest createERC67FundRequest);  }### Answer:
@Test public void claimRequest() throws Exception { RequestDto request = RequestDtoMother.freeCodeCampNoUserStories(); when(requestService.findRequest(1L)).thenReturn(request); UserClaimableDto userClaimableDto = UserClaimableDto.builder().build(); when(requestService.getUserClaimableResult(principal, 1L)).thenReturn(userClaimableDto); when(profileService.getUserProfile(principal).getEtherAddresses()).thenReturn(Collections.singletonList("0x0000000")); when(profileService.getUserProfile(principal).userOwnsAddress("0x0000000")).thenReturn(true); this.mockMvc.perform(post("/requests/{id}/claim", 1L) .param("address", "0x0000000") .param("platform", request.getIssueInformation().getPlatform().name()) .param("platformId", request.getIssueInformation().getPlatformId()) .principal(principal)) .andExpect(redirectAlert("success", "Your claim has been requested and is waiting for approval.")) .andExpect(redirectedUrl("/requests/" + 1L)); }