void (String codeBefore, String expectedCodeAfter, final int option) { configureCode(codeBefore); UnwrapHandler h = new UnwrapHandler() { @Override protected void selectOption(List<? extends MyUnwrapAction> options, Editor editor, PsiFile file) { if (options.isEmpty()) return; options.get(option).perform(); } }; h.invoke(getProject(), getEditor(), getFile()); checkResultByText(createCode(expectedCodeAfter)); }