@Test
	public void testReplaceFunctionLabelsWhereDifferentFunction() throws Exception {
		mtf.initialize("NotepadMergeListingTest", new ProgramModifierListener() {
			@Override
			public void modifyLatest(ProgramDB program) {
				// P1 program
				FunctionManager functionMgr = program.getFunctionManager();
				try {
					Function f;
					f = functionMgr.getFunctionAt(addr(program, "0x01004132"));
					assertNotNull(f);
					assertTrue(functionMgr.removeFunction(addr(program, "0x01004132")));
					String name =
						SymbolUtilities.getDefaultFunctionName(addr(program, "0x01004136"));
					AddressSet body = new AddressSet();
					body.addRange(addr(program, "0x01004136"), addr(program, "0x01004149"));
					f = functionMgr.createFunction(name, addr(program, "0x01004136"), body,
						SourceType.USER_DEFINED);
					assertNotNull(f);
					f.setName("Foo1234", SourceType.USER_DEFINED);
				}
				catch (Exception e) {
					Assert.fail(e.getMessage());
				}
			}

			@Override
			public void modifyPrivate(ProgramDB program) {
				// P2 program
				SymbolTable st = program.getSymbolTable();
				FunctionManager functionManager = program.getFunctionManager();
				Function f = functionManager.getFunctionContaining(addr(program, "0x01004140"));
				try {
					f.setName("Bar1234", SourceType.USER_DEFINED);
					Symbol sym = st.createLabel(addr(program, "0x01004132"), "doit", f,
						SourceType.USER_DEFINED);
					assertNotNull(sym);
					sym = st.createLabel(addr(program, "0x01004140"), "stuff", f,
						SourceType.USER_DEFINED);
					assertNotNull(sym);
				}
				catch (Exception e) {
					Assert.fail(e.getMessage());
				}
			}
		});

		p1 = mtf.getResultProgram();
		p2 = mtf.getPrivateProgram();

		int txId = p1.startTransaction("Merge into Program 1");
		boolean commit = false;
		try {
			AddressSet setToDiff = new AddressSet();
			setToDiff.addRange(addr(p1, "0x01001a00"), addr(p1, "0x01006500"));
			programMerge = new ProgramMergeManager(p1, p2, setToDiff);

			programMerge.setDiffFilter(new ProgramDiffFilter(ProgramDiffFilter.SYMBOL_DIFFS));
			programMerge.setMergeFilter(
				new ProgramMergeFilter(ProgramMergeFilter.SYMBOLS, ProgramMergeFilter.REPLACE));
			AddressSet expectedDiffs = new AddressSet();
			expectedDiffs.addRange(addr(p1, "0x01004132"), addr(p1, "0x01004132"));
			expectedDiffs.addRange(addr(p1, "0x01004136"), addr(p1, "0x01004136"));
			expectedDiffs.addRange(addr(p1, "0x01004140"), addr(p1, "0x01004140"));
			assertEquals(expectedDiffs, programMerge.getFilteredDifferences());

			AddressSet mergeSet = new AddressSet();
			mergeSet.addRange(addr(p1, "0x1004130"), addr(p1, "0x1004160"));
			programMerge.merge(mergeSet, TaskMonitor.DUMMY);

			assertEquals(expectedDiffs, programMerge.getFilteredDifferences());

			SymbolTable st = p1.getSymbolTable();
			Symbol[] syms;
			syms = st.getSymbols(addr(p1, "0x01004132"));
			assertEquals(2, syms.length);
			assertEquals("Bar1234", syms[0].getName());
			assertEquals(p1.getGlobalNamespace(), syms[0].getParentNamespace());
			assertEquals("doit", syms[1].getName());
			assertEquals(p1.getGlobalNamespace(), syms[1].getParentNamespace());
			syms = st.getSymbols(addr(p1, "0x01004140"));
			assertEquals(1, syms.length);
			assertEquals("stuff", syms[0].getName());
			Function f = p1.getFunctionManager().getFunctionContaining(addr(p1, "0x01004140"));
			assertEquals(f, syms[0].getParentNamespace());
			commit = true;
		}
		finally {
			p1.endTransaction(txId, commit);
		}
	}
<CODE>ProgramMerge2Test</CODE> tests the <CODE>ProgramMerge</CODE> class
to verify it correctly merges various types of program differences.
The tests modify copies of the same program to cause differences
between these two programs, which can then be merged.
Ghidra/Features/Base/src/test.slow/java/ghidra/program/util/ProgramMerge2Test.java