void (RenameHandler renameHandler, String newName, DataContext context) { TestDialogManager.setTestInputDialog(new TestInputDialog() { @Override public String show(String message) { return null; } @Override public String show(String message, @Nullable InputValidator validator) { assertNotNull(validator); boolean canClose = validator.canClose(newName); assertTrue(canClose); return newName; } }); renameHandler.invoke(myProject, PsiElement.EMPTY_ARRAY, context); }