@Test
    public void testAddMemVsExtPickLatest() throws Exception {

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

			@Override
			public void modifyLatest(ProgramDB program) {
				try {
					ReferenceManager refMgr = program.getReferenceManager();
					refMgr.addExternalReference(addr(program, "0x10024ea"), "USER32.DLL", "printf",
						addr(program, "0x01234567"), SourceType.USER_DEFINED, 1,
						RefType.DATA);
					refMgr.addMemoryReference(addr(program, "0x1002510"),
						addr(program, "0x00000010"), RefType.CONDITIONAL_JUMP,
						SourceType.USER_DEFINED, 0);
					refMgr.addMemoryReference(addr(program, "0x1002510"),
						addr(program, "0x10025d8"), RefType.DATA, SourceType.USER_DEFINED, 0);
					refMgr.addMemoryReference(addr(program, "0x1002510"),
						addr(program, "0x1002608"), RefType.CONDITIONAL_JUMP,
						SourceType.USER_DEFINED, 0);
				}
				catch (Exception e) {
					Assert.fail(e.getMessage());
				}
			}

			@Override
			public void modifyPrivate(ProgramDB program) {
				try {
					ReferenceManager refMgr = program.getReferenceManager();
					refMgr.addMemoryReference(addr(program, "0x10024ea"),
						addr(program, "0x100248c"), RefType.CONDITIONAL_JUMP,
						SourceType.USER_DEFINED, 1);
					refMgr.addMemoryReference(addr(program, "0x10024ea"),
						addr(program, "0x10024ce"), RefType.DATA, SourceType.USER_DEFINED, 1);
					refMgr.addMemoryReference(addr(program, "0x10024ea"),
						addr(program, "0x10025f1"), RefType.CONDITIONAL_JUMP,
						SourceType.USER_DEFINED, 1);
					refMgr.addMemoryReference(addr(program, "0x10024ea"),
						addr(program, "0x1002ee2"), RefType.CONDITIONAL_JUMP,
						SourceType.USER_DEFINED, 1);
					refMgr.addExternalReference(addr(program, "0x1002510"), "USER32.DLL",
						"getMessage", addr(program, "0x1001a11"), SourceType.USER_DEFINED, 0,
						RefType.DATA);
				}
				catch (Exception e) {
					Assert.fail(e.getMessage());
				}
			}
		});

		executeMerge(ASK_USER);
		chooseRadioButton(LATEST_BUTTON);
		chooseRadioButton(LATEST_BUTTON);
		waitForMergeCompletion();

		ReferenceManager refMgr = resultProgram.getReferenceManager();
		Reference[] refs;
		refs = refMgr.getReferencesFrom(addr("0x10024ea"), 1);
		assertEquals(1, refs.length);
		assertEquals(RefType.DATA, refs[0].getReferenceType());
		assertEquals("USER32.DLL::printf",
			((ExternalReference) refs[0]).getExternalLocation().toString());
		assertEquals("01234567",
			((ExternalReference) refs[0]).getExternalLocation().getAddress().toString());
		assertTrue(refs[0].isPrimary());

		refs = refMgr.getReferencesFrom(addr("01002510"), 0);
		assertEquals(3, refs.length);
		Arrays.sort(refs);
		assertEquals(addr("0x00000010"), refs[0].getToAddress());
		assertEquals(RefType.CONDITIONAL_JUMP, refs[0].getReferenceType());
		assertTrue(refs[0].isPrimary());
		assertEquals(addr("0x10025d8"), refs[1].getToAddress());
		assertEquals(RefType.DATA, refs[1].getReferenceType());
		assertTrue(!refs[1].isPrimary());
		assertEquals(addr("0x1002608"), refs[2].getToAddress());
		assertEquals(RefType.CONDITIONAL_JUMP, refs[2].getReferenceType());
		assertTrue(!refs[2].isPrimary());
	}
//	 * 
//	 * @param program
//	 * @param ref
//	 * @param varName
//
Ghidra/Features/Base/src/test.slow/java/ghidra/app/merge/listing/ReferenceMergerTest.java