Example usage for com.intellij.openapi.ui Messages setTestInputDialog

List of usage examples for com.intellij.openapi.ui Messages setTestInputDialog

Introduction

In this page you can find the example usage for com.intellij.openapi.ui Messages setTestInputDialog.

Prototype

@TestOnly
    public static TestInputDialog setTestInputDialog(TestInputDialog newValue) 

Source Link

Usage

From source file:org.intellij.xquery.runner.ui.run.main.variables.ContextItemPanelGuiTest.java

License:Apache License

@Test
public void shouldShowDialogAfterEditorContextButtonClickedAndSetValue() {
    final String myValue = "my Content";
    final boolean[] dialogShown = { false };
    initPanel(true, null, null, true, null);
    TestInputDialog oldDialog = Messages.setTestInputDialog(new TestInputDialog() {
        @Override//from w w w .  jav  a  2 s .c om
        public String show(String message) {
            dialogShown[0] = true;
            return myValue;
        }
    });

    window.button(SHOW_EDITOR_BUTTON).click();

    assertThat(dialogShown[0], is(true));
    assertThat(panel.getContextItemEditorContent(), is(myValue));
    Messages.setTestInputDialog(oldDialog);
}