### Question:
FideliusController { @ResponseBody @PostMapping(value="/credentials/secret") public ResponseEntity createCredential(@Valid @RequestBody Credential credential) { final Credential credentialSecret; try { credentialSecret = credentialsService.createCredential(credential); } catch (FideliusException fe) { return new ResponseEntity<>(fe, fe.getError()); } if (credentialSecret != null) return new ResponseEntity<>(credentialSecret, HttpStatus.CREATED); return new ResponseEntity<>("Credential not created", HttpStatus.BAD_REQUEST); }  @RequestMapping(value = "/heartbeat", method = RequestMethod.GET) ResponseEntity heartbeatEndpoint(); @RequestMapping(value = "/credentials", method = RequestMethod.GET) ResponseEntity getCredentials(@RequestParam("account") String account,
                                                           @RequestParam("region") String region,
                                                           @RequestParam("application") String app); @ResponseBody @GetMapping(value="/credentials/{key:.+}/") ResponseEntity getCredential(@PathVariable("key") String longKey,
                                        @RequestParam("account") String account,
                                        @RequestParam("region") String region,
                                        @RequestParam("application") String application
    ); @RequestMapping(value = "/credentials/history", method = RequestMethod.GET) ResponseEntity getCredentialHistory(@RequestParam("account") String account,
                                                                   @RequestParam("region") String region,
                                                                   @RequestParam("application") String app,
                                                                   @RequestParam("environment") String environment,
                                                                   @RequestParam(value = "component", required = false) String component,
                                                                   @RequestParam("shortKey") String key); @ResponseBody @GetMapping(value="/credentials/secret") ResponseEntity getSecret(@RequestParam("account") String account,
                                      @RequestParam("region") String region,
                                      @RequestParam("application") String application,
                                      @RequestParam("environment") String environment,
                                      @RequestParam(value = "component", required = false) String component,
                                      @RequestParam("shortKey") String shortKey); @ResponseBody @PostMapping(value="/credentials/secret") ResponseEntity createCredential(@Valid @RequestBody Credential credential); @ResponseBody @PutMapping(value="/credentials/secret") ResponseEntity updateCredential(@Valid @RequestBody Credential credential); @ResponseBody @DeleteMapping(value="/credentials/secret") ResponseEntity deleteCredential(@RequestParam("account") String account,
                                                       @RequestParam("region") String region,
                                                       @RequestParam("application") String application,
                                                       @RequestParam("environment") String environment,
                                                       @RequestParam(value = "component", required = false) String component,
                                                       @RequestParam("shortKey") String shortKey); @ResponseBody @GetMapping(value="/validActiveDirectoryRegularExpression") ResponseEntity activeDirectory(); @ResponseBody @GetMapping(value="/accounts") ResponseEntity getAccounts();  }### Answer:
@Test @WithMockUser public void createCredential() throws Exception { when(credentialsService.createCredential(any(Credential.class))).thenReturn(this.credential); mockMvc.perform(createCredentialRequest) .andExpect(status().is2xxSuccessful()); }