@Test
	public void testSetSelection() throws Exception {
		loadViews("Ascii", "Octal");

		final FieldSelection fsel = new FieldSelection();
		fsel.addRange(0, 0, 8, 7);

		ByteViewerComponent ascii = getView("Ascii");
		setView(ascii);
		runSwing(() -> {
			ascii.selectionChanged(fsel, EventTrigger.GUI_ACTION);
		});

		ByteBlockSelection sel = ascii.getViewerSelection();

		ByteViewerComponent octal = getView("Octal");
		assertTrue(byteBlockSelectionEquals(sel, octal.getViewerSelection()));

		ProgramSelection psel = cbPlugin.getCurrentSelection();
		ByteBlockSelection bsel = panel.getViewerSelection();

		// convert bsel to an address set
		AddressSet set =
			((ProgramByteBlockSet) plugin.getProvider().getByteBlockSet()).getAddressSet(bsel);

		// subtract one address from code browser selection since it is on
		// a code unit boundary
		psel = new ProgramSelection(psel.subtract(new AddressSet(addr(0x01001087))));
		assertTrue(psel.hasSameAddresses(set));
	}
Basic tests for the byte view plugin
Ghidra/Features/ByteViewer/src/test.slow/java/ghidra/app/plugin/core/byteviewer/ByteViewerPlugin1Test.java