@Test
	public void testMemoryBlockExpandDown() throws Exception {
		disableCodeBrowserLocationEvents();

		// expand block down: create a block, then join to its predecessor
		env.showTool();
		Address addr = getAddr(0x01001000);
		MemoryBlock block = memory.getBlock(addr);
		GoToService goToService = tool.getService(GoToService.class);
		goToService.goTo(new ProgramLocation(program, addr));

		Address newaddr = getAddr(0x01003000L);

		txSwing(() -> {
			MemoryBlock newblock =
				memory.createInitializedBlock(".test", newaddr, 0x100, (byte) 0, null, false);
			memory.join(block, newblock);
		});

		ByteViewerComponent c = panel.getCurrentComponent();
		FieldLocation loc = getFieldLocation(newaddr);
		ByteField field = c.getField(loc.getIndex(), loc.getFieldNum());
		assertNotNull(field);
		loc = c.getCursorLocation();
		// cursor should remain where it was before the block expansion
		assertEquals(getFieldLocation(addr), loc);
	}
Test editing in the Byte Viewer.
Ghidra/Features/ByteViewer/src/test.slow/java/ghidra/app/plugin/core/byteviewer/ByteViewerPlugin2Test.java