通过命令行启动java测试

发布于 2024-08-22 22:15:13 字数 1096 浏览 7 评论 0原文

我创建了 runner.bat 来启动一个 java 测试 它包含:java路径,类路径org.junit.runner.JUnitCore package.class 当我启动它时:

失败测试运行:1,失败:1

Exception in thread "Thread-0" java.lang.IllegalStateException: Shutdown in progress
        at java.lang.ApplicationShutdownHooks.add(Unknown Source)
        at java.lang.Runtime.addShutdownHook(Unknown Source)
        at com.sun.imageio.stream.StreamCloser$2.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.imageio.stream.StreamCloser.addToQueue(Unknown Source)
        at javax.imageio.stream.FileCacheImageInputStream.<init>(Unknown Source)
        at com.sun.imageio.spi.InputStreamImageInputStreamSpi.createInputStreamInstance(Unknown Source)
        at javax.imageio.ImageIO.createImageInputStream(Unknown Source)
        at javax.imageio.ImageIO.read(Unknown Source)
        at com.polyspace.util.guicomponent.CompositePanel.setBufferedImage(Unknown Source)
        at com.polyspace.util.guicomponent.CompositePanel.<init>(Unknown Source)

I created runner.bat to launch one java test
it contains : path to java,classpath org.junit.runner.JUnitCore package.class
when I launch it :

FAILURES Tests run: 1, Failures: 1

Exception in thread "Thread-0" java.lang.IllegalStateException: Shutdown in progress
        at java.lang.ApplicationShutdownHooks.add(Unknown Source)
        at java.lang.Runtime.addShutdownHook(Unknown Source)
        at com.sun.imageio.stream.StreamCloser$2.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.imageio.stream.StreamCloser.addToQueue(Unknown Source)
        at javax.imageio.stream.FileCacheImageInputStream.<init>(Unknown Source)
        at com.sun.imageio.spi.InputStreamImageInputStreamSpi.createInputStreamInstance(Unknown Source)
        at javax.imageio.ImageIO.createImageInputStream(Unknown Source)
        at javax.imageio.ImageIO.read(Unknown Source)
        at com.polyspace.util.guicomponent.CompositePanel.setBufferedImage(Unknown Source)
        at com.polyspace.util.guicomponent.CompositePanel.<init>(Unknown Source)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

违心° 2024-08-29 22:15:13

如果调用该方法时 JVM 已经关闭,则 Runtime.addShutdownHooks() 将抛出 IllegalStateException。

是否有什么原因导致您的测试在 CompositePanel 构建完成之前结束? (例如,在单独的线程中运行的东西。)

Runtime.addShutdownHooks() will throw an IllegalStateException if the JVM is already shutting down when the method is called.

Could something be causing your test to end before the construction of your CompositePanel has completed? (e.g. something running in a separate thread.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文