void (int offset) { String text = myFixture.getEditor().getDocument().getText(); try { myFixture.getEditor().getCaretModel().moveToOffset(offset); myFixture.type("y"); } catch (RuntimeException e) { assertEquals("Unable to perform an action since it changes read-only fragments of the current document",e.getMessage()); assertEquals(text, myFixture.getEditor().getDocument().getText()); return; } fail("must be read only at "+offset); }