Exemplo n.º 1
0
  /** Test method for {@link com.loiane.dao.ContactDAO#update(com.loiane.model.Contact)}. */
  @Test
  public void testUpdate() {

    Contact actual =
        new Contact(3, "Contact2Updated", "(000) 111-1111", "*****@*****.**");

    Contact expected = contactDAO.selectById(3);
    expected.setEmail("*****@*****.**");
    expected.setName("Contact2Updated");
    expected.setPhone("(000) 111-1111");
    contactDAO.update(expected);
    expected = contactDAO.selectById(3);

    assertNotNull(expected);
    assertEquals(actual, expected);
    assertNotSame(actual, expected);
  }
Exemplo n.º 2
0
  /** Test method for {@link com.loiane.dao.ContactDAO#insert(com.loiane.model.Contact)}. */
  @Test
  public void testInsert() {

    Contact actual = new Contact();
    actual.setName("Loiane");
    actual.setPhone("(000) 111-1111");
    actual.setEmail("*****@*****.**");
    contactDAO.insert(actual);

    assertEquals(21, actual.getId());

    Contact expected = contactDAO.selectById(actual.getId()); // id = 21

    assertEquals(actual, expected);
    assertNotSame(actual, expected);
  }