@Test public void findAccountById() { Account a = accountDao.findAccountById(Long.valueOf(100001)); Assert.assertEquals(a.getId(), Long.valueOf(100001)); Assert.assertEquals(a.getFirstName(), "Jose"); Assert.assertEquals(a.getLastName(), "Jose"); Assert.assertEquals(a.getLogin(), "upswimsdn"); Assert.assertEquals(a.getPassword(), "aaaaaa"); }
@Test public void updateAccount() { Account accountToUpdate = accountDao.findAccountById(Long.valueOf(100001)); Assert.assertEquals(accountToUpdate.getLogin(), "upswimsdn"); accountToUpdate.setLogin("butts"); accountDao.createOrUpdateAccount(accountToUpdate); Account accountAfterUpdate = accountDao.findAccountById(Long.valueOf(100001)); Assert.assertEquals(accountToUpdate.getLogin(), accountAfterUpdate.getLogin()); }
@Test public void createAccount() { Account created = new Account(null, "first", "last", "test", "testagain", null, Gender.FEMALE); accountDao.createAccount(created); Account retrieved = accountDao.findAccountById(created.getId()); Assert.assertEquals(created.getId(), retrieved.getId()); Assert.assertEquals(created.getFirstName(), retrieved.getFirstName()); Assert.assertEquals(created.getLastName(), retrieved.getLastName()); Assert.assertEquals(created.getPassword(), retrieved.getPassword()); }