use of com.android.tools.idea.gradle.project.sync.hyperlink.InstallRepositoryHyperlink in project android by JetBrains.
the class UnresolvedDependenciesReporterTest method testReportWithPlayServices.
public void testReportWithPlayServices() throws Exception {
loadSimpleApplication();
mySyncMessagesStub.clearReportedMessages();
Module appModule = myModules.getAppModule();
when(mySyncIssue.getData()).thenReturn("com.google.android.gms:play-services:9.4.0");
myReporter.report(mySyncIssue, appModule, null);
SyncMessage message = mySyncMessagesStub.getFirstReportedMessage();
assertNotNull(message);
// @formatter:off
assertAbout(syncMessage()).that(message).hasGroup("Unresolved Android dependencies").hasMessageLine("Failed to resolve: com.google.android.gms:play-services:9.4.0", 0);
// @formatter:on
List<NotificationHyperlink> quickFixes = message.getQuickFixes();
int expectedSize = IdeInfo.getInstance().isAndroidStudio() ? 2 : 1;
assertThat(quickFixes).hasSize(expectedSize);
NotificationHyperlink quickFix = quickFixes.get(0);
assertThat(quickFix).isInstanceOf(InstallRepositoryHyperlink.class);
InstallRepositoryHyperlink hyperlink = (InstallRepositoryHyperlink) quickFix;
assertSame(GOOGLE, hyperlink.getRepository());
if (IdeInfo.getInstance().isAndroidStudio()) {
quickFix = quickFixes.get(1);
assertThat(quickFix).isInstanceOf(ShowDependencyInProjectStructureHyperlink.class);
}
}
use of com.android.tools.idea.gradle.project.sync.hyperlink.InstallRepositoryHyperlink in project android by JetBrains.
the class UnresolvedDependenciesReporterTest method testReportWithAppCompat.
public void testReportWithAppCompat() throws Exception {
loadSimpleApplication();
mySyncMessagesStub.clearReportedMessages();
Module appModule = myModules.getAppModule();
when(mySyncIssue.getData()).thenReturn("com.android.support:appcompat-v7:24.1.1");
myReporter.report(mySyncIssue, appModule, null);
SyncMessage message = mySyncMessagesStub.getFirstReportedMessage();
assertNotNull(message);
// @formatter:off
assertAbout(syncMessage()).that(message).hasGroup("Unresolved Android dependencies").hasMessageLine("Failed to resolve: com.android.support:appcompat-v7:24.1.1", 0);
// @formatter:on
List<NotificationHyperlink> quickFixes = message.getQuickFixes();
int expectedSize = IdeInfo.getInstance().isAndroidStudio() ? 2 : 1;
assertThat(quickFixes).hasSize(expectedSize);
NotificationHyperlink quickFix = quickFixes.get(0);
assertThat(quickFix).isInstanceOf(InstallRepositoryHyperlink.class);
InstallRepositoryHyperlink hyperlink = (InstallRepositoryHyperlink) quickFix;
assertSame(ANDROID, hyperlink.getRepository());
if (IdeInfo.getInstance().isAndroidStudio()) {
quickFix = quickFixes.get(1);
assertThat(quickFix).isInstanceOf(ShowDependencyInProjectStructureHyperlink.class);
}
}
Aggregations