protected ExternalLocation setupExternalLocation(String library, String label, Address address,
			SourceType sourceType, boolean isFunction)
			throws Exception {
		boolean success = false;
		int transactionID =
			program.startTransaction("Setting Up External Location " + library + "::" + label);
		try {
			ExternalManager externalManager = program.getExternalManager();
			Namespace libraryScope = getLibraryScope("ADVAPI32.dll");
			ExternalLocation extLocation =
				externalManager.addExtLocation(libraryScope, label, address, sourceType);
			assertNotNull(extLocation);
			if (isFunction) {
				Function function = extLocation.createFunction();
				assertNotNull(function);
			}
			success = true;
			return extLocation;
		}
		finally {
			program.endTransaction(transactionID, success);
		}
	}
Tests for the symbol tree plugin.
Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/symboltree/AbstractSymbolTreePluginExternalsTest.java