use of com.android.tools.idea.gradle.project.model.GradleModuleModel in project android by JetBrains.
the class GradleModuleSetupTest method testSetUpModule.
public void testSetUpModule() {
when(myModuleModels.getModule()).thenReturn(myModuleModel);
when(myModuleModels.findModel(BuildScriptClasspathModel.class)).thenReturn(myClasspathModel);
String gradleVersion = "2.14.1";
when(myClasspathModel.getGradleVersion()).thenReturn(gradleVersion);
myModuleSetup.setUpModule(myModule, myModelsProvider, myModuleModels);
// Apply changes to verify state.
ApplicationManager.getApplication().runWriteAction(() -> myModelsProvider.commit());
GradleFacet facet = findFacet(myModule, myModelsProvider, GradleFacet.getFacetTypeId());
assertNotNull(facet);
GradleModuleModel gradleModuleModel = facet.getGradleModuleModel();
assertNotNull(gradleModuleModel);
assertEquals(":app", gradleModuleModel.getGradlePath());
assertEquals(gradleVersion, gradleModuleModel.getGradleVersion());
File buildFilePath = myModuleModel.getGradleProject().getBuildScript().getSourceFile();
assertAbout(file()).that(gradleModuleModel.getBuildFilePath()).isEquivalentAccordingToCompareTo(buildFilePath);
GradleVersion actualGradleVersion = mySyncSummary.getGradleVersion();
assertNotNull(actualGradleVersion);
assertEquals(gradleVersion, actualGradleVersion.toString());
}
Aggregations