@Test
	public void testIteratorForComments() throws Exception {
		startTransaction();
		mem.createInitializedBlock("test", addr(0), 100, (byte) 0, TaskMonitor.DUMMY, false);

		for (int i = 0; i < 20; i++) {
			CodeUnit cu = listing.getCodeUnitAt(addr(i + 10));
			cu.setComment(CommentType.PLATE, "comment for plate " + i);
			assertEquals("comment for plate " + i, cu.getComment(CommentType.PLATE));
		}
		endTransaction();

		CodeUnitIterator iter =
			listing.getCodeUnitIterator(CodeUnit.COMMENT_PROPERTY, addr(0), true);

		int n = 0;
		Address expectedAddr = null;
		while (iter.hasNext()) {
			CodeUnit cu = iter.next();
			expectedAddr = addr(n + 10);
			assertEquals(expectedAddr, cu.getMinAddress());
			assertNotNull(cu.getComment(CommentType.PLATE));
			assertNull(cu.getComment(CommentType.EOL));
			++n;
		}
	}
** Diagnostic Aid ** Open program in tool
@throws Exception
Ghidra/Features/Base/src/test.slow/java/ghidra/program/database/code/CodeUnitIteratorTest.java