@Test
	public void testAddRegParamVsChangeConflict() throws Exception {

		mtf.initialize("NotepadMergeListingTest", new OriginalProgramModifierListener() {

			@Override
			public void modifyOriginal(ProgramDB program) {
				try {
					Function applesFunction =
						createExternalFunction(program, new String[] { "user32.dll", "apples" },
							addr(program, "77db1020"), new ByteDataType(), SourceType.USER_DEFINED);
					assertNotNull(applesFunction);
					Parameter parameter1 = new ParameterImpl("P1", new DWordDataType(), program);
					parameter1.setComment("Test Parameter Comment");
					applesFunction.addParameter(parameter1, SourceType.USER_DEFINED);

					Function orangesFunction =
						createExternalFunction(program, new String[] { "user32.dll", "oranges" });
					addStackParameter(orangesFunction, "A1", SourceType.USER_DEFINED,
						new DWordDataType(), 4, "Test Parameter Comment");
					addStackParameter(orangesFunction, "A2", SourceType.USER_DEFINED,
						new DWordDataType(), 8, "Test Parameter Comment");
				}
				catch (Exception e) {
					Assert.fail(e.getMessage());
				}
			}

			@Override
			public void modifyLatest(ProgramDB program) {
				try {
					Function func;
					Parameter param0;
					AddRegisterParameterCommand cmd;
					Register regR5 = program.getProgramContext().getRegister("r5");

					func = getExternalFunction(program, new String[] { "user32.dll", "apples" });
					func.setCustomVariableStorage(true);
					cmd = new AddRegisterParameterCommand(func, regR5, null,
						new Undefined4DataType(), 1, SourceType.USER_DEFINED);
					cmd.applyTo(program);

					func = getExternalFunction(program, new String[] { "user32.dll", "oranges" });
					func.setCustomVariableStorage(true);
					param0 = func.getParameter(0);
					assertNotNull(param0);
					param0.setName("NewParamName2", SourceType.USER_DEFINED);
				}
				catch (Exception e) {
					e.printStackTrace();
					Assert.fail(e.getMessage());
				}
			}

			@Override
			public void modifyPrivate(ProgramDB program) {
				try {
					Function func;
					Parameter param0;
					AddRegisterParameterCommand cmd;
					Register regR6 = program.getProgramContext().getRegister("r6");

					func = getExternalFunction(program, new String[] { "user32.dll", "apples" });
					func.setCustomVariableStorage(true);
					param0 = func.getParameter(0);
					assertNotNull(param0);
					param0.setName("NewParamName1", SourceType.USER_DEFINED);

					func = getExternalFunction(program, new String[] { "user32.dll", "oranges" });
					func.setCustomVariableStorage(true);
					cmd = new AddRegisterParameterCommand(func, regR6, null,
						new Undefined4DataType(), 1, SourceType.USER_DEFINED);
					cmd.applyTo(program);
				}
				catch (Exception e) {
					e.printStackTrace();
					Assert.fail(e.getMessage());
				}
			}
		});

		executeMerge(ASK_USER);
		chooseRadioButton(CHECKED_OUT_BUTTON_NAME);
		chooseRadioButton(CHECKED_OUT_BUTTON_NAME);
		waitForMergeCompletion();

		ProgramContext context = resultProgram.getProgramContext();
		Register r12Reg = context.getRegister("r12");
		Register r11Reg = context.getRegister("r11");
		Register r6Reg = context.getRegister("r6");

		Function func = getExternalFunction(resultProgram, new String[] { "user32.dll", "apples" });
		Parameter[] parameters = func.getParameters();
		assertEquals(1, parameters.length);
		assertEquals("NewParamName1", parameters[0].getName());
		assertEquals(r12Reg, parameters[0].getRegister());
		assertTrue(new DWordDataType().isEquivalent(parameters[0].getDataType()));
		Variable[] localVariables = func.getLocalVariables();
		assertEquals(0, localVariables.length);

		func = getExternalFunction(resultProgram, new String[] { "user32.dll", "oranges" });
		parameters = func.getParameters();
		assertEquals(3, parameters.length);
		assertEquals("A1", parameters[0].getName());
		assertEquals(r12Reg, parameters[0].getRegister());
		assertTrue(new DWordDataType().isEquivalent(parameters[0].getDataType()));
		assertEquals("param_2", parameters[1].getName());
		assertEquals(r6Reg, parameters[1].getRegister());
		assertTrue(new Undefined4DataType().isEquivalent(parameters[1].getDataType()));
		assertEquals("A2", parameters[2].getName());
		assertEquals(r11Reg, parameters[2].getRegister());
		assertTrue(new DWordDataType().isEquivalent(parameters[2].getDataType()));
		localVariables = func.getLocalVariables();
		assertEquals(0, localVariables.length);
	}
Test the merge of external function variables.
Ghidra/Features/Base/src/test.slow/java/ghidra/app/merge/listing/ExternalFunctionMergeManagerTest.java