@Test public void getUser() { service.saveUser(user); selectedUser = service.getUserByUserName(user.getUsername()); assertTrue(user.getUsername().equals(selectedUser.getUsername())); assertTrue(user.getPassword().equals(selectedUser.getPassword())); assertTrue(user.getIsAdmin() == (selectedUser.getIsAdmin())); Boolean userNameAvailable = service.emailAvailable(user.getUsername()); assertFalse(userNameAvailable); }
@Test public void resetPassword() { String newPassword = service.resetUserPassword(user); service.saveUser(user); User savedUser = service.getUserByUserName(user.getUsername()); assertTrue(service.encryptString(newPassword).equals(savedUser.getPassword())); }
@Test public void testCreatingEvaluation() { user = populateUser(); evaluation = factory.createEvalution(); evaluation.setName("Test Evaluation #1"); evaluation.setUser(user); user.addEvaluation(evaluation); service.saveUser(user); user = service.getUserByUserName(user.getUsername()); }
@Test public void testCreatingMultipleEvaluations() { Date date = new Date(); String firstName = "Test Evaluation List #1 " + date.toString(); String secondName = "Test Evaluation List #2 " + date.toString(); user = populateUser(); evaluation = factory.createEvalution(); evaluation.setName(firstName); secondEvaluation = factory.createEvalution(); secondEvaluation.setName(secondName); user.addEvaluation(evaluation); user.addEvaluation(secondEvaluation); service.saveUser(user); user = service.getUserByUserName(user.getUsername()); assertTrue(user.getEvaluationSet().size() == 2); }