@Test public void freeShippingPromoTest() { Assert.assertEquals(0, shoppingCart.getCartItemTotal(), 0); promoService.applyShippingPromotions(shoppingCart); Assert.assertEquals(0, shoppingCart.getShippingTotal(), 0); shoppingCart.setCartItemTotal(74.99); shoppingCart.setShippingTotal(4.99); promoService.applyShippingPromotions(shoppingCart); Assert.assertEquals(4.99, shoppingCart.getShippingTotal(), 0); shoppingCart.setCartItemTotal(75); shoppingCart.setShippingTotal(4.99); promoService.applyShippingPromotions(shoppingCart); Assert.assertEquals(0, shoppingCart.getShippingTotal(), 0); }
public void applyShippingPromotions(ShoppingCart shoppingCart) { if ( shoppingCart != null ) { if ( shoppingCart.getCartItemTotal() >= 75) { shoppingCart.setShippingPromoSavings(shoppingCart.getShippingTotal() * -1); shoppingCart.setShippingTotal(0); } } }
PromoService implements Serializable { public void applyShippingPromotions(ShoppingCart shoppingCart) { if ( shoppingCart != null ) { if ( shoppingCart.getCartItemTotal() >= 75) { shoppingCart.setShippingPromoSavings(shoppingCart.getShippingTotal() * -1); shoppingCart.setShippingTotal(0); } } } }
PromoService implements Serializable { public void applyShippingPromotions(ShoppingCart shoppingCart) { if ( shoppingCart != null ) { if ( shoppingCart.getCartItemTotal() >= 75) { shoppingCart.setShippingPromoSavings(shoppingCart.getShippingTotal() * -1); shoppingCart.setShippingTotal(0); } } } PromoService(); }
PromoService implements Serializable { public void applyShippingPromotions(ShoppingCart shoppingCart) { if ( shoppingCart != null ) { if ( shoppingCart.getCartItemTotal() >= 75) { shoppingCart.setShippingPromoSavings(shoppingCart.getShippingTotal() * -1); shoppingCart.setShippingTotal(0); } } } PromoService(); void applyCartItemPromotions(ShoppingCart shoppingCart); void applyShippingPromotions(ShoppingCart shoppingCart); Set<Promotion> getPromotions(); void setPromotions(Set<Promotion> promotionSet); @Override String toString(); }
PromoService implements Serializable { public void applyShippingPromotions(ShoppingCart shoppingCart) { if ( shoppingCart != null ) { if ( shoppingCart.getCartItemTotal() >= 75) { shoppingCart.setShippingPromoSavings(shoppingCart.getShippingTotal() * -1); shoppingCart.setShippingTotal(0); } } } PromoService(); void applyCartItemPromotions(ShoppingCart shoppingCart); void applyShippingPromotions(ShoppingCart shoppingCart); Set<Promotion> getPromotions(); void setPromotions(Set<Promotion> promotionSet); @Override String toString();  }