public MoneyFilterSearchModel<ProductProjection> ofMoneySet(final String attributeName) { return ofMoney(attributeName); }
public MoneyFilterSearchModel<ProductProjection> ofMoneySet(final String attributeName) { return ofMoney(attributeName); }
public MoneyFilterSearchModel<ProductProjection> ofMoneySet(final String attributeName) { return ofMoney(attributeName); }
@Test public void canAccessCurrencyCustomAttributes() throws Exception { final String attrName = "originalPrice"; assertThat(FACET_ATTR.ofMoney(attrName).currency().allTerms().expression()).isEqualTo("variants.attributes.originalPrice.currencyCode"); assertThat(FILTER_ATTR.ofMoney(attrName).currency().is(currency("EUR"))).extracting(expression()).containsExactly("variants.attributes.originalPrice.currencyCode:\"EUR\""); assertThat(SORT_ATTR.ofMoney(attrName).currency().descWithMinValue().expression()).isEqualTo("variants.attributes.originalPrice.currencyCode desc.min"); }
@Test public void canAccessMoneyCentAmountCustomAttributes() throws Exception { final String attrName = "originalPrice"; assertThat(FACET_ATTR.ofMoney(attrName).centAmount().allTerms().expression()).isEqualTo("variants.attributes.originalPrice.centAmount"); assertThat(FILTER_ATTR.ofMoney(attrName).centAmount().is(1000L)).extracting(expression()).containsExactly("variants.attributes.originalPrice.centAmount:1000"); assertThat(SORT_ATTR.ofMoney(attrName).centAmount().ascWithMaxValue().expression()).isEqualTo("variants.attributes.originalPrice.centAmount asc.max"); }
@Test public void onMoneyAmountAttributes() throws Exception { testProductIds(PRODUCT_MODEL.allVariants().attribute().ofMoney(ATTR_NAME_MONEY).centAmount().is(toCents(MONEY_500_EUR)), ids -> assertThat(ids).containsOnly(product1.getId())); }
@Test public void onMoneyAmountRangedAttributes() throws Exception { testProductIds(PRODUCT_MODEL.allVariants().attribute().ofMoney(ATTR_NAME_MONEY).centAmount().isLessThanOrEqualTo(toCents(MONEY_500_EUR)), ids -> assertThat(ids).containsOnly(product1.getId())); }
@Test public void onMoneyCurrencyAttributes() throws Exception { testProductIds(PRODUCT_MODEL.allVariants().attribute().ofMoney(ATTR_NAME_MONEY).currency().is(MONEY_500_EUR.getCurrency()), ids -> assertThat(ids).containsOnly(product1.getId())); }