@Test
	public void testApplyConflictingDataTypeDifferences() throws Exception {

		// 0x01003b02: different unions with differing structures inside.

		Structure struct_b1 = new StructureDataType("struct_a", 0);
		struct_b1.add(new ByteDataType());
		struct_b1.add(new PointerDataType(new DWordDataType()));

		Union union_a1 = new UnionDataType("union_1");
		union_a1.add(new ByteDataType());
		union_a1.add(struct_b1);
		programBuilder1.applyDataType("0x01003b02", union_a1, 1);

		Structure struct_b2 = new StructureDataType("struct_a", 0);
		struct_b2.add(new ByteDataType());
		struct_b2.add(new PointerDataType(new CharDataType()));

		Union union_a2 = new UnionDataType("union_1");
		union_a2.add(new CharDataType());
		union_a2.add(struct_b1);
		programBuilder2.applyDataType("0x01003b02", union_a2, 1);

		programMerge = new ProgramMergeManager(p1, p2);
		programMerge.setDiffFilter(new ProgramDiffFilter(ProgramDiffFilter.CODE_UNIT_DIFFS));
		programMerge.setMergeFilter(
			new ProgramMergeFilter(ProgramMergeFilter.CODE_UNITS, ProgramMergeFilter.REPLACE));

		AddressSet as = new AddressSet();
		as.addRange(addr(0x01003b02), addr(0x01003b06));
		assertEquals(as, programMerge.getFilteredDifferences());
		CodeUnit cu1 = p1.getListing().getCodeUnitAt(addr(0x01003b02));
		CodeUnit cu2 = p2.getListing().getCodeUnitAt(addr(0x01003b02));
		assertTrue(cu1 instanceof Data);
		assertTrue(cu2 instanceof Data);
		Data d1 = (Data) cu1;
		Data d2 = (Data) cu2;
		DataType dt1 = d1.getDataType();
		DataType dt2 = d2.getDataType();
		assertTrue(dt1 instanceof Union);
		assertTrue(dt2 instanceof Union);
		Union u1 = (Union) dt1;
		Union u2 = (Union) dt2;
		assertEquals("union_1", u1.getName());
		assertEquals("union_1", u2.getName());
		assertEquals(false, u1.isEquivalent(u2));

		programMerge.merge(as, TaskMonitor.DUMMY);

		assertEquals(as, programMerge.getFilteredDifferences());
		cu1 = p1.getListing().getCodeUnitAt(addr(0x01003b02));
		cu2 = p2.getListing().getCodeUnitAt(addr(0x01003b02));
		assertTrue(cu1 instanceof Data);
		assertTrue(cu2 instanceof Data);
		d1 = (Data) cu1;
		d2 = (Data) cu2;
		dt1 = d1.getDataType();
		dt2 = d2.getDataType();
		assertTrue(dt1 instanceof Union);
		assertTrue(dt2 instanceof Union);
		u1 = (Union) dt1;
		u2 = (Union) dt2;
		assertEquals("union_1.conflict", u1.getName());
		assertEquals("union_1", u2.getName());
		assertTrue(u1.isEquivalent(u2));
		assertEquals(stripConflictDtSuffixes(u1.getPathName()),
			stripConflictDtSuffixes(u2.getPathName()));

		// Try to apply it again. Should get same result.
		programMerge.merge(as, TaskMonitor.DUMMY);

		assertEquals(as, programMerge.getFilteredDifferences());
		cu1 = p1.getListing().getCodeUnitAt(addr(0x01003b02));
		cu2 = p2.getListing().getCodeUnitAt(addr(0x01003b02));
		assertTrue(cu1 instanceof Data);
		assertTrue(cu2 instanceof Data);
		d1 = (Data) cu1;
		d2 = (Data) cu2;
		dt1 = d1.getDataType();
		dt2 = d2.getDataType();
		assertTrue(dt1 instanceof Union);
		assertTrue(dt2 instanceof Union);
		u1 = (Union) dt1;
		u2 = (Union) dt2;
		assertEquals("union_1.conflict", u1.getName());
		assertEquals("union_1", u2.getName());
		assertTrue(u1.isEquivalent(u2));
		assertEquals(stripConflictDtSuffixes(u1.getPathName()),
			stripConflictDtSuffixes(u2.getPathName()));
	}
Test that programMerge can apply a conflicting data type difference in
Program1 and Program2.
Ghidra/Features/Base/src/test.slow/java/ghidra/program/util/ProgramMerge3Test.java