Allow tests to System.exit() by default

Otherwise the ApplicationContext stays alive and if it's a
server app the JVM does not exit at the end of "spring test".
User can override with "spring test foo.groovy --nohup"
(which we have to do in our unit tests).
This commit is contained in:
Dave Syer
2014-05-28 15:47:55 +01:00
parent 7fd26a556d
commit 8436627598
4 changed files with 16 additions and 1 deletions

View File

@@ -75,7 +75,10 @@ public class CliTester implements TestRule {
}
public String test(String... args) throws Exception {
Future<TestCommand> future = submitCommand(new TestCommand(), args);
String[] argsToUse = new String[args.length + 1];
System.arraycopy(args, 0, argsToUse, 1, args.length);
argsToUse[0] = "--nohup";
Future<TestCommand> future = submitCommand(new TestCommand(), argsToUse);
this.commands.add(future.get(this.timeout, TimeUnit.MILLISECONDS));
return getOutput();
}