use of com.android.tools.idea.gradle.project.model.JavaModuleModel in project android by JetBrains.
the class JavaFacetModuleSetupStepTest method testDoSetUpModuleWithoutGradleFacet.
public void testDoSetUpModuleWithoutGradleFacet() throws IOException {
File buildFolderPath = createTempDir("build", true);
boolean buildable = true;
JavaModuleModel javaModel = mock(JavaModuleModel.class);
when(javaModel.getBuildFolderPath()).thenReturn(buildFolderPath);
when(javaModel.isBuildable()).thenReturn(buildable);
Module module = getModule();
mySetupStep.doSetUpModule(module, myModelsProvider, javaModel, null, null);
ApplicationManager.getApplication().runWriteAction(() -> myModelsProvider.commit());
JavaFacet facet = findJavaFacet(module);
assertNotNull(facet);
assertNull(facet.getJavaModuleModel());
}
use of com.android.tools.idea.gradle.project.model.JavaModuleModel in project android by JetBrains.
the class JavaFacetModuleSetupStepTest method testDoSetUpModuleWithExistingJavaFacet.
public void testDoSetUpModuleWithExistingJavaFacet() throws IOException {
createAndAddGradleFacet(getModule());
JavaFacet facet = createAndAddJavaFacet(getModule());
File buildFolderPath = createTempDir("build", true);
boolean buildable = true;
JavaModuleModel javaModel = mock(JavaModuleModel.class);
when(javaModel.getBuildFolderPath()).thenReturn(buildFolderPath);
when(javaModel.isBuildable()).thenReturn(buildable);
Module module = getModule();
mySetupStep.doSetUpModule(module, myModelsProvider, javaModel, null, null);
ApplicationManager.getApplication().runWriteAction(() -> myModelsProvider.commit());
// JavaFacet should be reused.
assertSame(facet, findJavaFacet(module));
verifyFacetConfiguration(facet, javaModel, buildFolderPath, buildable);
}
Aggregations