@Test
	public void testEditModeHexInteger() throws Exception {
		env.showTool();
		addViews();

		ByteViewerComponent c = findComponent(panel, "Hex Integer");
		panel.setCurrentView(c);

		ToggleDockingAction action =
			(ToggleDockingAction) getAction(plugin, "Enable/Disable Byteviewer Editing");
		FieldLocation loc = getFieldLocation(getAddr(0x01001003));
		runSwing(() -> {
			ByteViewerComponent currentComponent = panel.getCurrentComponent();
			currentComponent.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
			action.setSelected(true);
			action.actionPerformed(new DefaultActionContext());
		});
		assertTrue(action.isSelected());
		assertEquals(ByteViewerComponentProvider.CHANGED_VALUE_COLOR, c.getFocusedCursorColor());

		runSwing(() -> {
			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());
		});
		program.flushEvents();
		assertEquals((byte) 0x10, program.getMemory().getByte(getAddr(0x01001003)));
		assertEquals(ByteViewerComponentProvider.CHANGED_VALUE_COLOR,
			((ByteField) c.getCurrentField()).getForeground());

		runSwing(() -> {
			action.setSelected(false);
			action.actionPerformed(new DefaultActionContext());
		});
		assertFalse(action.isSelected());
		assertEquals(ByteViewerComponentProvider.CURSOR_ACTIVE_COLOR,
			c.getFocusedCursorColor());
	}
Test editing in the Byte Viewer.
Ghidra/Features/ByteViewer/src/test.slow/java/ghidra/app/plugin/core/byteviewer/ByteViewerPlugin2Test.java