use of com.android.tools.idea.gradle.project.sync.compatibility.version.ComponentVersionReader in project android by JetBrains.
the class VersionIncompatibilityTest method testReportMessagesWithWarning.
public void testReportMessagesWithWarning() throws Exception {
loadSimpleApplication();
mySyncMessagesStub.clearReportedMessages();
Module appModule = myModules.getAppModule();
Component base = new Component("android-gradle-plugin", "2.1.3", null);
Pair<ComponentVersionReader, String> baseReaderAndVersion = Pair.create(ANDROID_GRADLE_PLUGIN, "2.1.3");
String failureMessage = "Wrong Gradle version";
Component requirement = new Component("gradle", "2.14.1", failureMessage);
base.addRequirement(requirement);
CompatibilityCheck check = new CompatibilityCheck(base, WARNING);
VersionIncompatibility incompatibility = new VersionIncompatibility(appModule, check, baseReaderAndVersion, requirement, GRADLE);
incompatibility.reportMessages(getProject());
SyncMessage message = mySyncMessagesStub.getFirstReportedMessage();
assertNotNull(message);
assertThat(message.getText()).hasLength(2);
// @formatter:off
assertAbout(syncMessage()).that(message).hasType(WARNING).hasMessageLine("Android Gradle plugin 2.1.3 requires Gradle 2.14.1 (or newer)", 0).hasMessageLine(failureMessage, 1);
// @formatter:on
}
Aggregations