@Test
	public void testMemoryBlockDeletedInView() throws Exception {
		// delete a memory block that is showing in the view
		disableCodeBrowserLocationEvents();
		env.showTool();
		Address addr = getAddr(0x0f001000);
		MemoryBlock block = memory.getBlock(addr);
		GoToService goToService = tool.getService(GoToService.class);
		goToService.goTo(new ProgramLocation(program, addr));
		waitForSwing();

		ByteViewerComponent c = panel.getCurrentComponent();
		FieldLocation loc = c.getCursorLocation();
		assertEquals(getFieldLocation(addr), loc);

		txSwing(() -> {
			memory.removeBlock(block, TaskMonitor.DUMMY);
		});

		addr = getAddr(0x0f002000);
		loc = getFieldLocation(addr);
		// cursor should be positioned at next address after deleted block
		assertEquals(loc, c.getCursorLocation());
	}
Test editing in the Byte Viewer.
Ghidra/Features/ByteViewer/src/test.slow/java/ghidra/app/plugin/core/byteviewer/ByteViewerPlugin2Test.java