Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save maurizio-cucchiara/2357648 to your computer and use it in GitHub Desktop.

Select an option

Save maurizio-cucchiara/2357648 to your computer and use it in GitHub Desktop.
Struts+Spring+Junit test sample
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"/org/apache/struts/spring/app-context.xml"})
public class SampleActionIntegrationTest extends StrutsSpringJUnit4TestCase<SampleAction> {
@Test
public void executeTest() throws Exception {
String result = executeAction("/sample");
SampleAction action = getAction();
assertFalse(containsErrors());
}
/**
* Override this method to return a comma separated list of paths to a configuration
* file.
* <p>The default implementation simply returns <code>null</code>.
*
* @return a comma separated list of config locations
*/
@Override
protected String getConfigPath() {
return "path-to-my-struts-config-file-01.xml,path-to-my-struts-config-file-02.xml,";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment