use of com.opensymphony.xwork2.mock.MockResult in project struts by apache.
the class ChainResultTest method testNamespaceChain.
public void testNamespaceChain() throws Exception {
ActionProxy proxy = actionProxyFactory.createActionProxy(null, "chain_with_namespace", null, null);
((SimpleAction) proxy.getAction()).setBlah("%{foo}");
proxy.execute();
assertTrue(proxy.getInvocation().getResult() instanceof MockResult);
MockResult result = (MockResult) proxy.getInvocation().getResult();
assertEquals("%{foo}", result.getInvocation().getProxy().getNamespace());
}
use of com.opensymphony.xwork2.mock.MockResult in project struts by apache.
the class DefaultActionInvocationTester method testActionChainResult.
public void testActionChainResult() throws Exception {
ActionProxy actionProxy = actionProxyFactory.createActionProxy("", "Foo", null, new HashMap<String, Object>());
DefaultActionInvocation defaultActionInvocation = (DefaultActionInvocation) actionProxy.getInvocation();
defaultActionInvocation.init(actionProxy);
SimpleAction action = (SimpleAction) defaultActionInvocation.getAction();
action.setFoo(1);
action.setBar(2);
defaultActionInvocation.invoke();
// then
assertTrue(defaultActionInvocation.result instanceof ActionChainResult);
Result result = defaultActionInvocation.getResult();
assertTrue(result instanceof MockResult);
}
use of com.opensymphony.xwork2.mock.MockResult in project struts by apache.
the class XmlConfigurationProviderResultsTest method testResultTypes.
public void testResultTypes() throws ConfigurationException {
final String filename = "com/opensymphony/xwork2/config/providers/xwork-test-results.xml";
ConfigurationProvider provider = buildConfigurationProvider(filename);
// setup expectations
ResultTypeConfig chainResult = new ResultTypeConfig.Builder("chain", ActionChainResult.class.getName()).build();
ResultTypeConfig mockResult = new ResultTypeConfig.Builder("mock", MockResult.class.getName()).build();
// execute the configuration
provider.init(configuration);
provider.loadPackages();
PackageConfig pkg = configuration.getPackageConfig("default");
Map resultTypes = pkg.getResultTypeConfigs();
// assertions
assertEquals(2, resultTypes.size());
assertEquals("chain", pkg.getDefaultResultType());
assertEquals(chainResult, resultTypes.get("chain"));
assertEquals(mockResult, resultTypes.get("mock"));
}
Aggregations