@Test
	public void testFunctionAndSymbolReplaceOfFunctionWithFunctionInNamespace() throws Exception {
		mtf.initialize("NotepadMergeListingTest", new ProgramModifierListener() {
			@Override
			public void modifyLatest(ProgramDB program) {
				// P1 program
				FunctionManager functionMgr = program.getFunctionManager();
				try {
					Function f = functionMgr.getFunctionAt(addr(program, "0x01002cf5"));
					f.setName("MY.DLL_SampleLabel", SourceType.IMPORTED);
				}
				catch (Exception e) {
					Assert.fail(e.getMessage());
				}
			}

			@Override
			public void modifyPrivate(ProgramDB program) {
				// P2 program
				SymbolTable st = program.getSymbolTable();
				Namespace namespace;
				FunctionManager functionMgr = program.getFunctionManager();
				try {
					namespace = st.createNameSpace(program.getGlobalNamespace(), "MY.DLL",
						SourceType.USER_DEFINED);
					Function f = functionMgr.getFunctionAt(addr(program, "0x01002cf5"));
					f.setName("SampleLabel", SourceType.IMPORTED);
					f.setParentNamespace(namespace);
				}
				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.FUNCTION_DIFFS | ProgramDiffFilter.SYMBOL_DIFFS));
			ProgramMergeFilter filter = new ProgramMergeFilter();
			filter.setFilter(ProgramMergeFilter.FUNCTIONS, ProgramMergeFilter.REPLACE);
			filter.setFilter(ProgramMergeFilter.SYMBOLS, ProgramMergeFilter.REPLACE);
			programMerge.setMergeFilter(filter);
			AddressSet expectedDiffs = new AddressSet();
			expectedDiffs.addRange(addr(p1, "0x01002cf5"), addr(p1, "0x01002cf5"));
			assertEquals(expectedDiffs, programMerge.getFilteredDifferences());

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

			// P1 should now have function in namespace and no diffs.
			assertEquals(new AddressSet(), programMerge.getFilteredDifferences());

			Function function = p1.getFunctionManager().getFunctionAt(addr(p1, "0x01002cf5"));
			assertNotNull(function);
			assertEquals("MY.DLL::SampleLabel", function.getName(true));

			SymbolTable st = p1.getSymbolTable();
			Symbol[] syms = st.getSymbols(addr(p1, "0x01002cf5"));
			assertEquals(1, syms.length);
			assertEquals("SampleLabel", syms[0].getName());
			assertEquals(SymbolType.FUNCTION, syms[0].getSymbolType());
			assertEquals("MY.DLL", syms[0].getParentNamespace().getName());
			assertEquals(SymbolType.NAMESPACE,
				syms[0].getParentNamespace().getSymbol().getSymbolType());
			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