public MoneyFacetedSearchSearchModel<ProductProjection> ofMoneySet(final String attributeName) { return ofMoney(attributeName); }
public MoneyFacetedSearchSearchModel<ProductProjection> ofMoneySet(final String attributeName) { return ofMoney(attributeName); }
@Test public void facetedSearchOnMoneyAmountRangedAttributes() throws Exception { testResultWithRange(PRODUCT_MODEL.allVariants().attribute().ofMoney(ATTR_NAME_MONEY).centAmount().isBetween(atMost(toCents(MONEY_500_EUR).toString())), ids -> assertThat(ids).containsOnly(product1.getId()), rangeStats -> { assertThat(rangeStats.getLowerEndpoint()).isEqualTo(null); assertThat(rangeStats.getUpperEndpoint()).isEqualTo(null); assertThat(rangeStats.getCount()).isEqualTo(2L); assertThat(rangeStats.getMin()).isEqualTo("50000.0"); assertThat(rangeStats.getMax()).isEqualTo("100000.0"); }); }
@Test public void facetedSearchOnMoneyAmountAttributes() throws Exception { testResultWithTerms(PRODUCT_MODEL.allVariants().attribute().ofMoney(ATTR_NAME_MONEY).centAmount().is(toCents(MONEY_500_EUR).toString()), ids -> assertThat(ids).containsOnly(product1.getId()), termStats -> assertThat(termStats).containsOnly( TermStats.of("50000", 1L), TermStats.of("100000", 1L))); }
@Test public void facetedSearchOnMoneyCurrencyAttributes() throws Exception { testResultWithTerms(PRODUCT_MODEL.allVariants().attribute().ofMoney(ATTR_NAME_MONEY).currency().is(MONEY_500_EUR.getCurrency().getCurrencyCode()), ids -> assertThat(ids).containsOnly(product1.getId()), termStats -> assertThat(termStats).containsOnly( TermStats.of("EUR", 1L), TermStats.of("USD", 1L))); }