Search in sources :

Example 1 with LocaleImpl

use of org.broadleafcommerce.common.locale.domain.LocaleImpl in project BroadleafCommerce by BroadleafCommerce.

the class MvelHelperTest method testRuleThatEvaluatesToTrue.

/**
 * Test rule that evaluates to true
 */
public void testRuleThatEvaluatesToTrue() {
    // Locale used as an illustrative domain class only.  Any object could have been used.
    Locale testLocale = new LocaleImpl();
    testLocale.setLocaleCode("US");
    Map parameters = new HashMap();
    parameters.put("locale", testLocale);
    boolean result = MvelHelper.evaluateRule("locale.localeCode == 'US'", parameters);
    assertTrue(result);
}
Also used : Locale(org.broadleafcommerce.common.locale.domain.Locale) LocaleImpl(org.broadleafcommerce.common.locale.domain.LocaleImpl) HashMap(java.util.HashMap) HashMap(java.util.HashMap) Map(java.util.Map)

Example 2 with LocaleImpl

use of org.broadleafcommerce.common.locale.domain.LocaleImpl in project BroadleafCommerce by BroadleafCommerce.

the class MvelHelperTest method testRuleThatEvaluatesToFalse.

/**
 * Test rule that evaluates to true
 */
public void testRuleThatEvaluatesToFalse() {
    // Locale used as an illustrative domain class only.  Any object could have been used.
    Locale testLocale = new LocaleImpl();
    testLocale.setLocaleCode("GB");
    Map parameters = new HashMap();
    parameters.put("locale", testLocale);
    boolean result = MvelHelper.evaluateRule("locale.localeCode == 'US'", parameters);
    assertFalse(result);
}
Also used : Locale(org.broadleafcommerce.common.locale.domain.Locale) LocaleImpl(org.broadleafcommerce.common.locale.domain.LocaleImpl) HashMap(java.util.HashMap) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

HashMap (java.util.HashMap)2 Map (java.util.Map)2 Locale (org.broadleafcommerce.common.locale.domain.Locale)2 LocaleImpl (org.broadleafcommerce.common.locale.domain.LocaleImpl)2