Created
April 11, 2012 07:41
-
-
Save maurizio-cucchiara/2357648 to your computer and use it in GitHub Desktop.
Struts+Spring+Junit test sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @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