コード例 #1
0
  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());
  }
コード例 #2
0
  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);
  }