ShopProductDAO extends BaseIbatisDAO { public ShopProduct queryByPk(final Long id) { return (ShopProduct) super.queryForObject("SHOP_PRODUCT.queryByPk", id); }  @SuppressWarnings("unchecked") List<ShopProduct> query(final Map<String, Object> parameters); Long count(final Map<String, Object> parameters); ShopProduct queryByPk(final Long id); ShopProduct queryDetailByPk(final Long id); Long insert(final ShopProduct product); Long insert(final ShopProductCoupon couponProduct); Long update(final ShopProduct product); Long update(final ShopProductCoupon couponProduct); void reduceStocks(final Map<String, Object> parameters); @SuppressWarnings("unchecked") List<ShopProductCondition> getShopProductConditionByShopProductId(Long productId); ShopProductCondition insertShopProductCondition(ShopProductCondition entity); void deleteShopProductConditionByProductId(Long productId);  }
@Test public void testQueryByPk(){ 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); Assert.assertEquals("Y", f.getIsHotProduct()); Assert.assertEquals("Y", f.getIsRecommend()); Assert.assertEquals("pictures", f.getPictures()); Assert.assertEquals("content",f.getContent()); Assert.assertEquals("11", f.getMarketPrice().toString()); Assert.assertEquals("12", f.getPointChange().toString()); }