### Question:
AccountController { @GetMapping(path = "/account/get/{username}") public ResponseEntity<?> getAccount(@PathVariable("username") final String username) { final Optional<AccountDto> account = accountService.getAccount(username); return account.isPresent() ? ResponseEntity.ok(account.get()) : ResponseEntity.notFound().build(); }  @GetMapping(path = "/account/get/{username}") ResponseEntity<?> getAccount(@PathVariable("username") final String username); @PostMapping(path = "/account/auth") ResponseEntity<?> authenticate(@Valid @RequestBody final AuthDto authDto,
        final BindingResult bindingResult); @PostMapping(path = "/account/new") ResponseEntity<?> createAccount(@Valid @RequestBody final AccountDto account,
        final BindingResult bindingResult); @PostMapping(path = "/account/update") ResponseEntity<?> updateAccount(@Valid @RequestBody final AccountDto account,
        final BindingResult bindingResult); @GetMapping(path = "/account/delete/{id}") ResponseEntity<?> deleteAccount(@PathVariable("id") final String username);  }### Answer:
@Test public void test_getAccount_notFound() throws Exception { when(accountService.getAccount(TEST_USERNAME)).thenReturn(Optional.empty()); mockMvc.perform(get("/account/get/" + TEST_USERNAME)) .andExpect(status().isNotFound()); }
@Test public void test_authenticate_fail() throws Exception { final AuthDto authDto = new AuthDto(); authDto.setUsername(TEST_USERNAME); authDto.setPassword(TEST_PASSWORD); final ObjectMapper objectMapper = new ObjectMapper(); when(accountService.getAccount(TEST_USERNAME, TEST_PASSWORD)).thenReturn(Optional.empty()); mockMvc .perform(post("/account/auth/").content(objectMapper.writeValueAsString(authDto)) .contentType(MediaType.APPLICATION_JSON)) .andExpect(status().isBadRequest()); }