Search in sources :

Example 1 with IdeInfo

use of com.android.tools.idea.IdeInfo in project android by JetBrains.

the class UnresolvedDependenciesReporterTest method testReportWithConstraintLayout.

public void testReportWithConstraintLayout() throws Exception {
    myOriginalIdeInfo = IdeInfo.getInstance();
    IdeInfo ideInfo = IdeComponents.replaceServiceWithMock(IdeInfo.class);
    when(ideInfo.isAndroidStudio()).thenReturn(true);
    loadSimpleApplication();
    mySyncMessagesStub.clearReportedMessages();
    Module appModule = myModules.getAppModule();
    when(mySyncIssue.getData()).thenReturn("com.android.support.constraint:constraint-layout:+");
    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.constraint:constraint-layout:+", 0);
    // @formatter:on
    List<NotificationHyperlink> quickFixes = message.getQuickFixes();
    assertThat(quickFixes).hasSize(2);
}
Also used : SyncMessage(com.android.tools.idea.gradle.project.sync.messages.SyncMessage) IdeInfo(com.android.tools.idea.IdeInfo) Module(com.intellij.openapi.module.Module) NotificationHyperlink(com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink)

Aggregations

IdeInfo (com.android.tools.idea.IdeInfo)1 NotificationHyperlink (com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink)1 SyncMessage (com.android.tools.idea.gradle.project.sync.messages.SyncMessage)1 Module (com.intellij.openapi.module.Module)1