@Test
 public void shouldFindAccountByName() {
   when(accountRepository.findByUsername(TEST_USERNAME)).thenReturn(testAccount);
   AccountService accountService = new AccountServiceImpl(accountRepository, passwordEncoder);
   Account found = accountService.findByUsername(TEST_USERNAME);
   Assert.assertEquals(testAccount, found);
 }
 @Test
 public void shouldCreateNonExistentAccount() throws DuplicateAccountException {
   when(accountRepository.save(testAccount)).thenReturn(testAccount);
   AccountService accountService = new AccountServiceImpl(accountRepository, passwordEncoder);
   accountService.create(testAccount);
   verify(accountRepository, times(1)).save(testAccount);
 }
 @Test(expected = DuplicateAccountException.class)
 public void shouldNotCreateDuplicateAccount() throws DuplicateAccountException {
   when(accountRepository.findByUsername(TEST_USERNAME)).thenReturn(testAccount);
   when(testAccount.getUsername()).thenReturn(TEST_USERNAME);
   AccountService accountService = new AccountServiceImpl(accountRepository, passwordEncoder);
   accountService.create(testAccount);
   verify(accountRepository, times(0)).save(testAccount);
 }