use of com.opensymphony.xwork2.StubTextProvider in project struts by apache.
the class XWorkBasicConverterTest method testDateWithLocalePoland.
public void testDateWithLocalePoland() {
Map<String, String> map = new HashMap<>();
ValueStack stack = new StubValueStack();
stack.push(new StubTextProvider(map));
Locale locale = new Locale("pl", "PL");
ActionContext context = ActionContext.of(new HashMap<>()).withLocale(locale).withValueStack(stack);
String reference = "2009-01-09";
Object convertedObject = basicConverter.convertValue(context.getContextMap(), null, null, null, reference, Date.class);
assertNotNull(convertedObject);
compareDates(locale, convertedObject);
}
use of com.opensymphony.xwork2.StubTextProvider in project struts by apache.
the class XWorkBasicConverterTest method testDateWithLocaleUK.
public void testDateWithLocaleUK() {
Map<String, String> map = new HashMap<>();
ValueStack stack = new StubValueStack();
stack.push(new StubTextProvider(map));
Locale locale = new Locale("en", "US");
ActionContext context = ActionContext.of(new HashMap<>()).withLocale(locale).withValueStack(stack);
String reference = "01/09/2009";
Object convertedObject = basicConverter.convertValue(context.getContextMap(), null, null, null, reference, Date.class);
assertNotNull(convertedObject);
compareDates(locale, convertedObject);
}
Aggregations