예제 #1
0
 @Test
 public void testGetById() {
   int id = 1;
   User user = service.getById(id);
   assertNotNull(user);
   assertEquals(user.getId(), id);
 }
예제 #2
0
 @Test
 public void testGetByEmail() throws MovieException {
   String email = "*****@*****.**";
   User user = service.getUserByEmail(email);
   assertNotNull(user);
   assertEquals(user.getEmail(), email);
 }
예제 #3
0
 @Test
 public void testGetByName() throws MovieException {
   String name = "Olga";
   User user = service.getUserByName(name);
   assertNotNull(user);
   assertEquals(user.getUsername(), name);
 }
예제 #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);
 }
예제 #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);
  }