@BeforeEach
	protected void setup() throws Exception {
		// Remove the existing program data folder
		String suffix = "-" + Profile.TEST;
		ProductCard metadata = ProductCard.info( Program.class );
		Path programDataFolder = OperatingSystem.getUserProgramDataFolder( metadata.getArtifact() + suffix, metadata.getName() + suffix );
		assertThat( aggressiveDelete( programDataFolder ) ).withFailMessage( "Failed to delete program data folder" ).isTrue();
		// For the parameters to be available using Java 9, the following needs to be added
		// to the test JVM command line parameters because com.sun.javafx.application.ParametersImpl
		// is not exposed, nor is there a "proper" way to access it:
		//
		// --add-opens=javafx.graphics/com.sun.javafx.application=ALL-UNNAMED
		program = (Program)FxToolkit.setupApplication( Program.class, ProgramTestConfig.getParameterValues() );
		program.register( ProgramEvent.ANY, programWatcher = new EventWatcher( TIMEOUT ) );
		Fx.waitForWithExceptions( TIMEOUT );
		// NOTE Thread.yield() is helpful but not consistent
		Thread.yield();
		programWatcher.waitForEvent( ProgramEvent.STARTED, TIMEOUT );
		Fx.waitForWithExceptions( TIMEOUT );
		// NOTE Thread.yield() is helpful but not consistent
		Thread.yield();
		// Wait for the active workarea
		// FIXME This should use an event listener to wait for the workarea
		long limit = System.currentTimeMillis() + TIMEOUT;
		while( program.getWorkspaceManager().getActiveWorkspace().getActiveWorkarea() == null && System.currentTimeMillis() < limit ) {
			ThreadUtil.pause( 100 );
		}
		assertThat( program ).withFailMessage( "Program is null" ).isNotNull();
		assertThat( program.getWorkspaceManager() ).withFailMessage( "Workspace manager is null" ).isNotNull();
		assertThat( program.getWorkspaceManager().getActiveWorkspace() ).withFailMessage( "Active workspace is null" ).isNotNull();
		assertThat( program.getWorkspaceManager().getActiveWorkspace().getActiveWorkarea() ).withFailMessage( "Active workarea is null" ).isNotNull();
		assertThat( program.getWorkspaceManager().getActiveWorkspace().getActiveWorkarea().getWorkpane() ).withFailMessage( "Active workpane is null" ).isNotNull();
		Workpane workpane = program.getWorkspaceManager().getActiveWorkspace().getActiveWorkarea().getWorkpane();
		workpane.addEventHandler( WorkpaneEvent.ANY, workpaneWatcher = new FxEventWatcher() );
		initialMemoryUse = getMemoryUse();
	}
@BeforeEach
	protected void setup() throws Exception {
	
		String suffix = "-" + Profile.TEST;
		ProductCard metadata = ProductCard.info( Program.class );
		Path programDataFolder = OperatingSystem.getUserProgramDataFolder( metadata.getArtifact() + suffix, metadata.getName() + suffix );
		assertThat( aggressiveDelete( programDataFolder ) ).withFailMessage( "Failed to delete program data folder" ).isTrue();
	
	
	
	
	
		program = (Program)FxToolkit.setupApplication( Program.class, ProgramTestConfig.getParameterValues() );
		program.register( ProgramEvent.ANY, programWatcher = new EventWatcher( TIMEOUT ) );
		Fx.waitForWithExceptions( TIMEOUT );
	
		Thread.yield();
		programWatcher.waitForEvent( ProgramEvent.STARTED, TIMEOUT );
		Fx.waitForWithExceptions( TIMEOUT );
	
		Thread.yield();
	
	
		long limit = System.currentTimeMillis() + TIMEOUT;
		while( program.getWorkspaceManager().getActiveWorkspace().getActiveWorkarea() == null && System.currentTimeMillis() < limit ) {
			ThreadUtil.pause( 100 );
		}
		assertThat( program ).withFailMessage( "Program is null" ).isNotNull();
		assertThat( program.getWorkspaceManager() ).withFailMessage( "Workspace manager is null" ).isNotNull();
		assertThat( program.getWorkspaceManager().getActiveWorkspace() ).withFailMessage( "Active workspace is null" ).isNotNull();
		assertThat( program.getWorkspaceManager().getActiveWorkspace().getActiveWorkarea() ).withFailMessage( "Active workarea is null" ).isNotNull();
		assertThat( program.getWorkspaceManager().getActiveWorkspace().getActiveWorkarea().getWorkpane() ).withFailMessage( "Active workpane is null" ).isNotNull();
		Workpane workpane = program.getWorkspaceManager().getActiveWorkspace().getActiveWorkarea().getWorkpane();
		workpane.addEventHandler( WorkpaneEvent.ANY, workpaneWatcher = new FxEventWatcher() );
		initialMemoryUse = getMemoryUse();
	}
@beforeeach protected void setup() throws exception { string suffix = "-" + profile.test; productcard metadata = productcard.info( program.class ); path programdatafolder = operatingsystem.getuserprogramdatafolder( metadata.getartifact() + suffix, metadata.getname() + suffix ); assertthat( aggressivedelete( programdatafolder ) ).withfailmessage( "failed to delete program data folder" ).istrue(); program = (program)fxtoolkit.setupapplication( program.class, programtestconfig.getparametervalues() ); program.register( programevent.any, programwatcher = new eventwatcher( timeout ) ); fx.waitforwithexceptions( timeout ); thread.yield(); programwatcher.waitforevent( programevent.started, timeout ); fx.waitforwithexceptions( timeout ); thread.yield(); long limit = system.currenttimemillis() + timeout; while( program.getworkspacemanager().getactiveworkspace().getactiveworkarea() == null && system.currenttimemillis() < limit ) { threadutil.pause( 100 ); } assertthat( program ).withfailmessage( "program is null" ).isnotnull(); assertthat( program.getworkspacemanager() ).withfailmessage( "workspace manager is null" ).isnotnull(); assertthat( program.getworkspacemanager().getactiveworkspace() ).withfailmessage( "active workspace is null" ).isnotnull(); assertthat( program.getworkspacemanager().getactiveworkspace().getactiveworkarea() ).withfailmessage( "active workarea is null" ).isnotnull(); assertthat( program.getworkspacemanager().getactiveworkspace().getactiveworkarea().getworkpane() ).withfailmessage( "active workpane is null" ).isnotnull(); workpane workpane = program.getworkspacemanager().getactiveworkspace().getactiveworkarea().getworkpane(); workpane.addeventhandler( workpaneevent.any, workpanewatcher = new fxeventwatcher() ); initialmemoryuse = getmemoryuse(); }