use of com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink in project android by JetBrains.
the class Gradle2RequiredErrorHandlerTest method testHandleError.
public void testHandleError() throws Exception {
registerSyncErrorToSimulate("Wrong gradle version.\norg/codehaus/groovy/runtime/typehandling/ShortTypeHandling");
loadProjectAndExpectSyncError(SIMPLE_APPLICATION);
SyncMessagesStub.NotificationUpdate notificationUpdate = mySyncMessagesStub.getNotificationUpdate();
assertNotNull(notificationUpdate);
assertThat(notificationUpdate.getText()).contains("Gradle " + SdkConstants.GRADLE_MINIMUM_VERSION + " is required.");
// Verify hyperlinks are correct.
List<NotificationHyperlink> quickFixes = notificationUpdate.getFixes();
assertThat(quickFixes).hasSize(1);
NotificationHyperlink quickFix = quickFixes.get(0);
assertThat(quickFix).isInstanceOf(CreateGradleWrapperHyperlink.class);
}
use of com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink in project android by JetBrains.
the class GradleBrokenPipeErrorHandlerTest method testHandleError.
public void testHandleError() throws Exception {
registerSyncErrorToSimulate("Broken pipe");
loadProjectAndExpectSyncError(SIMPLE_APPLICATION);
SyncMessagesStub.NotificationUpdate notificationUpdate = mySyncMessagesStub.getNotificationUpdate();
assertNotNull(notificationUpdate);
String expectedNotificationMessage = "Broken pipe.\nThe Gradle daemon may be trying to use ipv4 instead of ipv6.";
assertThat(notificationUpdate.getText()).contains(expectedNotificationMessage);
List<NotificationHyperlink> quickFixes = notificationUpdate.getFixes();
assertThat(quickFixes).hasSize(1);
// Verify hyperlinks are correct.
NotificationHyperlink quickFix = quickFixes.get(0);
assertThat(quickFix).isInstanceOf(OpenUrlHyperlink.class);
}
use of com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink in project android by JetBrains.
the class AndroidGradleExperimentalPluginVersionReaderTest method testGetQuickFixesWithExperimentalPlugin.
public void testGetQuickFixesWithExperimentalPlugin() throws Exception {
loadProject(EXPERIMENTAL_PLUGIN);
Module appModule = myModules.getAppModule();
List<NotificationHyperlink> quickFixes = myVersionReader.getQuickFixes(appModule, VersionRange.parse("[0.7.0, +)"), null);
assertThat(quickFixes).hasSize(2);
NotificationHyperlink quickFix = quickFixes.get(0);
assertThat(quickFix).isInstanceOf(FixAndroidGradlePluginVersionHyperlink.class);
FixAndroidGradlePluginVersionHyperlink fixAndroidGradlePluginQuickFix = (FixAndroidGradlePluginVersionHyperlink) quickFix;
assertEquals(BuildEnvironment.getInstance().getExperimentalPluginVersion(), fixAndroidGradlePluginQuickFix.getPluginVersion().toString());
quickFix = quickFixes.get(1);
assertThat(quickFix).isInstanceOf(OpenUrlHyperlink.class);
OpenUrlHyperlink openUrlQuickFix = (OpenUrlHyperlink) quickFix;
assertEquals("https://developer.android.com/studio/releases/gradle-plugin.html#updating-gradle", openUrlQuickFix.getUrl());
}
use of com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink in project android by JetBrains.
the class AndroidGradlePluginVersionReaderTest method testGetQuickFixesWithExperimentalPlugin.
public void testGetQuickFixesWithExperimentalPlugin() throws Exception {
loadProject(EXPERIMENTAL_PLUGIN);
Module appModule = myModules.getAppModule();
List<NotificationHyperlink> quickFixes = myVersionReader.getQuickFixes(appModule, VersionRange.parse("[0.7.0, +)"), null);
assertThat(quickFixes).isEmpty();
}
use of com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink in project android by JetBrains.
the class AndroidGradleNotification method addHyperlinksToText.
@NotNull
private static String addHyperlinksToText(@NotNull String text, @NotNull NotificationHyperlink... hyperlinks) {
// 'Event Log' tool window, which respects "\n".)
if (hyperlinks.length == 0) {
return text;
}
StringBuilder b = new StringBuilder();
b.append(text);
for (NotificationHyperlink hyperlink : hyperlinks) {
b.append("<br>\n").append(hyperlink.toHtml());
}
return b.toString();
}
Aggregations