@Test public void calculateTax_whenItemNotPresent_returnsZero() { AndroidPayConfiguration.getInstance().setCurrencyCode("KRW"); CartManager manager = new CartManager("KRW"); assertEquals(Long.valueOf(0L), manager.calculateTax()); }
public Long calculateTax() { if (mLineItemTax == null) { return 0L; } if (!mCurrency.getCurrencyCode().equals(mLineItemTax.getCurrencyCode())) { return null; } return PaymentUtils.getPriceLong(mLineItemTax.getTotalPrice(), mCurrency); }
CartManager { public Long calculateTax() { if (mLineItemTax == null) { return 0L; } if (!mCurrency.getCurrencyCode().equals(mLineItemTax.getCurrencyCode())) { return null; } return PaymentUtils.getPriceLong(mLineItemTax.getTotalPrice(), mCurrency); } }
CartManager { public Long calculateTax() { if (mLineItemTax == null) { return 0L; } if (!mCurrency.getCurrencyCode().equals(mLineItemTax.getCurrencyCode())) { return null; } return PaymentUtils.getPriceLong(mLineItemTax.getTotalPrice(), mCurrency); } CartManager();  CartManager(String currencyCode);  CartManager(@NonNull Cart oldCart);  CartManager(@NonNull Cart oldCart, boolean shouldKeepShipping, boolean shouldKeepTax); }
CartManager { public Long calculateTax() { if (mLineItemTax == null) { return 0L; } if (!mCurrency.getCurrencyCode().equals(mLineItemTax.getCurrencyCode())) { return null; } return PaymentUtils.getPriceLong(mLineItemTax.getTotalPrice(), mCurrency); } CartManager();  CartManager(String currencyCode);  CartManager(@NonNull Cart oldCart);  CartManager(@NonNull Cart oldCart, boolean shouldKeepShipping, boolean shouldKeepTax); @Nullable String addLineItem(@NonNull @Size(min = 1) String description, long totalPrice); @Nullable String addLineItem(@NonNull @Size(min = 1) String description,
                              double quantity,
                              long unitPrice); @Nullable String addShippingLineItem(@NonNull @Size(min = 1) String description, long totalPrice); @Nullable String addShippingLineItem(@NonNull @Size(min = 1) String description,
                                      double quantity,
                                      long unitPrice); @Nullable Long calculateRegularItemTotal(); @Nullable Long calculateShippingItemTotal(); Long calculateTax(); void setTaxLineItem(@NonNull @Size(min = 1) String description, long totalPrice); void setTotalPrice(@Nullable Long totalPrice); void setTaxLineItem(@Nullable LineItem item); @Nullable LineItem removeLineItem(@NonNull @Size(min = 1) String itemId); @Nullable String addLineItem(@NonNull LineItem item); @NonNull Cart buildCart(); @Nullable Long getTotalPrice(); @NonNull Currency getCurrency(); @NonNull String getCurrencyCode(); @NonNull LinkedHashMap<String, LineItem> getLineItemsRegular(); @NonNull LinkedHashMap<String, LineItem> getLineItemsShipping(); @Nullable LineItem getLineItemTax(); }
CartManager { public Long calculateTax() { if (mLineItemTax == null) { return 0L; } if (!mCurrency.getCurrencyCode().equals(mLineItemTax.getCurrencyCode())) { return null; } return PaymentUtils.getPriceLong(mLineItemTax.getTotalPrice(), mCurrency); } CartManager();  CartManager(String currencyCode);  CartManager(@NonNull Cart oldCart);  CartManager(@NonNull Cart oldCart, boolean shouldKeepShipping, boolean shouldKeepTax); @Nullable String addLineItem(@NonNull @Size(min = 1) String description, long totalPrice); @Nullable String addLineItem(@NonNull @Size(min = 1) String description,
                              double quantity,
                              long unitPrice); @Nullable String addShippingLineItem(@NonNull @Size(min = 1) String description, long totalPrice); @Nullable String addShippingLineItem(@NonNull @Size(min = 1) String description,
                                      double quantity,
                                      long unitPrice); @Nullable Long calculateRegularItemTotal(); @Nullable Long calculateShippingItemTotal(); Long calculateTax(); void setTaxLineItem(@NonNull @Size(min = 1) String description, long totalPrice); void setTotalPrice(@Nullable Long totalPrice); void setTaxLineItem(@Nullable LineItem item); @Nullable LineItem removeLineItem(@NonNull @Size(min = 1) String itemId); @Nullable String addLineItem(@NonNull LineItem item); @NonNull Cart buildCart(); @Nullable Long getTotalPrice(); @NonNull Currency getCurrency(); @NonNull String getCurrencyCode(); @NonNull LinkedHashMap<String, LineItem> getLineItemsRegular(); @NonNull LinkedHashMap<String, LineItem> getLineItemsShipping(); @Nullable LineItem getLineItemTax();  }