Java Code Examples for com.intellij.openapi.ui.Messages#setTestDialog()

The following examples show how to use com.intellij.openapi.ui.Messages#setTestDialog() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExternalSystemImportingTestCase.java    From intellij-quarkus with Eclipse Public License 2.0 5 votes vote down vote up
protected static AtomicInteger configConfirmationForYesAnswer() {
  final AtomicInteger counter = new AtomicInteger();
  Messages.setTestDialog(new TestDialog() {
    @Override
    public int show(String message) {
      counter.set(counter.get() + 1);
      return 0;
    }
  });
  return counter;
}
 
Example 2
Source File: ExternalSystemImportingTestCase.java    From intellij-quarkus with Eclipse Public License 2.0 5 votes vote down vote up
protected static AtomicInteger configConfirmationForNoAnswer() {
  final AtomicInteger counter = new AtomicInteger();
  Messages.setTestDialog(new TestDialog() {
    @Override
    public int show(String message) {
      counter.set(counter.get() + 1);
      return 1;
    }
  });
  return counter;
}
 
Example 3
Source File: MavenImportingTestCase.java    From intellij-quarkus with Eclipse Public License 2.0 5 votes vote down vote up
protected static AtomicInteger configConfirmationForYesAnswer() {
  final AtomicInteger counter = new AtomicInteger();
  Messages.setTestDialog(message -> {
    counter.getAndIncrement();
    return Messages.YES;
  });
  return counter;
}
 
Example 4
Source File: MavenImportingTestCase.java    From intellij-quarkus with Eclipse Public License 2.0 5 votes vote down vote up
protected static AtomicInteger configConfirmationForNoAnswer() {
  final AtomicInteger counter = new AtomicInteger();
  Messages.setTestDialog(message -> {
    counter.getAndIncrement();
    return Messages.NO;
  });
  return counter;
}
 
Example 5
Source File: PasswordMgtTests.java    From azure-devops-intellij with MIT License 5 votes vote down vote up
private static void verifyShowsMessage(String expectedMessage, int messageResult, Runnable action) {
    AtomicReference<String> messageShown = new AtomicReference<>();
    TestDialog oldTestDialog = Messages.setTestDialog(message -> {
        messageShown.set(message);
        return messageResult;
    });

    try {
        action.run();
        assertEquals("Message shown in dialog", expectedMessage, messageShown.get());
    } finally {
        Messages.setTestDialog(oldTestDialog);
    }
}
 
Example 6
Source File: PantsIntegrationTestCase.java    From intellij-pants-plugin with Apache License 2.0 5 votes vote down vote up
@Override
public void tearDown() throws Exception {
  // TODO thread leak either a IJ bug https://youtrack.jetbrains.com/issue/IDEA-155496
  // or a pants plugin bug https://github.com/pantsbuild/intellij-pants-plugin/issues/130
  // Temporarily ignore the following 'leaking' threads to pass CI.
  ThreadTracker.longRunningThreadCreated(
    ApplicationManager.getApplication(),
    "BaseDataReader",
    "ProcessWaitFor",
    "Timer",
    "FileBasedIndex"
  );
  if (myCompilerTester != null) {
    myCompilerTester.tearDown();
  }

  // Kill nailgun after usage as memory on travis is limited, at a cost of slower later builds.
  killNailgun();
  cleanProjectRoot();
  Messages.setTestDialog(TestDialog.DEFAULT);

  // TODO(cosmicexplorer): after updating from 172.4343.14 to 173.3531.6,
  // intellij's provided test class sometimes yells about a leaky jdk
  // table. i don't think this indicates any problems, so for now if tests
  // fail with leaky sdk errors, broaden this to include the leaked sdks.
  removeJdks(jdk -> jdk.getName().contains("pants"));
  super.tearDown();
}
 
Example 7
Source File: HaxeFindUsagesTest.java    From intellij-haxe with Apache License 2.0 4 votes vote down vote up
public void doOverrideTest(String testFile, TestDialog answer) throws Throwable {
  Messages.setTestDialog(answer);
  myFixture.configureByFiles(testFile, "com/bar/TestSearchOverrides.hx");
  myFixture.copyFileToProject(getResultsPath());
  compareExpectedUsages(findUsages());
}
 
Example 8
Source File: LombokLoggerActionTest.java    From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public void testLogSimple() throws Exception {
  Messages.setTestDialog(TestDialog.DEFAULT);
  doTest();
}
 
Example 9
Source File: LombokLoggerActionTest.java    From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public void testLogRename() throws Exception {
  Messages.setTestDialog(TestDialog.OK);
  doTest();
}
 
Example 10
Source File: LombokLoggerActionTest.java    From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public void testLogPublic() throws Exception {
  Messages.setTestDialog(TestDialog.OK);
  doTest();
}
 
Example 11
Source File: LombokLoggerActionTest.java    From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public void testLogNonStatic() throws Exception {
  Messages.setTestDialog(TestDialog.OK);
  doTest();
}
 
Example 12
Source File: LombokLoggerActionTest.java    From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public void testLogNonFinal() throws Exception {
  Messages.setTestDialog(TestDialog.OK);
  doTest();
}