Пример #1
0
  @Test
  public void testFindByPK() {
    try {

      RowSet rs = (RowSet) notaBDAO.findByPK(notaB1.getIdNotaB());
      try {

        assertTrue(rs.next());

      } catch (SQLException e) {
        fail(e.getMessage());
      }

    } catch (DAOException e) {
      fail(e.getMessage());
    } finally {
      try {
        db.closeConnection(conn);
      } catch (DBAccessException e) {
        e.printStackTrace();
      }
    }
  }
Пример #2
0
  @Test
  public void testRemove() {
    try {

      boolean res = notaBDAO.remove(conn, notaB1.getIdNotaB());

      db.rollbackConnection(conn);

      assertTrue(res);

    } catch (DBAccessException e) {
      fail(e.getMessage());
    } catch (DAOException e) {

      fail(e.getMessage());
    } finally {

      try {
        db.closeConnection(conn);
      } catch (DBAccessException e) {
        e.printStackTrace();
      }
    }
  }