@Test
	public void testMemoryChange() throws Exception {

		env.showTool();
		runSwing(() -> tool.showComponentProvider(plugin.getProvider(), false));
		ProgramManager pm = tool.getService(ProgramManager.class);
		runSwing(() -> pm.closeProgram(), false);
		waitForSwing();

		pm.openProgram(program.getDomainFile());

		// add a memory block
		txSwing(() -> {
			memory.createInitializedBlock(".test", getAddr(0), 500, (byte) 0, TaskMonitor.DUMMY,
				false);
		});

		runSwing(() -> {
			GoToService goToService = tool.getService(GoToService.class);
			goToService.goTo(new ProgramLocation(program, getAddr(0)));
		});
		runSwing(() -> tool.showComponentProvider(plugin.getProvider(), true));
		waitForSwing();

		ByteViewerComponent c = panel.getCurrentComponent();
		assertEquals(getFieldLocation(getAddr(0)), c.getCursorLocation());

		runSwing(() -> tool.showComponentProvider(plugin.getProvider(), false));
		waitForSwing();

		// now remove the block
		txSwing(() -> {
			MemoryBlock block = memory.getBlock(getAddr(0));
			memory.removeBlock(block, TaskMonitor.DUMMY);
		});

		runSwing(() -> tool.showComponentProvider(plugin.getProvider(), true));
		waitForSwing();

		c = panel.getCurrentComponent();
		Address addr = cbPlugin.getCurrentAddress();
		assertEquals(getFieldLocation(addr), c.getCursorLocation());
	}
Test editing in the Byte Viewer.
Ghidra/Features/ByteViewer/src/test.slow/java/ghidra/app/plugin/core/byteviewer/ByteViewerPlugin2Test.java