Search in sources :

Example 56 with Locale

use of java.util.Locale in project head by mifos.

the class TableTagIntegrationTest method testPageScroll.

@Test
public void testPageScroll() {
    Locale locale = Locale.ENGLISH;
    Assert.assertEquals("<a href='hRef?method=load&currentFlowKey=1234&current=1'>text</a>", PageScroll.getAnchor("hRef", "text", "load", "1234", 1, null));
    Assert.assertEquals("<tr><td width=\"20%\" class=\"fontnormalboldgray\">Previous</td><td width=\"40%\" align=\"center\" class=\"fontnormalbold\">Results 1-10 of 100 </td><td width=\"20%\" class=\"fontnormalbold\"><a href='loaad?method=searchNext&currentFlowKey=1234&current=2'>Next</a></td></tr>", PageScroll.getPages(1, 10, 100, "loaad", "1234", locale, null));
    Assert.assertEquals("<tr><td width=\"20%\" class=\"fontnormalbold\"><a href='loaad?method=searchPrev&currentFlowKey=1234&current=4'>Previous</a></td><td width=\"40%\" align=\"center\" class=\"fontnormalbold\">Results 41-50 of 100 </td><td width=\"20%\" class=\"fontnormalbold\"><a href='loaad?method=searchNext&currentFlowKey=1234&current=6'>Next</a></td></tr>", PageScroll.getPages(5, 10, 100, "loaad", "1234", locale, null));
    Assert.assertEquals("<tr><td width=\"20%\" class=\"fontnormalboldgray\">Previous</td><td width=\"40%\" align=\"center\" class=\"fontnormalbold\">Results 1-3 of 3 </td><td width=\"20%\" align=\"right\" class=\"fontnormalboldgray\">Next</td></tr>", PageScroll.getPages(1, 10, 3, "loaad", "1234", locale, null));
}
Also used : Locale(java.util.Locale) Test(org.junit.Test)

Example 57 with Locale

use of java.util.Locale in project head by mifos.

the class TableTagIntegrationTest method testGetImage.

@Test
public void testGetImage() throws Exception {
    Locale locale = Locale.ENGLISH;
    CustomerSearchDto customerSearchDto = new CustomerSearchDto();
    Assert.assertEquals("<span class=\"fontnormal\">&nbsp;<img src=pages/framework/images/status_yellow.gif width=\"8\" height=\"9\"></span><span class=\"fontnormal\">&nbsp;PartialApplication</span>", Text.getImage(customerSearchDto, "1", locale));
    customerSearchDto.setCustomerType(Short.valueOf("4"));
    Assert.assertEquals("<span class=\"fontnormal\">&nbsp;<img src=pages/framework/images/status_yellow.gif width=\"8\" height=\"9\"></span><span class=\"fontnormal\">&nbsp;Pending Approval</span>", Text.getImage(customerSearchDto, "2", locale));
    customerSearchDto.setCustomerType(Short.valueOf("6"));
    Assert.assertEquals("<span class=\"fontnormal\">&nbsp;<img src=pages/framework/images/status_yellow.gif width=\"8\" height=\"9\"></span><span class=\"fontnormal\">&nbsp;Partial Application</span>", Text.getImage(customerSearchDto, "13", locale));
}
Also used : Locale(java.util.Locale) CustomerSearchDto(org.mifos.customers.business.CustomerSearchDto) Test(org.junit.Test)

Example 58 with Locale

use of java.util.Locale in project head by mifos.

the class BaseActionFormTest method testGetDoubleValue.

@Test
public void testGetDoubleValue() throws Exception {
    Locale locale = Localization.getInstance().getConfiguredLocale();
    double dValue = 2.34;
    if (locale.getCountry().equalsIgnoreCase("GB") && locale.getLanguage().equalsIgnoreCase("EN")) {
        Assert.assertEquals(dValue, baseActionForm.getDoubleValue("2.34"));
    }
}
Also used : Locale(java.util.Locale) Test(org.junit.Test)

Example 59 with Locale

use of java.util.Locale in project head by mifos.

the class BaseActionFormTest method xtestGetStringValue_is_IS.

/**
     * Currently broken -- incomplete support for multiple locales for numeric
     * input.
     */
@Ignore
@Test
public void xtestGetStringValue_is_IS() throws Exception {
    String strValue = "0.25";
    Locale locale = Localization.getInstance().getConfiguredLocale();
    LocalizationConverter converter = new LocalizationConverter();
    strValue = "0,25";
    Assert.assertEquals(strValue, baseActionForm.getStringValue(0.25));
}
Also used : Locale(java.util.Locale) LocalizationConverter(org.mifos.framework.util.LocalizationConverter) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 60 with Locale

use of java.util.Locale in project head by mifos.

the class LocalizationConverterTest method testGetDoubleStringForMoney.

@Test
public void testGetDoubleStringForMoney() {
    String doubleValueString = "2.5";
    Double dValue = 2.5000000000;
    Locale locale = Localization.getInstance().getConfiguredLocale();
    String dString = converter.getDoubleStringForMoney(dValue);
    if (locale.getCountry().equalsIgnoreCase("GB") && locale.getLanguage().equalsIgnoreCase("EN")) {
        Assert.assertEquals(doubleValueString, dString);
    }
    converter.setCurrentLocale(new Locale("IS", "is"));
    doubleValueString = "2,5";
    dString = converter.getDoubleStringForMoney(dValue);
    Assert.assertEquals(doubleValueString, dString);
    converter.setCurrentLocale(locale);
}
Also used : Locale(java.util.Locale) Test(org.junit.Test)

Aggregations

Locale (java.util.Locale)5854 Test (org.junit.Test)902 HashMap (java.util.HashMap)548 GenericValue (org.apache.ofbiz.entity.GenericValue)504 ArrayList (java.util.ArrayList)486 Delegator (org.apache.ofbiz.entity.Delegator)484 GenericEntityException (org.apache.ofbiz.entity.GenericEntityException)398 IOException (java.io.IOException)313 LocalDispatcher (org.apache.ofbiz.service.LocalDispatcher)296 Date (java.util.Date)273 GenericServiceException (org.apache.ofbiz.service.GenericServiceException)271 Map (java.util.Map)244 BigDecimal (java.math.BigDecimal)214 SimpleDateFormat (java.text.SimpleDateFormat)198 ResourceBundle (java.util.ResourceBundle)197 File (java.io.File)166 LinkedList (java.util.LinkedList)158 ULocale (android.icu.util.ULocale)156 List (java.util.List)147 Test (org.junit.jupiter.api.Test)132