Search in sources :

Example 1 with NotificationUpdate

use of com.android.tools.idea.gradle.project.sync.messages.SyncMessagesStub.NotificationUpdate in project android by JetBrains.

the class ClassLoadingErrorHandlerTest method assertErrorAndHyperlinksDisplayed.

private void assertErrorAndHyperlinksDisplayed(@NotNull Throwable cause) throws Exception {
    registerSyncErrorToSimulate(cause);
    loadProjectAndExpectSyncError(SIMPLE_APPLICATION);
    NotificationUpdate notificationUpdate = mySyncMessagesStub.getNotificationUpdate();
    assertNotNull(notificationUpdate);
    String message = notificationUpdate.getText();
    assertThat(message).contains("Some versions of JDK 1.7 (e.g. 1.7.0_10) may cause class loading errors in Gradle");
    assertThat(message).contains("Re-download dependencies and sync project");
    assertThat(message).contains("In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.");
    boolean restartCapable = ApplicationManager.getApplication().isRestartCapable();
    String quickFixText = restartCapable ? "Stop Gradle build processes (requires restart)" : "Open Gradle Daemon documentation";
    assertTrue(message.contains(quickFixText));
    // Verify hyperlinks are correct.
    List<NotificationHyperlink> quickFixes = notificationUpdate.getFixes();
    assertThat(quickFixes).hasSize(2);
    NotificationHyperlink quickFix = quickFixes.get(0);
    assertThat(quickFix).isInstanceOf(SyncProjectWithExtraCommandLineOptionsHyperlink.class);
    quickFix = quickFixes.get(1);
    assertThat(quickFix).isInstanceOf(OpenUrlHyperlink.class);
}
Also used : NotificationUpdate(com.android.tools.idea.gradle.project.sync.messages.SyncMessagesStub.NotificationUpdate) NotificationHyperlink(com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink)

Aggregations

NotificationHyperlink (com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink)1 NotificationUpdate (com.android.tools.idea.gradle.project.sync.messages.SyncMessagesStub.NotificationUpdate)1