void () { final boolean [] fileWasDeleted = new boolean[]{false}; final VirtualFileListener fileAdapter = new VirtualFileListener() { @Override public void fileDeleted(@NotNull VirtualFileEvent event) { fileWasDeleted[0] = !event.getFile().isDirectory(); } }; VirtualFileManager.getInstance().addVirtualFileListener(fileAdapter); try { doTest(createAction("pack1", "target")); } finally { VirtualFileManager.getInstance().removeVirtualFileListener(fileAdapter); } Assert.assertFalse("Deleted instead of moved", fileWasDeleted[0]); }