private PrivateDatabase createNewDB(String programName, PrivateDatabase db, File dbDir)
			throws Exception {

		// Remove old database if it exists
		if (db != null) {
			FileUtilities.deleteDir(dbDir);
		}

		File gzf = AbstractGenericTest.findTestDataFile(programName + ".gzf");
		if (gzf != null && gzf.exists()) {
			Msg.info(this, "Unpacking: " + gzf);
			db = new PrivateDatabase(dbDir, gzf, TaskMonitor.DUMMY);
			testPrograms.put(programName, db);
			return db;
		}

		File xml = AbstractGenericTest.findTestDataFile(programName + ".xml");
		if (xml == null || !xml.exists()) {
			Msg.info(this, "Test program not found: " + programName);
			return null;
		}

		Msg.info(this, "Importing: " + xml);

		LanguageService languageService = DefaultLanguageService.getLanguageService();
		ProgramXmlMgr mgr = new ProgramXmlMgr(xml);
		ProgramInfo info = mgr.getProgramInfo();
		Language language = null;
		try {
			language = languageService.getLanguage(info.languageID);
		}
		catch (LanguageNotFoundException e) {
			Processor processor = null;
			try {
				processor = Processor.toProcessor(info.processorName);
			}
			catch (ProcessorNotFoundException pnfe) {
				//silently fail
			}
			language = languageService.getDefaultLanguage(processor);

		}

		CompilerSpec compilerSpec = null;
		if (info.compilerSpecID != null) {
			compilerSpec = language.getCompilerSpecByID(info.compilerSpecID);
		}
		if (compilerSpec == null) {
			compilerSpec = language.getDefaultCompilerSpec();
		}

		// Import program
		ConsoleTaskMonitor monitor = new ConsoleTaskMonitor();
		ProgramDB p = new ProgramDB(programName, language, compilerSpec, this);
		int txId = p.startTransaction("Import");
		try {
			mgr.read(p, monitor, new XmlProgramOptions());
		}
		finally {
			p.endTransaction(txId, true);
		}

		// Save program database and add to cache
		DBHandle dbh = p.getDBHandle();
		BufferFile bfile = PrivateDatabase.createDatabase(dbDir, null, dbh.getBufferSize());
		p.getDBHandle().saveAs(bfile, true, monitor);
		p.release(this);

		db = new PrivateDatabase(dbDir);

		Msg.info(this, "Import of " + programName + " complete.");

		testPrograms.put(programName, db);
		return db;
	}
Copies the specified program zip file to the JUnit test project's folder. <b>This
means that the program will appear in the FrontEndTool as part of the project.</b>  That is
the only reason to use this method vice openProgram().

@param folder the folder into which the domain file will be inserted
@param programName the name of the program zip file without the ".gzf" extension.
@return the file
@throws FileNotFoundException if the file cannot be found
Ghidra/Features/Base/src/main/java/ghidra/test/TestProgramManager.java