void () { // need to be physical file VirtualFile vf = VfsTestUtil.createFile(getSourceRoot(), "x.txt", "blah"); RangeMarkerImpl m = (RangeMarkerImpl)LazyRangeMarkerFactory.getInstance(getProject()).createRangeMarker(vf, 1); assertNull(m.getCachedDocument()); getProject().getMessageBus().connect(getTestRootDisposable()).subscribe(PsiDocumentListener.TOPIC, (doc, __, ___) -> { if (vf.equals(FileDocumentManager.getInstance().getFile(doc))) { fail("document created"); } }); m.dispose(); }