@Test
public void testUpdate() throws SQLException, IllegalAccessException, InvocationTargetException{

	ShopProduct product = new ShopProduct();
	product.setContent("content");
	product.setIsValid("Y");
	product.setIsRecommend("Y");
	product.setIsHotProduct("Y");
	product.setMarketPrice(Long.valueOf(11L));
	product.setPointChange(Long.valueOf(12L));
	product.setStocks(Long.valueOf(13L));
	product.setPictures("pictures");
	product.setProductCode("productCode");
	product.setProductName("productName");
	product.setProductType(Constant.SHOP_PRODUCT_TYPE.COUPON.name());
	Long id = shopProductDAO.insert(product);
	
	ShopProduct f = shopProductDAO.queryByPk(id);
	f.setIsHotProduct("N");
	f.setPictures("pictures_2");
	f.setContent("content_2");
	f.setPointChange(Long.valueOf(22L));
	shopProductDAO.update(f);
	
	String sql = "select * from SHOP_PRODUCT where PRODUCT_ID = " + id;
	Statement stat = conn.createStatement();
	ResultSet rs = stat.executeQuery(sql);
	rs.next();
	
	//修改的属性
	Assert.assertEquals("N", rs.getString("IS_HOT_PRODUCT"));
	Assert.assertEquals("pictures_2", rs.getString("PICTURES"));
	Assert.assertEquals("content_2", rs.getString("CONTENT"));
	Assert.assertEquals("22", String.valueOf(rs.getLong("POINT_CHANGE")));
	
	//未修改
	Assert.assertEquals("Y", rs.getString("IS_RECOMMEND"));
	Assert.assertEquals("11", String.valueOf(rs.getLong("MARKET_PRICE")));
	
	//testUpdate(CouponProduct);
	ShopProductCoupon cP_1 = new ShopProductCoupon();
	product.setCreateTime(new Date());
	product.setModifyTime(new Date());
	BeanUtils.copyProperties(cP_1, product);
	cP_1.setProductId(null);
	cP_1.setCouponId(Long.valueOf(14L));
	Long cpId_1 = shopProductDAO.insert(cP_1);
	ShopProductCoupon cP_2 = (ShopProductCoupon)shopProductDAO.queryDetailByPk(cpId_1);
	cP_2.setStocks(Long.valueOf(23L));
	cP_2.setCouponId(Long.valueOf(25L));
	cP_2.setContent("content_cp");
	cP_2.setProductName("productName_cp");
	cP_2.setIsHotProduct("N");
	shopProductDAO.update(cP_2);
	
	String cpSql = "select p.*, cp.* from SHOP_PRODUCT p, SHOP_PRODUCT_COUPON cp where p.PRODUCT_ID = cp.PRODUCT_ID AND p.PRODUCT_ID = " + cpId_1;
	ResultSet cpRs = stat.executeQuery(cpSql);
	cpRs.next();
	
	//修改的属性
	Assert.assertEquals("content_cp", cpRs.getString("CONTENT"));
	Assert.assertEquals("productName_cp", cpRs.getString("PRODUCT_NAME"));
	Assert.assertEquals("N", cpRs.getString("IS_HOT_PRODUCT"));
	Assert.assertEquals("23", String.valueOf(cpRs.getLong("STOCKS")));
	Assert.assertEquals("25", String.valueOf(cpRs.getLong("COUPON_ID")));
	
	//未修改
	Assert.assertEquals(Constant.SHOP_PRODUCT_TYPE.COUPON.name(), cpRs.getString("PRODUCT_TYPE"));
	Assert.assertEquals("Y", cpRs.getString("IS_VALID"));
}