我嘗試用FEST測試我的應用程序。與其他大多數應用程序一樣,我在那裏有一個System.exit()
命令。當我什麼都不做並且運行所有測試時,當第一次調用System.exit()
方法時,測試運行會中止。我可以使用Java FEST阻止應用程序測試執行System.exit嗎?
我搜索了一下here。這似乎是我正在尋找的東西,但它會導致意想不到的行爲。當我打電話System.exit()
我得到一個無限循環System.exit()
其中每次拋出org.fest.swing.security.ExitException
。如果我發現異常,應用程序沒有關閉,測試也不會結束。
有沒有人已經使用過這樣的FEST?
作進一步的信息完整的堆棧跟蹤:
Exception in thread "AWT-EventQueue-0" org.fest.swing.security.ExitException: Application tried to terminate current JVM with status 0
at org.fest.swing.security.NoExitSecurityManager.checkExit(NoExitSecurityManager.java:84)
at java.lang.Runtime.exit(Unknown Source)
at java.lang.System.exit(Unknown Source)
at org.luciferius.banking.swingUi.internal.SwingUiBuilder$1.windowClosed(SwingUiBuilder.java:81)
at java.awt.AWTEventMulticaster.windowClosed(Unknown Source)
at java.awt.Window.processWindowEvent(Unknown Source)
at javax.swing.JFrame.processWindowEvent(Unknown Source)
at java.awt.Window.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
問候,Yggdrasil的
應編碼的UI被標記? – w25r