@Test
    public void testChangeToRegRefNoConflict() throws Exception {
		// Stack Refs
		// 01001af5: op0 to stack offset -0x24a
		// 01001b03: op1 to stack offset -0x24c
		// Memory Refs
		// 01001aec: op1 to 01001398 AddrTable010080c0Element36 DATA primary
		// 01001b5f: op0 to 010061e3 FUN_010061e3 UNCONDITIONAL_CALL primary
		// External Refs
		// 01001008: op0 to ADVAPI32.DLL RegQueryValueExW 77db8078
		// 0100100c: op0 to ADVAPI32.DLL RegSetValueExW 77db9348
		// Register Refs
		// 0x10018a6: op0 has reg ref to ESI.
		// 0x100295a: op1 has reg ref to CX.
		// 0x1002d0b: op0 has reg ref to EDI; op1 has reg ref to EAX.
		// 0x10033fe: op0 both have reg ref to EDI.

		mtf.initialize("NotepadMergeListingTest_X86", new ProgramModifierListener() {

			@Override
			public void modifyLatest(ProgramDB program) {
				ProgramContext context = program.getProgramContext();
				Register ebpReg = context.getRegister("EBP");
				ReferenceManager refMgr = program.getReferenceManager();
				Reference[] refs;

				// Change stack ref to reg ref
				// 01001af5: op0 to stack offset -0x24a
				refs = refMgr.getReferencesFrom(addr(program, "0x1001af5"), 0);
				assertEquals(1, refs.length);
				refMgr.delete(refs[0]);
				refMgr.addRegisterReference(addr(program, "0x1001af5"), 0, ebpReg,
					RefType.DATA, SourceType.IMPORTED);
			}

			@Override
			public void modifyPrivate(ProgramDB program) {
				ProgramContext context = program.getProgramContext();
				Register ebpReg = context.getRegister("EBP");
				Register axReg = context.getRegister("AX");
				ReferenceManager refMgr = program.getReferenceManager();
				Reference[] refs;

				// Change stack ref to reg ref
				// 01001b03: op1 to stack offset -0x24c
				refs = refMgr.getReferencesFrom(addr(program, "0x1001b03"), 1);
				assertEquals(1, refs.length);
				refMgr.delete(refs[0]);
				refMgr.addRegisterReference(addr(program, "0x1001b03"), 1, ebpReg,
					RefType.DATA, SourceType.IMPORTED);

				// Change mem ref to a reg ref
				// 01001aec: op1 to 01001398 AddrTable010080c0Element36 DATA primary
				refs = refMgr.getReferencesFrom(addr(program, "0x1001aec"), 1);
				assertEquals(1, refs.length);
				refMgr.delete(refs[0]);
				refMgr.addRegisterReference(addr(program, "0x1001aec"), 1, axReg, RefType.DATA,
					SourceType.ANALYSIS);
			}
		});

		executeMerge(ASK_USER);
		waitForMergeCompletion();

		ReferenceManager refMgr = resultProgram.getReferenceManager();
		Reference[] refs;
		ProgramContext context = resultProgram.getProgramContext();
		Register ebpReg = context.getRegister("EBP");
		Register axReg = context.getRegister("AX");

		refs = refMgr.getReferencesFrom(addr("0x1001af5"), 0);
		assertEquals(1, refs.length);
		assertTrue(refs[0].getToAddress().isRegisterAddress());
		assertEquals(RefType.DATA, refs[0].getReferenceType());
		assertEquals(true, refs[0].getSource() == SourceType.IMPORTED);
		assertEquals(ebpReg.getAddress(), refs[0].getToAddress());

		refs = refMgr.getReferencesFrom(addr("0x1001b03"), 1);
		assertEquals(1, refs.length);
		assertTrue(refs[0].getToAddress().isRegisterAddress());
		assertEquals(RefType.DATA, refs[0].getReferenceType());
		assertEquals(true, refs[0].getSource() == SourceType.IMPORTED);
		assertEquals(ebpReg.getAddress(), refs[0].getToAddress());

		refs = refMgr.getReferencesFrom(addr("0x1001aec"), 1);
		assertEquals(1, refs.length);
		assertTrue(refs[0].getToAddress().isRegisterAddress());
		assertEquals(RefType.DATA, refs[0].getReferenceType());
		assertEquals(true, refs[0].getSource() == SourceType.ANALYSIS);
		assertEquals(axReg.getAddress(), refs[0].getToAddress());

	}
Test the merge of the versioned program's listing.
Ghidra/Features/Base/src/test.slow/java/ghidra/app/merge/listing/RefMergerRegTest.java