@Test public void testFetchByPrimaryKeyExisting() throws Exception { ShoppingItemPrice newShoppingItemPrice = addShoppingItemPrice(); ShoppingItemPrice existingShoppingItemPrice = _persistence.fetchByPrimaryKey(newShoppingItemPrice.getPrimaryKey()); Assert.assertEquals(existingShoppingItemPrice, newShoppingItemPrice); }
@Test public void testCreate() throws Exception { long pk = ServiceTestUtil.nextLong(); ShoppingItemPrice shoppingItemPrice = _persistence.create(pk); Assert.assertNotNull(shoppingItemPrice); Assert.assertEquals(shoppingItemPrice.getPrimaryKey(), pk); }
@Test public void testRemove() throws Exception { ShoppingItemPrice newShoppingItemPrice = addShoppingItemPrice(); _persistence.remove(newShoppingItemPrice); ShoppingItemPrice existingShoppingItemPrice = _persistence.fetchByPrimaryKey(newShoppingItemPrice.getPrimaryKey()); Assert.assertNull(existingShoppingItemPrice); }
@Test public void testUpdateExisting() throws Exception { long pk = ServiceTestUtil.nextLong(); ShoppingItemPrice newShoppingItemPrice = _persistence.create(pk); newShoppingItemPrice.setItemId(ServiceTestUtil.nextLong()); newShoppingItemPrice.setMinQuantity(ServiceTestUtil.nextInt()); newShoppingItemPrice.setMaxQuantity(ServiceTestUtil.nextInt()); newShoppingItemPrice.setPrice(ServiceTestUtil.nextDouble()); newShoppingItemPrice.setDiscount(ServiceTestUtil.nextDouble()); newShoppingItemPrice.setTaxable(ServiceTestUtil.randomBoolean()); newShoppingItemPrice.setShipping(ServiceTestUtil.nextDouble()); newShoppingItemPrice.setUseShippingFormula(ServiceTestUtil.randomBoolean()); newShoppingItemPrice.setStatus(ServiceTestUtil.nextInt()); _persistence.update(newShoppingItemPrice); ShoppingItemPrice existingShoppingItemPrice = _persistence.findByPrimaryKey(newShoppingItemPrice.getPrimaryKey()); Assert.assertEquals( existingShoppingItemPrice.getItemPriceId(), newShoppingItemPrice.getItemPriceId()); Assert.assertEquals(existingShoppingItemPrice.getItemId(), newShoppingItemPrice.getItemId()); Assert.assertEquals( existingShoppingItemPrice.getMinQuantity(), newShoppingItemPrice.getMinQuantity()); Assert.assertEquals( existingShoppingItemPrice.getMaxQuantity(), newShoppingItemPrice.getMaxQuantity()); AssertUtils.assertEquals(existingShoppingItemPrice.getPrice(), newShoppingItemPrice.getPrice()); AssertUtils.assertEquals( existingShoppingItemPrice.getDiscount(), newShoppingItemPrice.getDiscount()); Assert.assertEquals(existingShoppingItemPrice.getTaxable(), newShoppingItemPrice.getTaxable()); AssertUtils.assertEquals( existingShoppingItemPrice.getShipping(), newShoppingItemPrice.getShipping()); Assert.assertEquals( existingShoppingItemPrice.getUseShippingFormula(), newShoppingItemPrice.getUseShippingFormula()); Assert.assertEquals(existingShoppingItemPrice.getStatus(), newShoppingItemPrice.getStatus()); }