arrow_back history picture_as_pdf This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ~~Title: Use SwingApplication with JUnit tests~~ If you want to start a JVx application during a JUnit Test, it's important that you don't call System.exit during the test - otherwise your unit test will stop. This example shows how you start an application: <file java> public SwingApplication startApplication() { SwingApplication app = new SwingApplication(); app.setSystemExitOnDispose(false); app.startup(FirstApplication.class.getName(), "/apps/firstapp/application.xml", null); long lTime = System.currentTimeMillis(); while ((app.getApplication() == null || !app.getApplication().getLauncher().isVisible()) && lTime + 60000 > System.currentTimeMillis()) { try { Thread.sleep(100); } catch (InterruptedException ie) { throw new RuntimeException(ie); } } IApplication jvxapp = (IApplication)app.getApplication(); if (jvxapp == null) { Assert.fail("Application was not started!"); } return app; } </file> If you have problems with config.xml, use following to set the configuration base directory: <file java> @BeforeClass public static void beforeClassBaseApplicationTest() throws Exception { System.setProperty(IPackageSetup.CONFIG_BASEDIR, new File("").getAbsolutePath()); } </file>