@Test
	public void testSortSourceDescending() throws Exception {
		tx(program, () -> {
			MemoryBlock block =
				memory.createBitMappedBlock(".Bit", getAddr(0), getAddr(0x01001000), 0x100, false);
			block.setSourceName("this is a test");
			block = memory.createUninitializedBlock(".Uninit", getAddr(0x3000), 0x200, false);
			block.setSourceName("other source");
		});

		JTableHeader header = table.getTableHeader();
		// ascending
		Rectangle rect = header.getHeaderRect(MemoryMapModel.SOURCE);
		clickMouse(header, 1, rect.x, rect.y, 1, 0);

		// descending
		clickMouse(header, 1, rect.x, rect.y, 1, 0);

		MemoryBlock[] blocks = memory.getBlocks();
		String[] sources = new String[blocks.length];
		for (int i = 0; i < blocks.length; i++) {
			sources[i] = blocks[i].getSourceName();
		}
		Arrays.sort(sources, new StringComparator());
		for (int i = 0; i < sources.length; i++) {
			int idx = sources.length - 1 - i;
			boolean doAssert = true;
			for (MemoryBlock memBlock : blocks) {
				if (memBlock.getSourceName().equals(sources[idx]) &&
					memBlock.getType() == MemoryBlockType.BIT_MAPPED) {
					MemoryBlockSourceInfo info = memBlock.getSourceInfos().get(0);
					Address addr = info.getMappedRange().get().getMinAddress();
					assertEquals(addr.toString(), model.getValueAt(i, MemoryMapModel.SOURCE));
					doAssert = false;
					break;
				}
			}
			if (doAssert) {
				assertEquals(sources[idx], model.getValueAt(i, MemoryMapModel.SOURCE));
			}
		}
	}
Basic tests for the memory map provider.
Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/memory/MemoryMapProvider1Test.java