@Test public void testCreateNewAdminUserStringStringString() { service.createNewAdminUser("robbo", "*****@*****.**", "password"); Account a = service.loadAccountByUserName("robbo"); assertNotNull(a); assertEquals("*****@*****.**", a.getEmail()); }
@Test public void testCreateNewAdminUserStringStringStringStringString() { service.createNewUser("robbo", "*****@*****.**", "password", "rob", "hinds", Role.ROLE_ADMIN); Account a = service.loadAccountByUserName("robbo"); assertNotNull(a); assertEquals("*****@*****.**", a.getEmail()); assertEquals("rob", a.getFirstName()); assertEquals("hinds", a.getLastName()); }
@Test public void testLoadAccount() { List<Account> accs = service.findAllAccounts(); assertTrue(accs.size() > 0); Account original = accs.get(0); Account a = service.loadAccount(original.getId()); // this is will load // the test account assertNotNull(a); assertEquals(original.getUserName(), a.getUserName()); }
@Test public void testFindAllAccounts() { List<Account> accs = service.findAllAccounts(); assertEquals("Check DB is empty first", 1, accs.size()); // always the // batch // test // account // created - // needed // for // persistence Account a = new Account(); a.setUserName("robb"); a.setPassword("password"); service.storeAccount(a); accs = service.findAllAccounts(); assertEquals("check Account has been created", 2, accs.size()); }
@Test public void testLoadAccountByUserName() { Account a = service.loadAccountByUserName("test"); assertNotNull(a); assertEquals("test", a.getUserName()); }