My test method is expected to throw an exception, so I'm using @ExpectedExceptions({ IllegalStateException.class }).
I'm also trying to use a timeout (@Test(timeOut = 1000)), so that if the method doesn't complete (in this case, by throwing an exception), the test method will be failed.
However, when I do this, and the method throws the expected exception, I get a long strack trace (attached below) and it's marked as a failure.
Note that, if I remove the timeout, the method passes.
Should I be expecting to be able to use @ExpectedExceptions and the timeout in this way together?
Thanks,
Calum
com.beust.testng.internal.thread.ThreadExecutionException: java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.IllegalStateException: This message connection has been closed.
at com.beust.testng.internal.thread.FutureResultAdapter.get(FutureResultAdapter.java:28)
at com.beust.testng.internal.Invoker.invokeMethod(Invoker.java:298)
at com.beust.testng.internal.Invoker.invokeTestMethod(Invoker.java:200)
at com.beust.testng.internal.Invoker.invokeTestMethods(Invoker.java:373)
at com.beust.testng.internal.TestMethodWorker.run(TestMethodWorker.java:45)
at com.beust.testng.TestRunner.privateRun(TestRunner.java:542)
at com.beust.testng.TestRunner.run(TestRunner.java:439)
at com.beust.testng.SuiteRunner.privateRun(SuiteRunner.java:149)
at com.beust.testng.SuiteRunner.run(SuiteRunner.java:87)
at com.beust.testng.TestNG.run(TestNG.java:182)
at com.beust.testng.TestNG.main(TestNG.java:220)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:86)
Caused by: java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.IllegalStateException: This message connection has been closed.
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:205)
at java.util.concurrent.FutureTask.get(FutureTask.java:80)
at com.beust.testng.internal.thread.FutureResultAdapter.get(FutureResultAdapter.java:26)
... 15 more
Caused by: java.lang.RuntimeException: java.lang.IllegalStateException: This message connection has been closed.
at com.beust.testng.internal.InvokeMethodRunnable.run(InvokeMethodRunnable.java:37)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
at java.util.concurrent.FutureTask.run(FutureTask.java:123)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.IllegalStateException: This message connection has been closed.
at com.aspectssoftware.util.Preconditions.checkState(Preconditions.java:200)
at com.aspectssoftware.smartstation3.messaging.impl.BasicMessageConnection.checkNotClosed(BasicMessageConnection.java:107)
at com.aspectssoftware.smartstation3.messaging.impl.BasicMessageConnection.sendMessage(BasicMessageConnection.java:155)
at com.aspectssoftware.smartstation3.messaging.impl.TestBasicMessageConnectionClosing.testClosingThreads(TestBasicMessageConnectionClosing.java:68)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.beust.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:293)
at com.beust.testng.internal.InvokeMethodRunnable.run(InvokeMethodRunnable.java:34)
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=3062&messageID=8102#8102