Ejemplo n.º 1
0
 @Test
 public void testCRUD() throws SQLException {
   CV cv = createCV();
   // create
   cvDao.save(cv);
   assertEquals(cvDao.findById(cv.getId()).getTitle(), "Software developer");
   cv.setTitle("Programmer");
   // update
   cvDao.save(cv);
   assertEquals(cvDao.findById(cv.getId()).getTitle(), "Programmer");
   // delete
   cvDao.delete(cv);
   assertNull(cvDao.findById(cv.getId()));
 }
Ejemplo n.º 2
0
  @Test
  public void testFindByOwner() throws SQLException {
    CV newCV = createCV();
    // create
    cvDao.save(newCV);

    List<CV> cvList = cvDao.findCVsByOwner(newCV.getOwner().getId());
    assertNotNull(cvList);
    assertFalse(cvList.isEmpty());
    for (CV cv : cvList) {
      assertNotNull(cv);
      assertNotNull(cv.getId());
    }
  }