@Test public void testBillingFreqContainer() { final CurrencyModel currencyModel = mock(CurrencyModel.class); final PriceData priceData = mock(PriceData.class); final DeliveryModeModel deliveryMode = mock(DeliveryModeModel.class); given(cartModel.getDeliveryMode()).willReturn(deliveryMode); given(cartModel.getDeliveryCost()).willReturn(Double.valueOf(3.4)); given(cartModel.getCurrency()).willReturn(currencyModel); given(currencyModel.getIsocode()).willReturn("isoCode"); given(priceDataFactory.create(PriceDataType.BUY, BigDecimal.valueOf(3.4), currencyModel)) .willReturn(priceData); given(cartModel.getBillingTime()).willReturn(billingTimeModel); given(cartModel.getBillingTime().getCode()).willReturn("paynow"); subsOrderPopulator.addTotals(cartModel, cartData); Assert.assertEquals(priceData, cartData.getDeliveryCost()); }
@Test public void shouldCalculateTaxes() { final AddressModel address = mock(AddressModel.class); final DeliveryModeModel deliveryMode = mock(DeliveryModeModel.class); final CartModel cart = mock(CartModel.class); final BaseStoreModel baseStore = mock(BaseStoreModel.class); given(baseStore.getExternalTaxEnabled()).willReturn(Boolean.TRUE); given(cart.getStore()).willReturn(baseStore); given(cart.getNet()).willReturn(Boolean.TRUE); given(cart.getDeliveryAddress()).willReturn(address); given(cart.getDeliveryMode()).willReturn(deliveryMode); given(defaultOndemandDeliveryAddressStrategy.getDeliveryAddressForOrder(cart)) .willReturn(address); final boolean calculateTaxes = defaultOmsDetermineExternalTaxStrategy.shouldCalculateExternalTaxes(cart); Assert.assertEquals(calculateTaxes, true); }