@Test
	public void testWriteEmuMemoryNoThreadErr() throws Throwable {
		/**
		 * TODO: It'd be nice if this worked, since memory edits don't really require a thread
		 * context. That would require some changes in the TraceSchedule and its execution. IINM,
		 * each step currently requires a thread. We'd have to relax that for patch steps, and it'd
		 * only work if they don't refer to any register.
		 */
		createAndOpenTrace();
		activateTrace();

		controlService.setCurrentMode(tb.trace, ControlMode.RW_EMULATOR);

		StateEditor editor = createStateEditor();
		assertFalse(editor.isVariableEditable(tb.addr(0x00400000), 4));
		expecting(IllegalArgumentException.class, () -> {
			waitOn(editor.setVariable(tb.addr(0x00400000), tb.arr(1, 2, 3, 4)));
		});
	}
Verify that the given action (usually a lambda) throws an exception

<p>
This fulfills the same use case as the {@link Test#expected()} attribute, but allows more
precise verification of which code in the test causes the exception.
Ghidra/Test/DebuggerIntegrationTest/src/test/java/ghidra/app/plugin/core/debug/service/control/DebuggerControlServiceTest.java