public class MyTest extends FunctionalTest {
@Test
public void gtest() {
Http.Response response = GET("http://google.com"); // <--- RuntimeException
assertIsOk(response);
assertContentType("text/html", response);
assertCharset("utf-8", response);
}
}
此代码抛出:
java.lang.RuntimeException: java.util.concurrent.ExecutionException: play.exceptions.UnexpectedException: Unexpected Error
at play.test.FunctionalTest.makeRequest(FunctionalTest.java:299)
at play.test.FunctionalTest.makeRequest(FunctionalTest.java:305)
at play.test.FunctionalTest.GET(FunctionalTest.java:103)
at play.test.FunctionalTest.GET(FunctionalTest.java:57)
at MyTest.gtest(MyTest.java:37)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
你能告诉为什么会出现这个错误吗?以及如何解决它? Playframework 1.2.4 / Java 1.7.0_02。
答案 0 :(得分:0)
您可能只需要增加执行池大小,默认情况下,dev
模式默认为1(默认情况下也是test
)。你的线程用完了,因此发生了异常。
在application.conf
:
%test.play.pool=2