Esempio n. 1
0
 @Test
 public void testGetById() {
   int id = 1;
   User user = service.getById(id);
   assertNotNull(user);
   assertEquals(user.getId(), id);
 }
Esempio n. 2
0
 @Test
 public void testGetByEmail() throws MovieException {
   String email = "*****@*****.**";
   User user = service.getUserByEmail(email);
   assertNotNull(user);
   assertEquals(user.getEmail(), email);
 }
Esempio n. 3
0
 @Test
 public void testGetByName() throws MovieException {
   String name = "Olga";
   User user = service.getUserByName(name);
   assertNotNull(user);
   assertEquals(user.getUsername(), name);
 }
Esempio n. 4
0
 @Test
 public void testRegister() throws MovieException {
   User user = TestUtils.createTestUser(NAME, "pass123", new Date(), NAME + "@email.com");
   int accountId = accountService.create(user.getAccount());
   user.getAccount().setId(accountId);
   service.register(user);
   user = service.getUserByName(NAME);
   assertTrue(user.getId() > 0);
 }
Esempio n. 5
0
  @Test
  public void testUpdate() throws MovieException {
    User user = service.getUserByName(NAME);
    String newName = NAME + " 1";
    user.setName(newName);
    service.update(user);
    user = service.getUserByName(newName);

    assertEquals(user.getUsername(), newName);
  }