示例#1
0
  @Test
  public void testSaveProduct() {
    List<Product> products = productDao.getProductList();

    Product p = products.get(0);
    Double price = p.getPrice();
    p.setPrice(200.12);
    productDao.saveProduct(p);

    List<Product> updatedProducts = productDao.getProductList();
    Product p2 = updatedProducts.get(0);
    assertEquals(p2.getPrice(), 200.12, 0);

    p2.setPrice(price);
    productDao.saveProduct(p2);
  }
示例#2
0
 @Test
 public void testGetProductList() {
   List<Product> products = productDao.getProductList();
   assertEquals(products.size(), 3, 0);
 }