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¤tFlowKey=1234¤t=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¤tFlowKey=1234¤t=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¤tFlowKey=1234¤t=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¤tFlowKey=1234¤t=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));
}
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\"> <img src=pages/framework/images/status_yellow.gif width=\"8\" height=\"9\"></span><span class=\"fontnormal\"> PartialApplication</span>", Text.getImage(customerSearchDto, "1", locale));
customerSearchDto.setCustomerType(Short.valueOf("4"));
Assert.assertEquals("<span class=\"fontnormal\"> <img src=pages/framework/images/status_yellow.gif width=\"8\" height=\"9\"></span><span class=\"fontnormal\"> Pending Approval</span>", Text.getImage(customerSearchDto, "2", locale));
customerSearchDto.setCustomerType(Short.valueOf("6"));
Assert.assertEquals("<span class=\"fontnormal\"> <img src=pages/framework/images/status_yellow.gif width=\"8\" height=\"9\"></span><span class=\"fontnormal\"> Partial Application</span>", Text.getImage(customerSearchDto, "13", 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"));
}
}
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));
}
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);
}
Aggregations