@Test
	public void testMemoryMapMove() throws Exception {
		// Move a memory block; verify that the byte viewer updates

		env.showTool();

		// put the byte viewer in edit mode
		ToggleDockingAction action =
			(ToggleDockingAction) getAction(plugin, "Enable/Disable Byteviewer Editing");
		runSwing(() -> {
			action.setSelected(true);
			action.actionPerformed(new DefaultActionContext());
		});

		// first add a memory block
		txSwing(() -> {
			Address addr = getAddr(0x100);
			memory.createInitializedBlock(".test", addr, 10, (byte) 0, null, false);
		});

		// edit the first 3 bytes in the block
		ByteViewerComponent c = panel.getCurrentComponent();
		runSwing(() -> {
			Address testAddress = getAddr(0x100);
			FieldLocation loc = getFieldLocation(testAddress);
			KeyEvent ev = new KeyEvent(c, 0, new Date().getTime(), 0, KeyEvent.VK_1, '1');
			c.keyPressed(ev, loc.getIndex(), loc.getFieldNum(), loc.getRow(), loc.getCol(),
				c.getCurrentField());

			testAddress = testAddress.add(1);
			loc = getFieldLocation(testAddress);
			ev = new KeyEvent(c, 0, new Date().getTime(), 0, KeyEvent.VK_2, '2');
			c.keyPressed(ev, loc.getIndex(), loc.getFieldNum(), loc.getRow(), loc.getCol(),
				c.getCurrentField());

			testAddress = testAddress.add(1);
			loc = getFieldLocation(testAddress);
			ev = new KeyEvent(c, 0, new Date().getTime(), 0, KeyEvent.VK_3, '3');
			c.keyPressed(ev, loc.getIndex(), loc.getFieldNum(), loc.getRow(), loc.getCol(),
				c.getCurrentField());
		});
		program.flushEvents();

		// move the block
		txSwing(() -> {
			Address addr = getAddr(0x100);
			MemoryBlock block = memory.getBlock(addr);
			Address newStart = getAddr(0x500);
			memory.moveBlock(block, newStart, TaskMonitor.DUMMY);
		});

		Address addr = getAddr(0x500);
		FieldLocation loc = getFieldLocation(addr);

		ByteField field = c.getField(loc.getIndex(), loc.getFieldNum());
		assertNotNull(field);
	}
Test editing in the Byte Viewer.
Ghidra/Features/ByteViewer/src/test.slow/java/ghidra/app/plugin/core/byteviewer/ByteViewerPlugin2Test.java