@Test
	public void testGetsSingleSpace() throws CodeUnitInsertionException {
		TraceData d4000;
		TraceInstruction i4008;
		try (Transaction tx = b.startTransaction()) {
			d4000 = b.addData(0, b.addr(0x4000), IntegerDataType.dataType, b.buf(1, 2, 3, 4));
			d4000.setEndSnap(9);
			i4008 = b.addInstruction(0, b.addr(0x4008), b.host, b.buf(0xf4, 0));
			i4008.setEndSnap(9);
		}

		DBTraceCodeSpace codeSpace = manager.getForSpace(b.language.getDefaultSpace(), false);
		assertNotNull(codeSpace);

		assertEquals(d4000, codeSpace.codeUnits().getBefore(0, b.addr(0x4004)));
		assertUndefinedWithAddr(b.addr(0x4004), codeSpace.codeUnits().getBefore(0, b.addr(0x4005)));
		assertEquals(d4000, codeSpace.codeUnits().getAfter(0, b.addr(0x3fff)));
		assertUndefinedWithAddr(b.addr(0x3fff), codeSpace.codeUnits().getAfter(0, b.addr(0x3ffe)));

		assertEquals(d4000, codeSpace.data().getBefore(0, b.addr(0x4004)));
		assertUndefinedWithAddr(b.addr(0x4004), codeSpace.data().getBefore(0, b.addr(0x4005)));
		assertEquals(d4000, codeSpace.data().getAfter(0, b.addr(0x3fff)));
		assertUndefinedWithAddr(b.addr(0x3fff), codeSpace.data().getAfter(0, b.addr(0x3ffe)));

		assertEquals(d4000, codeSpace.definedUnits().getBefore(0, b.addr(0x4004)));
		assertEquals(d4000, codeSpace.definedUnits().getBefore(0, b.addr(0x4005)));
		assertEquals(d4000, codeSpace.definedUnits().getAfter(0, b.addr(0x3fff)));
		assertEquals(d4000, codeSpace.definedUnits().getAfter(0, b.addr(0x3ffe)));

		assertEquals(i4008, codeSpace.instructions().getBefore(0, b.addr(0x400a)));
		assertEquals(i4008, codeSpace.instructions().getBefore(0, b.addr(0x400b)));
		assertEquals(i4008, codeSpace.instructions().getAfter(0, b.addr(0x4007)));
		assertEquals(i4008, codeSpace.instructions().getAfter(0, b.addr(0x4006)));

		assertEquals(d4000, codeSpace.definedData().getBefore(0, b.addr(0x4004)));
		assertEquals(d4000, codeSpace.definedData().getBefore(0, b.addr(0x4005)));
		assertEquals(d4000, codeSpace.definedData().getAfter(0, b.addr(0x3fff)));
		assertEquals(d4000, codeSpace.definedData().getAfter(0, b.addr(0x3ffe)));

		assertUndefinedWithAddr(b.addr(0x3fff),
			codeSpace.undefinedData().getBefore(0, b.addr(0x4004)));
		assertUndefinedWithAddr(b.addr(0x4004),
			codeSpace.undefinedData().getBefore(0, b.addr(0x4005)));
		assertUndefinedWithAddr(b.addr(0x4004),
			codeSpace.undefinedData().getAfter(0, b.addr(0x3fff)));
		assertUndefinedWithAddr(b.addr(0x3fff),
			codeSpace.undefinedData().getAfter(0, b.addr(0x3ffe)));

		// Only one not covered via MemoryView is AddressSetView variant
		assertEquals(List.of(d4000, i4008),
			list(codeSpace.definedUnits().get(0, b.set(b.range(0x0000, -0x0001)), true)));
		assertEquals(List.of(i4008, d4000),
			list(codeSpace.definedUnits().get(0, b.set(b.range(0x0000, -0x0001)), false)));

		try { // Contains a range outside the selected space
			list(codeSpace.definedUnits()
					.get(0,
						b.set(b.range(0x4000, 0x5000), b.drng(0x4000, 0x5000)), true));
			fail();
		}
		catch (IllegalArgumentException e) {
			// pass
		}
	}
This test is interesting because the pointer type def causes an update to the data type
settings <em>while the unit is still being created</em>. This will invalidate the trace's
caches. All of them, including the defined data units, which can become the cause of many
timing issues.
Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/listing/DBTraceCodeManagerTest.java