use of com.opensymphony.xwork2.SimpleFooAction in project struts by apache.
the class StaticParametersInterceptorTest method testWithOneParameters.
public void testWithOneParameters() throws Exception {
MockActionInvocation mai = new MockActionInvocation();
MockActionProxy map = new MockActionProxy();
ActionConfig ac = new ActionConfig.Builder("", "", "").addParam("top.name", "Santa").build();
map.setConfig(ac);
mai.setProxy(map);
mai.setAction(new SimpleFooAction());
User user = new User();
ActionContext.getContext().getValueStack().push(user);
int before = ActionContext.getContext().getValueStack().size();
interceptor.intercept(mai);
assertEquals(before, ActionContext.getContext().getValueStack().size());
assertEquals("Santa", user.getName());
}
use of com.opensymphony.xwork2.SimpleFooAction in project struts by apache.
the class AliasInterceptorTest method testInvalidAliasExpression.
public void testInvalidAliasExpression() throws Exception {
Action action = new SimpleFooAction();
MockActionInvocation mai = new MockActionInvocation();
MockActionProxy map = new MockActionProxy();
ActionConfig cfg = new ActionConfig.Builder("", "", "").addParam("aliases", "invalid alias expression").build();
map.setConfig(cfg);
mai.setProxy(map);
mai.setAction(action);
mai.setInvocationContext(ActionContext.getContext());
AliasInterceptor ai = new AliasInterceptor();
ai.init();
ai.intercept(mai);
ai.destroy();
}
use of com.opensymphony.xwork2.SimpleFooAction in project struts by apache.
the class NumberConverterTest method testStringToNumberConversionUS.
public void testStringToNumberConversionUS() throws Exception {
// given
NumberConverter converter = new NumberConverter();
Map<String, Object> context = createContextWithLocale(new Locale("en", "US"));
SimpleFooAction foo = new SimpleFooAction();
// when
Object value = converter.convertValue(context, foo, null, "id", ",1234", Integer.class);
// then
assertEquals(1234, value);
}
Aggregations