Search in sources :

Example 1 with NotificationMessage

use of com.android.tools.idea.gradle.project.AndroidGradleNotificationStub.NotificationMessage 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());
}
Also used : NotificationMessage(com.android.tools.idea.gradle.project.AndroidGradleNotificationStub.NotificationMessage) File(java.io.File) NotificationHyperlink(com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink)

Example 2 with NotificationMessage

use of com.android.tools.idea.gradle.project.AndroidGradleNotificationStub.NotificationMessage 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());
}
Also used : NotificationMessage(com.android.tools.idea.gradle.project.AndroidGradleNotificationStub.NotificationMessage) NotificationHyperlink(com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink)

Aggregations

NotificationMessage (com.android.tools.idea.gradle.project.AndroidGradleNotificationStub.NotificationMessage)2 NotificationHyperlink (com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink)2 File (java.io.File)1