@Test
	public void testGetCodeUnitsSetWithOverride() throws Exception {

		// set length-override on 0x3f4
		try (Transaction tx = program.openTransaction("Set Length Override")) {
			program.getListing().getInstructionAt(addr(0x3f4)).setLengthOverride(1);
		}

		AddressSet set = new AddressSet();
		set.addRange(addr(0x3f0), addr(0x3f9));

		CodeUnitIterator it = listing.getCodeUnits(set, true);

		CodeUnit cu = it.next();
		assertEquals(addr(0x3f1), cu.getMinAddress());
		assertTrue(cu instanceof Data);
		assertFalse(((Data) cu).isDefined());

		cu = it.next();
		assertEquals(addr(0x3f2), cu.getMinAddress());
		assertTrue(cu instanceof Instruction);
		assertEquals(2, cu.getLength());

		cu = it.next();
		assertEquals(addr(0x3f4), cu.getMinAddress());
		assertTrue(cu instanceof Instruction);
		assertEquals(1, cu.getLength()); // length overriden
		assertEquals("imm r0,#0x0", cu.toString());

		cu = it.next();
		assertEquals(addr(0x3f5), cu.getMinAddress());
		assertTrue(cu instanceof Data);
		assertFalse(((Data) cu).isDefined());

		cu = it.next();
		assertEquals(addr(0x3f6), cu.getMinAddress());
		assertTrue(cu instanceof Instruction);
		assertEquals(2, cu.getLength());

		cu = it.next();
		assertEquals(addr(0x3f8), cu.getMinAddress());
		assertTrue(cu instanceof Data);
		assertFalse(((Data) cu).isDefined());

		cu = it.next();
		assertEquals(addr(0x3f9), cu.getMinAddress());
		assertTrue(cu instanceof Data);
		assertFalse(((Data) cu).isDefined());

		assertFalse(it.hasNext());
		assertNull(it.next());
	}
** Diagnostic Aid ** Open program in tool
@throws Exception
Ghidra/Features/Base/src/test.slow/java/ghidra/program/database/code/CodeUnitIteratorTest.java