*/
public class AjcTestCase extends TestCase {
+ private RunResult lastRunResult;
+
/**
* The Ajc (compiler) instance used for thet test. Created afresh
* during the test setup.
ajc.setShouldEmptySandbox(empty);
}
+ public RunResult getLastRunResult() {
+ return lastRunResult;
+ }
+
/**
* Run the given class (main method), and return the result in a RunResult. The program runs with
* a classpath containing the sandbox directory, runtime, testing-client, bridge, and
* the sandbox.
*/
public RunResult run(String className, String[] args, String classpath) {
- RunResult result = null;
+ lastRunResult = null;
StringBuffer cp = new StringBuffer();
if (classpath != null) {
cp.append(classpath);
System.setOut(new PrintStream(baosOut));
System.setErr(new PrintStream(baosErr));
mainMethod.invoke(null,new Object[] {args});
- result = new RunResult(command.toString(),new String(baosOut.toByteArray()),new String(baosErr.toByteArray()));
+ lastRunResult = new RunResult(command.toString(),new String(baosOut.toByteArray()),new String(baosErr.toByteArray()));
} catch(ClassNotFoundException cnf) {
fail("Can't find class: " + className);
} catch(NoSuchMethodException nsm) {
System.setOut(systemOut);
System.setErr(systemErr);
}
- return result;
+ return lastRunResult;
}
private List copyAll(List in) {