@Test
	public void testIteratorForCommentType() throws Exception {
		startTransaction();
		mem.createInitializedBlock("test", addr(0), 100, (byte) 0, TaskMonitor.DUMMY, false);
		mem.createInitializedBlock("test2", addr(5000), 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);
			cu.setComment(CommentType.EOL, "comment for eol " + i);
		}

		for (int i = 20; i < 30; i++) {
			CodeUnit cu = listing.getCodeUnitAt(addr(i + 5000));
			cu.setComment(CommentType.PLATE, "comment for plate " + i);
			cu.setComment(CommentType.EOL, "comment for eol " + i);
		}
		endTransaction();

		CodeUnitIterator iter = ((ProgramDB) program).getCodeManager()
				.getCommentCodeUnitIterator(CommentType.PLATE, mem);
		int n = 0;
		Address expectedAddr = null;
		while (iter.hasNext()) {
			CodeUnit cu = iter.next();
			if (n < 20) {
				expectedAddr = addr(n + 10);
			}
			else {
				expectedAddr = addr(n + 5000);
			}
			assertEquals(expectedAddr, cu.getMinAddress());
			++n;
		}

		assertEquals(30, n);
	}
** Diagnostic Aid ** Open program in tool
@throws Exception
Ghidra/Features/Base/src/test.slow/java/ghidra/program/database/code/CodeUnitIteratorTest.java