use of com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink in project android by JetBrains.
the class AndroidGradlePluginVersionReaderTest method testGetQuickFixes.
public void testGetQuickFixes() throws Exception {
loadSimpleApplication();
Module appModule = myModules.getAppModule();
List<NotificationHyperlink> quickFixes = myVersionReader.getQuickFixes(appModule, VersionRange.parse("[1.2.0, +)"), null);
assertThat(quickFixes).hasSize(2);
NotificationHyperlink quickFix = quickFixes.get(0);
assertThat(quickFix).isInstanceOf(FixAndroidGradlePluginVersionHyperlink.class);
FixAndroidGradlePluginVersionHyperlink fixAndroidGradlePluginQuickFix = (FixAndroidGradlePluginVersionHyperlink) quickFix;
assertEquals(BuildEnvironment.getInstance().getGradlePluginVersion(), 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 AndroidGradleExperimentalPluginVersionReaderTest method testGetQuickFixes.
public void testGetQuickFixes() throws Exception {
loadSimpleApplication();
Module appModule = myModules.getAppModule();
List<NotificationHyperlink> quickFixes = myVersionReader.getQuickFixes(appModule, VersionRange.parse("[1.2.0, +)"), null);
assertThat(quickFixes).isEmpty();
}
use of com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink in project android by JetBrains.
the class FailedToParseSdkErrorHandlerTest method testHandleErrorWithBrokenSdkAndNoWriteAccess.
public void testHandleErrorWithBrokenSdkAndNoWriteAccess() throws Exception {
File sdkPath = new File("/path/to/sdk/home") {
@Override
public boolean canWrite() {
return false;
}
};
when(myAndroidSdks.findPathOfSdkWithoutAddonsFolder(getProject())).thenReturn(sdkPath);
Throwable cause = new RuntimeException("failed to parse SDK");
registerSyncErrorToSimulate(cause);
loadProjectAndExpectSyncError(SIMPLE_APPLICATION);
SyncMessagesStub.NotificationUpdate notificationUpdate = mySyncMessagesStub.getNotificationUpdate();
assertNotNull(notificationUpdate);
assertThat(notificationUpdate.getText()).isEqualTo("The directory 'add-ons', in the Android SDK at '/path/to/sdk/home', is either missing or empty\n\nCurrent user (" + getUserName() + ") does not have write access to the SDK directory.");
// Verify hyperlinks are correct.
List<NotificationHyperlink> quickFixes = notificationUpdate.getFixes();
assertThat(quickFixes).hasSize(0);
}
use of com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink in project android by JetBrains.
the class SdkToolsVersionSetupStepTest method testSetUpProject.
public void testSetUpProject() {
when(myIdeSdks.getAndroidSdkPath()).thenReturn(new File("fakePath"));
mySetupStep.setUpProject(getProject(), null);
List<NotificationMessage> messages = myNotification.getMessages();
assertThat(messages).hasSize(1);
NotificationMessage message = messages.get(0);
assertEquals("Android SDK Tools", message.getTitle());
assertEquals("Version " + MIN_TOOLS_REV + " or later is required.", message.getText());
assertEquals(INFORMATION, message.getType());
NotificationHyperlink[] hyperlinks = message.getHyperlinks();
assertThat(hyperlinks).hasLength(1);
NotificationHyperlink hyperlink = hyperlinks[0];
assertThat(hyperlink).isInstanceOf(InstallSdkToolsHyperlink.class);
assertEquals(MIN_TOOLS_REV, ((InstallSdkToolsHyperlink) hyperlink).getVersion());
assertTrue(mySetupStep.isNewSdkVersionToolsInfoAlreadyShown());
}
use of com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink in project android by JetBrains.
the class ExpiredPreviewBuildSetupStepIdeaTest method testSetUpProjectWithExpiredPreview.
public void testSetUpProjectWithExpiredPreview() {
when(myApplicationInfo.getFullVersion()).thenReturn("1.2 Preview");
when(myApplicationInfo.getBuildDate()).thenReturn(simulateExpiredBuildDate());
mySetupStep.setUpProject(getProject(), null);
List<NotificationMessage> messages = myNotification.getMessages();
assertThat(messages).hasSize(1);
NotificationMessage message = messages.get(0);
assertEquals("Old Preview Build", message.getTitle());
assertEquals("This preview build (1.2 Preview) is old; please update to a newer preview or a stable version.", message.getText());
assertEquals(INFORMATION, message.getType());
NotificationHyperlink[] hyperlinks = message.getHyperlinks();
assertThat(hyperlinks).hasLength(1);
NotificationHyperlink hyperlink = hyperlinks[0];
assertThat(hyperlink).isInstanceOf(OpenUrlHyperlink.class);
assertTrue(mySetupStep.isExpirationChecked());
}
Aggregations