@Test
	public void testConsistencyAndIndexRebuild() throws IOException {

		DBRecord[] recs = createRandomTableRecords(DBTestUtils.ALL_TYPES, ITER_REC_CNT, 10);

		long txId = dbh.startTransaction();
		try {
			assertTrue(dbh.isConsistent(TaskMonitor.DUMMY));
			dbh.rebuild(TaskMonitor.DUMMY);
		}
		catch (CancelledException e) {
			fail("unexpected cancel exception");
		}
		finally {
			dbh.endTransaction(txId, true);
		}

		Table table = dbh.getTable(table1Name);
		for (int colIx : table.getIndexedColumns()) {
			Arrays.sort(recs, new RecColumnComparator(colIx));
			int recIx = 0;
			RecordIterator iter = table.indexIterator(colIx);
			while (iter.hasNext()) {
				DBRecord rec = iter.next();
				assertEquals(recs[recIx++], rec);
			}
			assertEquals(ITER_REC_CNT, recIx);
		}

		saveAsAndReopen(dbName);

		table = dbh.getTable(table1Name);
		for (int colIx : table.getIndexedColumns()) {
			Arrays.sort(recs, new RecColumnComparator(colIx));
			int recIx = 0;
			RecordIterator iter = table.indexIterator(colIx);
			while (iter.hasNext()) {
				DBRecord rec = iter.next();
				assertEquals(recs[recIx++], rec);
			}
			assertEquals(ITER_REC_CNT, recIx);
		}

	}
@see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
Ghidra/Framework/DB/src/test/java/db/DBIndexedTableTest.java