Search in sources :

Example 1 with ExpectedModuleDependency

use of com.android.tools.idea.gradle.project.sync.ExpectedModuleDependency in project android by JetBrains.

the class DependenciesModuleSetupStepTest method testSetUpModuleDependency.

public void testSetUpModuleDependency() {
    String moduleName = "lib";
    // This is the module to add as dependency.
    Module libModule = createModule(moduleName);
    JavaModuleDependency moduleDependency = new JavaModuleDependency(moduleName, "compile", true);
    Collection<JavaModuleDependency> moduleDependencies = new ArrayList<>();
    moduleDependencies.add(moduleDependency);
    // We only want module dependencies
    when(myJavaModuleModel.getJavaModuleDependencies()).thenReturn(moduleDependencies);
    when(myJavaModuleModel.getJarLibraryDependencies()).thenReturn(Collections.emptyList());
    Module mainModule = getModule();
    mySetupStep.setUpModule(mainModule, myModelsProvider, myJavaModuleModel, null, null);
    // needed to check if the module dependency was added.
    ApplicationManager.getApplication().runWriteAction(() -> myModelsProvider.commit());
    // See https://code.google.com/p/android/issues/detail?id=225923
    ExpectedModuleDependency expected = new ExpectedModuleDependency(libModule, COMPILE, true);
    assertAbout(moduleDependencies()).that(mainModule).contains(expected);
}
Also used : ExpectedModuleDependency(com.android.tools.idea.gradle.project.sync.ExpectedModuleDependency) ArrayList(java.util.ArrayList) Module(com.intellij.openapi.module.Module) JavaModuleDependency(com.android.tools.idea.gradle.model.java.JavaModuleDependency)

Aggregations

JavaModuleDependency (com.android.tools.idea.gradle.model.java.JavaModuleDependency)1 ExpectedModuleDependency (com.android.tools.idea.gradle.project.sync.ExpectedModuleDependency)1 Module (com.intellij.openapi.module.Module)1 ArrayList (java.util.ArrayList)1