@Test @Rollback(true) public void testGetAccount_String_ValidName() { Account account = null; // Check if account was retieved correctly try { account = this.accountDaoImpl.getAccount("Hello"); } catch (Exception e) { fail("Account was not retrieved correctly with error : " + e.getLocalizedMessage()); } assertNotNull(account); assertEquals(account.getName(), this.testAccountNotActivated.getName()); assertEquals(account.getId().intValue(), this.testAccountNotActivated.getId().intValue()); assertEquals(account.getPassword(), this.testAccountNotActivated.getPassword()); assertFalse(account.getActivated()); System.out.println("testGetAccount_String_ValidName() passed"); }
@Test @Rollback(true) public void testSaveAccount_OldAccount() { // Save old Account try { this.accountDaoImpl.saveAccount(testAccountNotActivated); } catch (Exception e) { fail("Could not save test account for saveAccount()"); } try { Account account = this.accountDaoImpl.getAccount(0); account.setPassword("1234"); this.accountDaoImpl.saveAccount(account); account = this.accountDaoImpl.getAccount(0); assertNotNull(account); assertEquals(account.getName(), this.testAccountNotActivated.getName()); assertEquals(account.getId().intValue(), this.testAccountNotActivated.getId().intValue()); assertEquals(account.getPassword(), this.testAccountNotActivated.getPassword()); assertFalse(account.getActivated()); } catch (DataAccessException e) { fail("DataAccessException was thrown for resave"); } System.out.println("testSaveAccount_OldAccount() passed"); }