@Test public void isAvailableReturnsTrueWhenCountryListIsNullInConfiguration() { when(apmConfigurationMock.getCountries()).thenReturn(null); final boolean result = testObj.isAvailable(apmConfigurationMock, cartModelMock); assertTrue(result); }
@Override public boolean isAvailable(final WorldpayAPMConfigurationModel apmConfiguration, final CartModel cartModel) { if (CollectionUtils.isEmpty(apmConfiguration.getCountries())) { return true; } final String shippingCountryIsoCode = worldpayDeliveryAddressStrategy.getDeliveryAddress(cartModel).getCountry().getIsocode(); return apmConfiguration.getCountries().stream() .map(C2LItemModel::getIsocode) .anyMatch(shippingCountryIsoCode::equals); }
APMAvailabilityCountryStrategy implements APMAvailabilityStrategy { @Override public boolean isAvailable(final WorldpayAPMConfigurationModel apmConfiguration, final CartModel cartModel) { if (CollectionUtils.isEmpty(apmConfiguration.getCountries())) { return true; } final String shippingCountryIsoCode = worldpayDeliveryAddressStrategy.getDeliveryAddress(cartModel).getCountry().getIsocode(); return apmConfiguration.getCountries().stream() .map(C2LItemModel::getIsocode) .anyMatch(shippingCountryIsoCode::equals); } }
APMAvailabilityCountryStrategy implements APMAvailabilityStrategy { @Override public boolean isAvailable(final WorldpayAPMConfigurationModel apmConfiguration, final CartModel cartModel) { if (CollectionUtils.isEmpty(apmConfiguration.getCountries())) { return true; } final String shippingCountryIsoCode = worldpayDeliveryAddressStrategy.getDeliveryAddress(cartModel).getCountry().getIsocode(); return apmConfiguration.getCountries().stream() .map(C2LItemModel::getIsocode) .anyMatch(shippingCountryIsoCode::equals); }  }
APMAvailabilityCountryStrategy implements APMAvailabilityStrategy { @Override public boolean isAvailable(final WorldpayAPMConfigurationModel apmConfiguration, final CartModel cartModel) { if (CollectionUtils.isEmpty(apmConfiguration.getCountries())) { return true; } final String shippingCountryIsoCode = worldpayDeliveryAddressStrategy.getDeliveryAddress(cartModel).getCountry().getIsocode(); return apmConfiguration.getCountries().stream() .map(C2LItemModel::getIsocode) .anyMatch(shippingCountryIsoCode::equals); }  @Override boolean isAvailable(final WorldpayAPMConfigurationModel apmConfiguration, final CartModel cartModel); @Required void setWorldpayDeliveryAddressStrategy(final WorldpayDeliveryAddressStrategy worldpayDeliveryAddressStrategy); }
APMAvailabilityCountryStrategy implements APMAvailabilityStrategy { @Override public boolean isAvailable(final WorldpayAPMConfigurationModel apmConfiguration, final CartModel cartModel) { if (CollectionUtils.isEmpty(apmConfiguration.getCountries())) { return true; } final String shippingCountryIsoCode = worldpayDeliveryAddressStrategy.getDeliveryAddress(cartModel).getCountry().getIsocode(); return apmConfiguration.getCountries().stream() .map(C2LItemModel::getIsocode) .anyMatch(shippingCountryIsoCode::equals); }  @Override boolean isAvailable(final WorldpayAPMConfigurationModel apmConfiguration, final CartModel cartModel); @Required void setWorldpayDeliveryAddressStrategy(final WorldpayDeliveryAddressStrategy worldpayDeliveryAddressStrategy);  }