use of com.intellij.openapi.ui.TestInputDialog in project intellij-community by JetBrains.
the class RenameModuleTest method testRename.
public void testRename() throws Exception {
String moduleName = "module";
String newModuleName = "moduleA";
Module module = createModule(moduleName);
assertEquals(moduleName, module.getName());
MapDataContext context = new MapDataContext();
context.put(LangDataKeys.MODULE_CONTEXT, module);
final RenameHandler renameHandler = RenameHandlerRegistry.getInstance().getRenameHandler(context);
assertNotNull(renameHandler);
Messages.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(newModuleName);
assertTrue(canClose);
return newModuleName;
}
});
renameHandler.invoke(myProject, PsiElement.EMPTY_ARRAY, context);
assertEquals(newModuleName, module.getName());
}
Aggregations