public void testUpdateSuccess() {
    long lngCustId = System.currentTimeMillis();
    String orderNum = "123";
    String newOrderNum = "321";

    SalesOrder salesOrder = new SalesOrder();
    salesOrder.setSorCusId(lngCustId);
    salesOrder.setSorOrderNum(orderNum);
    salesOrder.setSorTotalPrice(BigDecimal.ZERO);

    salesOrderDao.save(salesOrder);

    HibernateUtil.getSession().flush();

    Long lngId = salesOrder.getSorId();
    salesOrder = salesOrderDao.findById(lngId);

    salesOrder.setSorOrderNum(newOrderNum);
    salesOrderDao.save(salesOrder);

    HibernateUtil.getSession().flush();

    salesOrder = salesOrderDao.findById(lngId);

    assertEquals(newOrderNum, salesOrder.getSorOrderNum());
  }
  public void testFindError() {
    Long lngProduct = new Long(-1);

    SalesOrder Product = salesOrderDao.findById(lngProduct);

    assertNull(Product);
  }
  public void testDeleteSuccess() {
    long lngCustId = System.currentTimeMillis();
    String orderNum = "123";

    SalesOrder salesOrder = new SalesOrder();
    salesOrder.setSorCusId(lngCustId);
    salesOrder.setSorOrderNum(orderNum);
    salesOrder.setSorTotalPrice(BigDecimal.ZERO);

    salesOrderDao.save(salesOrder);

    HibernateUtil.getSession().flush();

    Long lngId = salesOrder.getSorId();
    salesOrder = salesOrderDao.findById(lngId);

    salesOrderDao.delete(salesOrder);

    Assert.assertTrue(true);
  }
  public void testInsertError() {
    long lngCustId = System.currentTimeMillis();
    String orderNum = "123";

    SalesOrder salesOrder = new SalesOrder();
    salesOrder.setSorCusId(lngCustId);
    salesOrder.setSorOrderNum(orderNum);

    try {
      salesOrderDao.save(salesOrder);
      HibernateUtil.getSession().flush();

      Assert.fail();
    } catch (PropertyValueException e) {
    }
  }
 /* (non-Javadoc)
  * @see junit.framework.TestCase#tearDown()
  */
 @After
 protected void tearDown() throws Exception {
   salesOrderDao.rollbackTransaction();
 }
 /* (non-Javadoc)
  * @see junit.framework.TestCase#setUp()
  */
 @Before
 protected void setUp() throws Exception {
   salesOrderDao.beginTransaction();
 }