Exemplo n.º 1
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);
 }
Exemplo n.º 2
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);
  }
Exemplo n.º 3
0
 @Test
 public void testGetByEmail() throws MovieException {
   String email = "*****@*****.**";
   User user = service.getUserByEmail(email);
   assertNotNull(user);
   assertEquals(user.getEmail(), email);
 }
Exemplo n.º 4
0
 @Test
 public void testGetById() {
   int id = 1;
   User user = service.getById(id);
   assertNotNull(user);
   assertEquals(user.getId(), id);
 }
Exemplo n.º 5
0
 @Test
 public void testGetByName() throws MovieException {
   String name = "Olga";
   User user = service.getUserByName(name);
   assertNotNull(user);
   assertEquals(user.getUsername(), name);
 }
Exemplo n.º 6
0
 @Test(expected = MovieException.class)
 public void testGetByEmptyEmail() throws MovieException {
   String email = "";
   service.getUserByEmail(email);
 }
Exemplo n.º 7
0
 @Test(expected = MovieException.class)
 public void testGetByEmptyName() throws MovieException {
   String name = "";
   service.getUserByName(name);
 }