@Test
	public void testStructureReplace2() {

		try (Transaction tx = program.openTransaction("Test")) {

			Structure struct1 = new StructureDataType("abc", 0);
			struct1.setPackingEnabled(true);
			struct1.setExplicitMinimumAlignment(
				dtm.getDataOrganization().getDefaultPointerAlignment());

			Structure resolvedStruct1 = (Structure) dtm.resolve(struct1, null);
			assertEquals(0, resolvedStruct1.getParents().size());

			Structure struct2 = createStruct("xyz", resolvedStruct1, 1);
			struct2.setPackingEnabled(true);
			Structure resolvedStruct2 = (Structure) dtm.resolve(struct2, null);

			assertEquals(1, resolvedStruct1.getParents().size());

			DataType dt =
				new ArrayDataType(new PointerDataType(new IntegerDataType(dtm), dtm), 0, -1);

			resolvedStruct2.replace(0, dt, -1);

			assertEquals(0, resolvedStruct1.getParents().size());

			//@formatter:off
			assertEquals(
				"/xyz\n" + 
				"pack()\n" + 
				"Structure xyz {\n" + 
				"   0   int *[0]   0      \"\"\n" + 
				"}\n" + 
				"Length: 0 Alignment: 4\n",
				resolvedStruct2.toString());
			//@formatter:on
		}
	}
Tests for manipulating data types in the category/data type tree.
Ghidra/Features/Base/src/test.slow/java/ghidra/program/model/data/DataTypeTest.java