Exemplo n.º 1
0
 @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);
 }
Exemplo n.º 2
0
 @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()));
 }
Exemplo n.º 3
0
 @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());
 }
Exemplo n.º 4
0
 @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);
 }