01: // Copyright (C) 2003,2004,2005 by Object Mentor, Inc. All rights reserved.
02: // Released under the terms of the GNU General Public License version 2 or later.
03: package fitnesse.components;
04:
05: import junit.swingui.TestRunner;
06: import fitnesse.testutil.AbstractRegex;
07:
08: public class CommandRunnerTest extends AbstractRegex {
09: public static void main(String[] args) {
10: TestRunner.main(new String[] { "CommandRunnerTest" });
11: }
12:
13: public void setUp() throws Exception {
14: }
15:
16: public void tearDown() throws Exception {
17: }
18:
19: public void XtestBasics() throws Exception {
20: // FIXME this is an integration test and needs to have "java" on the
21: // command line correctly before use
22: CommandRunner runner = new CommandRunner(
23: "java -cp ./classes fitnesse.testutil.Echo",
24: "echo this!");
25: runner.run();
26: assertHasRegexp("echo this!", runner.getOutput());
27: assertEquals("", runner.getError());
28: assertEquals(false, runner.hasExceptions());
29: assertEquals(0, runner.getExitCode());
30: }
31:
32: public void testClassNotFound() throws Exception {
33: CommandRunner runner = new CommandRunner("java BadClass", null);
34: runner.run();
35: assertHasRegexp("java.lang.NoClassDefFoundError", runner
36: .getError());
37: assertEquals("", runner.getOutput());
38: assertTrue(0 != runner.getExitCode());
39: }
40: }
|