use of com.android.tools.idea.gradle.dsl.model.dependencies.ExpectedModuleDependency in project android by JetBrains.
the class AddGradleDependencyTest method testAddTestModuleDependency.
@RunIn(TestGroup.UNRELIABLE)
@Test
public void testAddTestModuleDependency() throws IOException {
guiTest.importProjectAndWaitForProjectSyncToFinish("MultiModule");
EditorFixture editor = guiTest.ideFrame().getEditor().open("app/src/androidTest/java/com/android/multimodule/ApplicationTest.java");
String classToImport = "com.example.MyLibrary";
addImport(editor, classToImport);
editor.waitForCodeAnalysisHighlightCount(ERROR, 1);
moveCaretToClassName(editor, classToImport);
editor.invokeQuickfixAction("Add dependency on module 'library3'");
guiTest.ideFrame().waitForGradleProjectSyncToFinish();
editor.waitForCodeAnalysisHighlightCount(ERROR, 0);
ExpectedModuleDependency dependencyOnLibrary3 = new ExpectedModuleDependency();
dependencyOnLibrary3.configurationName = ANDROID_TEST_COMPILE;
dependencyOnLibrary3.path = ":library3";
GradleBuildModelFixture buildModel = guiTest.ideFrame().parseBuildFileForModule("app");
buildModel.requireDependency(dependencyOnLibrary3);
verifyUndo(editor, 1);
}
use of com.android.tools.idea.gradle.dsl.model.dependencies.ExpectedModuleDependency in project android by JetBrains.
the class AddGradleDependencyTest method testAddProdModuleDependency.
@RunIn(TestGroup.UNRELIABLE)
@Test
public void testAddProdModuleDependency() throws IOException {
guiTest.importProjectAndWaitForProjectSyncToFinish("MultiModule");
EditorFixture editor = guiTest.ideFrame().getEditor().open("app/src/main/java/com/android/multimodule/MainActivity.java");
String classToImport = "com.example.MyLibrary";
addImport(editor, classToImport);
editor.waitForCodeAnalysisHighlightCount(ERROR, 1);
moveCaretToClassName(editor, classToImport);
editor.invokeQuickfixAction("Add dependency on module 'library3'");
guiTest.ideFrame().waitForGradleProjectSyncToFinish();
editor.waitForCodeAnalysisHighlightCount(ERROR, 0);
ExpectedModuleDependency dependencyOnLibrary3 = new ExpectedModuleDependency();
dependencyOnLibrary3.configurationName = COMPILE;
dependencyOnLibrary3.path = ":library3";
GradleBuildModelFixture buildModel = guiTest.ideFrame().parseBuildFileForModule("app");
buildModel.requireDependency(dependencyOnLibrary3);
verifyUndo(editor, 1);
}
use of com.android.tools.idea.gradle.dsl.model.dependencies.ExpectedModuleDependency in project android by JetBrains.
the class GradleRenameModuleTest method testRenameModuleAlsoChangeReferencesInBuildFile.
@Test
public void testRenameModuleAlsoChangeReferencesInBuildFile() throws IOException {
guiTest.importMultiModule();
ProjectViewFixture.PaneFixture paneFixture = guiTest.ideFrame().getProjectView().selectProjectPane();
paneFixture.selectByPath("MultiModule", "library");
invokeRefactor();
SelectRefactoringDialogFixture selectRefactoringDialog = SelectRefactoringDialogFixture.findByTitle(guiTest.robot());
selectRefactoringDialog.selectRenameModule();
selectRefactoringDialog.clickOk();
InputDialogFixture renameModuleDialog = InputDialogFixture.findByTitle(guiTest.robot(), "Rename Module");
renameModuleDialog.enterTextAndClickOk("newLibrary");
guiTest.waitForBackgroundTasks();
assertThat(guiTest.ideFrame().hasModule("newLibrary")).named("newLibrary module exists").isTrue();
// app module has two references to library module
GradleBuildModelFixture buildModel = guiTest.ideFrame().parseBuildFileForModule("app");
ExpectedModuleDependency expected = new ExpectedModuleDependency();
expected.configurationName = "debugCompile";
expected.path = ":newLibrary";
buildModel.requireDependency(expected);
expected.configurationName = "releaseCompile";
buildModel.requireDependency(expected);
}
Aggregations