void (String code, String... expectedOptions) { configureCode(code); final List<String> actualOptions = new ArrayList<>(); UnwrapHandler h = new UnwrapHandler() { @Override protected void selectOption(List<? extends MyUnwrapAction> options, Editor editor, PsiFile file) { for (AnAction each : options) { actualOptions.add(each.getTemplatePresentation().getText()); } } }; h.invoke(getProject(), getEditor(), getFile()); //noinspection MisorderedAssertEqualsArguments assertEquals(Arrays.asList(expectedOptions), actualOptions); }