@Test
  public void testFetchByPrimaryKeysWithOnePrimaryKey() throws Exception {
    ShoppingOrder newShoppingOrder = addShoppingOrder();

    Set<Serializable> primaryKeys = new HashSet<Serializable>();

    primaryKeys.add(newShoppingOrder.getPrimaryKey());

    Map<Serializable, ShoppingOrder> shoppingOrders = _persistence.fetchByPrimaryKeys(primaryKeys);

    Assert.assertEquals(1, shoppingOrders.size());
    Assert.assertEquals(newShoppingOrder, shoppingOrders.get(newShoppingOrder.getPrimaryKey()));
  }
  @Test
  public void testFetchByPrimaryKeysWithMultiplePrimaryKeysWhereSomePrimaryKeysExist()
      throws Exception {
    ShoppingOrder newShoppingOrder = addShoppingOrder();

    long pk = RandomTestUtil.nextLong();

    Set<Serializable> primaryKeys = new HashSet<Serializable>();

    primaryKeys.add(newShoppingOrder.getPrimaryKey());
    primaryKeys.add(pk);

    Map<Serializable, ShoppingOrder> shoppingOrders = _persistence.fetchByPrimaryKeys(primaryKeys);

    Assert.assertEquals(1, shoppingOrders.size());
    Assert.assertEquals(newShoppingOrder, shoppingOrders.get(newShoppingOrder.getPrimaryKey()));
  }
  @Test
  public void testFetchByPrimaryKeysWithMultiplePrimaryKeysWhereAllPrimaryKeysExist()
      throws Exception {
    ShoppingOrder newShoppingOrder1 = addShoppingOrder();
    ShoppingOrder newShoppingOrder2 = addShoppingOrder();

    Set<Serializable> primaryKeys = new HashSet<Serializable>();

    primaryKeys.add(newShoppingOrder1.getPrimaryKey());
    primaryKeys.add(newShoppingOrder2.getPrimaryKey());

    Map<Serializable, ShoppingOrder> shoppingOrders = _persistence.fetchByPrimaryKeys(primaryKeys);

    Assert.assertEquals(2, shoppingOrders.size());
    Assert.assertEquals(newShoppingOrder1, shoppingOrders.get(newShoppingOrder1.getPrimaryKey()));
    Assert.assertEquals(newShoppingOrder2, shoppingOrders.get(newShoppingOrder2.getPrimaryKey()));
  }
  @Test
  public void testFetchByPrimaryKeyExisting() throws Exception {
    ShoppingOrder newShoppingOrder = addShoppingOrder();

    ShoppingOrder existingShoppingOrder =
        _persistence.fetchByPrimaryKey(newShoppingOrder.getPrimaryKey());

    Assert.assertEquals(existingShoppingOrder, newShoppingOrder);
  }
  @Test
  public void testCreate() throws Exception {
    long pk = RandomTestUtil.nextLong();

    ShoppingOrder shoppingOrder = _persistence.create(pk);

    Assert.assertNotNull(shoppingOrder);

    Assert.assertEquals(shoppingOrder.getPrimaryKey(), pk);
  }
  @Test
  public void testRemove() throws Exception {
    ShoppingOrder newShoppingOrder = addShoppingOrder();

    _persistence.remove(newShoppingOrder);

    ShoppingOrder existingShoppingOrder =
        _persistence.fetchByPrimaryKey(newShoppingOrder.getPrimaryKey());

    Assert.assertNull(existingShoppingOrder);
  }
  @Test
  public void testResetOriginalValues() throws Exception {
    ShoppingOrder newShoppingOrder = addShoppingOrder();

    _persistence.clearCache();

    ShoppingOrder existingShoppingOrder =
        _persistence.findByPrimaryKey(newShoppingOrder.getPrimaryKey());

    Assert.assertTrue(
        Objects.equals(
            existingShoppingOrder.getNumber(),
            ReflectionTestUtil.invoke(
                existingShoppingOrder, "getOriginalNumber", new Class<?>[0])));

    Assert.assertTrue(
        Objects.equals(
            existingShoppingOrder.getPpTxnId(),
            ReflectionTestUtil.invoke(
                existingShoppingOrder, "getOriginalPpTxnId", new Class<?>[0])));
  }
  @Test
  public void testUpdateExisting() throws Exception {
    long pk = RandomTestUtil.nextLong();

    ShoppingOrder newShoppingOrder = _persistence.create(pk);

    newShoppingOrder.setGroupId(RandomTestUtil.nextLong());

    newShoppingOrder.setCompanyId(RandomTestUtil.nextLong());

    newShoppingOrder.setUserId(RandomTestUtil.nextLong());

    newShoppingOrder.setUserName(RandomTestUtil.randomString());

    newShoppingOrder.setCreateDate(RandomTestUtil.nextDate());

    newShoppingOrder.setModifiedDate(RandomTestUtil.nextDate());

    newShoppingOrder.setNumber(RandomTestUtil.randomString());

    newShoppingOrder.setTax(RandomTestUtil.nextDouble());

    newShoppingOrder.setShipping(RandomTestUtil.nextDouble());

    newShoppingOrder.setAltShipping(RandomTestUtil.randomString());

    newShoppingOrder.setRequiresShipping(RandomTestUtil.randomBoolean());

    newShoppingOrder.setInsure(RandomTestUtil.randomBoolean());

    newShoppingOrder.setInsurance(RandomTestUtil.nextDouble());

    newShoppingOrder.setCouponCodes(RandomTestUtil.randomString());

    newShoppingOrder.setCouponDiscount(RandomTestUtil.nextDouble());

    newShoppingOrder.setBillingFirstName(RandomTestUtil.randomString());

    newShoppingOrder.setBillingLastName(RandomTestUtil.randomString());

    newShoppingOrder.setBillingEmailAddress(RandomTestUtil.randomString());

    newShoppingOrder.setBillingCompany(RandomTestUtil.randomString());

    newShoppingOrder.setBillingStreet(RandomTestUtil.randomString());

    newShoppingOrder.setBillingCity(RandomTestUtil.randomString());

    newShoppingOrder.setBillingState(RandomTestUtil.randomString());

    newShoppingOrder.setBillingZip(RandomTestUtil.randomString());

    newShoppingOrder.setBillingCountry(RandomTestUtil.randomString());

    newShoppingOrder.setBillingPhone(RandomTestUtil.randomString());

    newShoppingOrder.setShipToBilling(RandomTestUtil.randomBoolean());

    newShoppingOrder.setShippingFirstName(RandomTestUtil.randomString());

    newShoppingOrder.setShippingLastName(RandomTestUtil.randomString());

    newShoppingOrder.setShippingEmailAddress(RandomTestUtil.randomString());

    newShoppingOrder.setShippingCompany(RandomTestUtil.randomString());

    newShoppingOrder.setShippingStreet(RandomTestUtil.randomString());

    newShoppingOrder.setShippingCity(RandomTestUtil.randomString());

    newShoppingOrder.setShippingState(RandomTestUtil.randomString());

    newShoppingOrder.setShippingZip(RandomTestUtil.randomString());

    newShoppingOrder.setShippingCountry(RandomTestUtil.randomString());

    newShoppingOrder.setShippingPhone(RandomTestUtil.randomString());

    newShoppingOrder.setCcName(RandomTestUtil.randomString());

    newShoppingOrder.setCcType(RandomTestUtil.randomString());

    newShoppingOrder.setCcNumber(RandomTestUtil.randomString());

    newShoppingOrder.setCcExpMonth(RandomTestUtil.nextInt());

    newShoppingOrder.setCcExpYear(RandomTestUtil.nextInt());

    newShoppingOrder.setCcVerNumber(RandomTestUtil.randomString());

    newShoppingOrder.setComments(RandomTestUtil.randomString());

    newShoppingOrder.setPpTxnId(RandomTestUtil.randomString());

    newShoppingOrder.setPpPaymentStatus(RandomTestUtil.randomString());

    newShoppingOrder.setPpPaymentGross(RandomTestUtil.nextDouble());

    newShoppingOrder.setPpReceiverEmail(RandomTestUtil.randomString());

    newShoppingOrder.setPpPayerEmail(RandomTestUtil.randomString());

    newShoppingOrder.setSendOrderEmail(RandomTestUtil.randomBoolean());

    newShoppingOrder.setSendShippingEmail(RandomTestUtil.randomBoolean());

    _shoppingOrders.add(_persistence.update(newShoppingOrder));

    ShoppingOrder existingShoppingOrder =
        _persistence.findByPrimaryKey(newShoppingOrder.getPrimaryKey());

    Assert.assertEquals(existingShoppingOrder.getOrderId(), newShoppingOrder.getOrderId());
    Assert.assertEquals(existingShoppingOrder.getGroupId(), newShoppingOrder.getGroupId());
    Assert.assertEquals(existingShoppingOrder.getCompanyId(), newShoppingOrder.getCompanyId());
    Assert.assertEquals(existingShoppingOrder.getUserId(), newShoppingOrder.getUserId());
    Assert.assertEquals(existingShoppingOrder.getUserName(), newShoppingOrder.getUserName());
    Assert.assertEquals(
        Time.getShortTimestamp(existingShoppingOrder.getCreateDate()),
        Time.getShortTimestamp(newShoppingOrder.getCreateDate()));
    Assert.assertEquals(
        Time.getShortTimestamp(existingShoppingOrder.getModifiedDate()),
        Time.getShortTimestamp(newShoppingOrder.getModifiedDate()));
    Assert.assertEquals(existingShoppingOrder.getNumber(), newShoppingOrder.getNumber());
    AssertUtils.assertEquals(existingShoppingOrder.getTax(), newShoppingOrder.getTax());
    AssertUtils.assertEquals(existingShoppingOrder.getShipping(), newShoppingOrder.getShipping());
    Assert.assertEquals(existingShoppingOrder.getAltShipping(), newShoppingOrder.getAltShipping());
    Assert.assertEquals(
        existingShoppingOrder.getRequiresShipping(), newShoppingOrder.getRequiresShipping());
    Assert.assertEquals(existingShoppingOrder.getInsure(), newShoppingOrder.getInsure());
    AssertUtils.assertEquals(existingShoppingOrder.getInsurance(), newShoppingOrder.getInsurance());
    Assert.assertEquals(existingShoppingOrder.getCouponCodes(), newShoppingOrder.getCouponCodes());
    AssertUtils.assertEquals(
        existingShoppingOrder.getCouponDiscount(), newShoppingOrder.getCouponDiscount());
    Assert.assertEquals(
        existingShoppingOrder.getBillingFirstName(), newShoppingOrder.getBillingFirstName());
    Assert.assertEquals(
        existingShoppingOrder.getBillingLastName(), newShoppingOrder.getBillingLastName());
    Assert.assertEquals(
        existingShoppingOrder.getBillingEmailAddress(), newShoppingOrder.getBillingEmailAddress());
    Assert.assertEquals(
        existingShoppingOrder.getBillingCompany(), newShoppingOrder.getBillingCompany());
    Assert.assertEquals(
        existingShoppingOrder.getBillingStreet(), newShoppingOrder.getBillingStreet());
    Assert.assertEquals(existingShoppingOrder.getBillingCity(), newShoppingOrder.getBillingCity());
    Assert.assertEquals(
        existingShoppingOrder.getBillingState(), newShoppingOrder.getBillingState());
    Assert.assertEquals(existingShoppingOrder.getBillingZip(), newShoppingOrder.getBillingZip());
    Assert.assertEquals(
        existingShoppingOrder.getBillingCountry(), newShoppingOrder.getBillingCountry());
    Assert.assertEquals(
        existingShoppingOrder.getBillingPhone(), newShoppingOrder.getBillingPhone());
    Assert.assertEquals(
        existingShoppingOrder.getShipToBilling(), newShoppingOrder.getShipToBilling());
    Assert.assertEquals(
        existingShoppingOrder.getShippingFirstName(), newShoppingOrder.getShippingFirstName());
    Assert.assertEquals(
        existingShoppingOrder.getShippingLastName(), newShoppingOrder.getShippingLastName());
    Assert.assertEquals(
        existingShoppingOrder.getShippingEmailAddress(),
        newShoppingOrder.getShippingEmailAddress());
    Assert.assertEquals(
        existingShoppingOrder.getShippingCompany(), newShoppingOrder.getShippingCompany());
    Assert.assertEquals(
        existingShoppingOrder.getShippingStreet(), newShoppingOrder.getShippingStreet());
    Assert.assertEquals(
        existingShoppingOrder.getShippingCity(), newShoppingOrder.getShippingCity());
    Assert.assertEquals(
        existingShoppingOrder.getShippingState(), newShoppingOrder.getShippingState());
    Assert.assertEquals(existingShoppingOrder.getShippingZip(), newShoppingOrder.getShippingZip());
    Assert.assertEquals(
        existingShoppingOrder.getShippingCountry(), newShoppingOrder.getShippingCountry());
    Assert.assertEquals(
        existingShoppingOrder.getShippingPhone(), newShoppingOrder.getShippingPhone());
    Assert.assertEquals(existingShoppingOrder.getCcName(), newShoppingOrder.getCcName());
    Assert.assertEquals(existingShoppingOrder.getCcType(), newShoppingOrder.getCcType());
    Assert.assertEquals(existingShoppingOrder.getCcNumber(), newShoppingOrder.getCcNumber());
    Assert.assertEquals(existingShoppingOrder.getCcExpMonth(), newShoppingOrder.getCcExpMonth());
    Assert.assertEquals(existingShoppingOrder.getCcExpYear(), newShoppingOrder.getCcExpYear());
    Assert.assertEquals(existingShoppingOrder.getCcVerNumber(), newShoppingOrder.getCcVerNumber());
    Assert.assertEquals(existingShoppingOrder.getComments(), newShoppingOrder.getComments());
    Assert.assertEquals(existingShoppingOrder.getPpTxnId(), newShoppingOrder.getPpTxnId());
    Assert.assertEquals(
        existingShoppingOrder.getPpPaymentStatus(), newShoppingOrder.getPpPaymentStatus());
    AssertUtils.assertEquals(
        existingShoppingOrder.getPpPaymentGross(), newShoppingOrder.getPpPaymentGross());
    Assert.assertEquals(
        existingShoppingOrder.getPpReceiverEmail(), newShoppingOrder.getPpReceiverEmail());
    Assert.assertEquals(
        existingShoppingOrder.getPpPayerEmail(), newShoppingOrder.getPpPayerEmail());
    Assert.assertEquals(
        existingShoppingOrder.getSendOrderEmail(), newShoppingOrder.getSendOrderEmail());
    Assert.assertEquals(
        existingShoppingOrder.getSendShippingEmail(), newShoppingOrder.getSendShippingEmail());
  }