use of com.opensymphony.xwork2.util.Foo in project struts by apache.
the class UIBeanTest method testGetThemeFromForm.
public void testGetThemeFromForm() {
ValueStack stack = ActionContext.getContext().getValueStack();
MockHttpServletRequest req = new MockHttpServletRequest();
MockHttpServletResponse res = new MockHttpServletResponse();
Form form = new Form(stack, req, res);
form.setTheme("foo");
TextField txtFld = new TextField(stack, req, res);
assertEquals("foo", txtFld.getTheme());
}
use of com.opensymphony.xwork2.util.Foo in project struts by apache.
the class UIBeanTest method testEscapeId.
public void testEscapeId() {
ValueStack stack = ActionContext.getContext().getValueStack();
MockHttpServletRequest req = new MockHttpServletRequest();
MockHttpServletResponse res = new MockHttpServletResponse();
Form form = new Form(stack, req, res);
form.getParameters().put("id", "formId");
TextField txtFld = new TextField(stack, req, res);
txtFld.setName("foo/bar");
txtFld.populateComponentHtmlId(form);
assertEquals("formId_foo_bar", txtFld.getParameters().get("id"));
}
use of com.opensymphony.xwork2.util.Foo in project struts by apache.
the class StrutsConversionErrorInterceptorTest method testFieldErrorAdded.
public void testFieldErrorAdded() throws Exception {
conversionErrors.put("foo", new ConversionData("bar", Integer.class));
ActionSupport action = new ActionSupport();
mockInvocation.expectAndReturn("getAction", action);
stack.push(action);
mockInvocation.matchAndReturn("getAction", action);
assertNull(action.getFieldErrors().get("foo"));
interceptor.doIntercept(invocation);
assertTrue(action.hasFieldErrors());
assertNotNull(action.getFieldErrors().get("foo"));
}
use of com.opensymphony.xwork2.util.Foo in project struts by apache.
the class StrutsConversionErrorInterceptorTest method testEmptyValuesDoNotSetFieldErrors.
public void testEmptyValuesDoNotSetFieldErrors() throws Exception {
conversionErrors.put("foo", new ConversionData("bar", Integer.class));
conversionErrors.put("bar", new ConversionData("", Integer.class));
conversionErrors.put("baz", new ConversionData(new String[] { "" }, Integer.class));
ActionSupport action = new ActionSupport();
mockInvocation.expectAndReturn("getAction", action);
stack.push(action);
mockInvocation.matchAndReturn("getAction", action);
assertNull(action.getFieldErrors().get("foo"));
assertNull(action.getFieldErrors().get("bar"));
assertNull(action.getFieldErrors().get("baz"));
interceptor.doIntercept(invocation);
assertTrue(action.hasFieldErrors());
assertNotNull(action.getFieldErrors().get("foo"));
assertNull(action.getFieldErrors().get("bar"));
assertNull(action.getFieldErrors().get("baz"));
}
use of com.opensymphony.xwork2.util.Foo in project struts by apache.
the class AnnotationValidationInterceptorTest method setUp.
public void setUp() throws Exception {
super.setUp();
test = new TestAction();
interceptor = new AnnotationValidationInterceptor();
container.inject(interceptor);
config = new ActionConfig.Builder("", "foo", "").build();
mockActionInvocation = new Mock(ActionInvocation.class);
mockActionProxy = new Mock(ActionProxy.class);
mockActionInvocation.matchAndReturn("getProxy", (ActionProxy) mockActionProxy.proxy());
mockActionInvocation.matchAndReturn("getAction", test);
mockActionInvocation.expect("invoke");
ActionContext.getContext().withActionInvocation((ActionInvocation) mockActionInvocation.proxy());
}
Aggregations