Exemplo n.º 1
0
 @Test
 public void testClient1() {
   // insert into client(lastname, firstname, type, dt_create) values ('test', 'first', 'PROSPECT',
   // '2015-01-01');
   assertNotNull(clientDao);
   Client result = clientDao.getClient(1);
   assertNotNull(result);
   assertEquals(Integer.valueOf(1), result.getId());
   assertEquals("test", result.getLastName());
   assertEquals("first", result.getFirstName());
   assertEquals("PROSPECT", result.getType());
   assertNull(result.getUpdateDt());
   assertNotNull(result.getContacts());
   assertFalse(result.getContacts().isEmpty());
   // update
   result.setType("CLIENT");
   Date testDt = new Date();
   result.setCreateDt(testDt);
   clientDao.updateClient(result);
   //
   result = clientDao.getClient(1);
   assertEquals(Integer.valueOf(1), result.getId());
   assertEquals("test", result.getLastName());
   assertEquals("first", result.getFirstName());
   assertEquals("CLIENT", result.getType());
   assertNotNull(result.getUpdateDt());
   assertFalse(testDt.equals(result.getCreateDt()));
 }
Exemplo n.º 2
0
  @Test
  public void testInsert() {
    assertNotNull(clientDao);
    Client c = new Client();
    c.setFirstName("test");
    c.setLastName("third");
    c.setType("PROSPECT");
    clientDao.createClient(c, null);

    Client result = clientDao.getClient(3);
    assertNotNull(result);
    assertEquals(Integer.valueOf(3), result.getId());
    assertEquals("third", result.getLastName());
    assertEquals("test", result.getFirstName());
    assertEquals("PROSPECT", result.getType());
    assertNull(result.getUpdateDt());
  }