@Test public void checkFindingSiteUserById() { SiteUser user = siteUserManager.addSiteUser( new SiteUser("UserMaster", "password", "salt", "*****@*****.**")); SiteUser userToTests = siteUserManager.findSiteUserById(user); assertEquals(userToTests.getIdSiteUser(), user.getIdSiteUser()); assertEquals(userToTests.getLogin(), user.getLogin()); assertEquals(userToTests.getHash(), user.getHash()); assertEquals(userToTests.getSalt(), user.getSalt()); assertEquals(userToTests.getEmail(), user.getEmail()); }
@Test public void checkAddingSiteUser() { SiteUser user = siteUserManager.addSiteUser(new SiteUser("mateusz", "password", "salt", "*****@*****.**")); SiteUser userToTests = siteUserManager.findSiteUserById(user); assertNotNull(userToTests); assertEquals(userToTests.getIdSiteUser(), user.getIdSiteUser()); assertEquals(userToTests.getLogin(), user.getLogin()); assertEquals(userToTests.getHash(), user.getHash()); assertEquals(userToTests.getSalt(), user.getSalt()); assertEquals(userToTests.getEmail(), user.getEmail()); }
@Test public void checkUpdatingSiteUser() { SiteUser user = siteUserManager.addSiteUser(new SiteUser("mateusz", "password", "salt", "*****@*****.**")); user.setLogin("andrzejek"); user.setHash("hash"); user.setSalt("other_salt"); user.setEmail("*****@*****.**"); SiteUser userToTests = siteUserManager.updateUser(user); assertNotNull(userToTests); assertEquals(userToTests.getLogin(), "andrzejek"); assertEquals(userToTests.getHash(), "hash"); assertEquals(userToTests.getSalt(), "other_salt"); assertEquals(userToTests.getEmail(), "*****@*****.**"); }
@Test public void checkDeletingSiteUser() { SiteUser user = siteUserManager.addSiteUser( new SiteUser("user1993", "password", "salt", "*****@*****.**")); SiteUser userToTests = siteUserManager.findSiteUserById(user); assertNotNull(userToTests); assertEquals(userToTests.getIdSiteUser(), user.getIdSiteUser()); assertEquals(userToTests.getLogin(), user.getLogin()); assertEquals(userToTests.getHash(), user.getHash()); assertEquals(userToTests.getSalt(), user.getSalt()); assertEquals(userToTests.getEmail(), user.getEmail()); siteUserManager.deleteSiteUser(userToTests); userToTests = siteUserManager.findSiteUserById(user); assertNull(userToTests); }