Search in sources :

Example 1 with ModuleNodeBuilder

use of com.android.tools.idea.gradle.AndroidModelView.ModuleNodeBuilder in project android by JetBrains.

the class AndroidModelViewTest method testBuildTypesNodeCustomization.

public void testBuildTypesNodeCustomization() throws Exception {
    AndroidProject androidProject = mock(AndroidProject.class);
    BuildTypeContainer buildTypeContainer = mock(BuildTypeContainer.class);
    when(androidProject.getBuildTypes()).thenReturn(ImmutableList.of(createProxyInstance(BuildTypeContainer.class, buildTypeContainer)));
    BuildType buildtype = mock(BuildType.class);
    when(buildtype.getName()).thenReturn("dummyBuildType");
    when(buildTypeContainer.getBuildType()).thenReturn(createProxyInstance(BuildType.class, buildtype));
    SourceProvider mainSourceProvider = mock(SourceProvider.class);
    when(mainSourceProvider.getName()).thenReturn("dummySourceProvider");
    when(buildTypeContainer.getSourceProvider()).thenReturn(createProxyInstance(SourceProvider.class, mainSourceProvider));
    SourceProviderContainer extraSourceProviderContainer1 = mock(SourceProviderContainer.class);
    SourceProvider extraSourceProvider1 = mock(SourceProvider.class);
    when(extraSourceProvider1.getName()).thenReturn("extraSourceProvider1");
    when(extraSourceProviderContainer1.getSourceProvider()).thenReturn(createProxyInstance(SourceProvider.class, extraSourceProvider1));
    SourceProviderContainer extraSourceProviderContainer2 = mock(SourceProviderContainer.class);
    SourceProvider extraSourceProvider2 = mock(SourceProvider.class);
    when(extraSourceProvider2.getName()).thenReturn("extraSourceProvider2");
    when(extraSourceProviderContainer2.getSourceProvider()).thenReturn(createProxyInstance(SourceProvider.class, extraSourceProvider2));
    when(buildTypeContainer.getExtraSourceProviders()).thenReturn(ImmutableList.of(createProxyInstance(SourceProviderContainer.class, extraSourceProviderContainer1), createProxyInstance(SourceProviderContainer.class, extraSourceProviderContainer2)));
    AndroidProject reproxyProject = ProxyUtil.reproxy(AndroidProject.class, createProxyInstance(AndroidProject.class, androidProject));
    assertNotNull(reproxyProject);
    AndroidModuleModel androidModel = mock(AndroidModuleModel.class);
    when(androidModel.waitForAndGetProxyAndroidProject()).thenReturn(reproxyProject);
    ModuleNodeBuilder nodeBuilder = new ModuleNodeBuilder("test", androidModel, projectBasePath);
    DefaultMutableTreeNode node = nodeBuilder.getNode();
    assertTrue(node.getChildCount() > 0);
    DefaultMutableTreeNode buildTypesNode = (DefaultMutableTreeNode) node.getChildAt(node.getChildCount() - 1);
    assertEquals("BuildTypes", buildTypesNode.getUserObject().toString());
    assertEquals(1, buildTypesNode.getChildCount());
    DefaultMutableTreeNode buildTypeNode = (DefaultMutableTreeNode) buildTypesNode.getChildAt(0);
    assertEquals("dummyBuildType", buildTypeNode.getUserObject().toString());
    assertTrue(buildTypeNode.getChildCount() > 0);
    DefaultMutableTreeNode sourceProvidersNode = (DefaultMutableTreeNode) buildTypeNode.getChildAt(buildTypeNode.getChildCount() - 1);
    assertEquals("SourceProviders", sourceProvidersNode.getUserObject().toString());
    assertEquals(3, sourceProvidersNode.getChildCount());
    assertEquals("dummySourceProvider", ((DefaultMutableTreeNode) sourceProvidersNode.getChildAt(0)).getUserObject().toString());
    assertEquals("extraSourceProvider1", ((DefaultMutableTreeNode) sourceProvidersNode.getChildAt(1)).getUserObject().toString());
    assertEquals("extraSourceProvider2", ((DefaultMutableTreeNode) sourceProvidersNode.getChildAt(2)).getUserObject().toString());
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) ModuleNodeBuilder(com.android.tools.idea.gradle.AndroidModelView.ModuleNodeBuilder) AndroidModuleModel(com.android.tools.idea.gradle.project.model.AndroidModuleModel) AndroidProject(com.android.builder.model.AndroidProject)

Example 2 with ModuleNodeBuilder

use of com.android.tools.idea.gradle.AndroidModelView.ModuleNodeBuilder in project android by JetBrains.

the class AndroidModelViewTest method testDefaultConfigNodeCustomization.

public void testDefaultConfigNodeCustomization() throws Exception {
    AndroidProject androidProject = mock(AndroidProject.class);
    ProductFlavorContainer flavorContainer = mock(ProductFlavorContainer.class);
    when(androidProject.getDefaultConfig()).thenReturn(createProxyInstance(ProductFlavorContainer.class, flavorContainer));
    ProductFlavor flavor = mock(ProductFlavor.class);
    when(flavor.getName()).thenReturn("dummyFlavor");
    when(flavorContainer.getProductFlavor()).thenReturn(createProxyInstance(ProductFlavor.class, flavor));
    SourceProvider mainSourceProvider = mock(SourceProvider.class);
    when(mainSourceProvider.getName()).thenReturn("dummySourceProvider");
    when(flavorContainer.getSourceProvider()).thenReturn(createProxyInstance(SourceProvider.class, mainSourceProvider));
    SourceProviderContainer extraSourceProviderContainer1 = mock(SourceProviderContainer.class);
    SourceProvider extraSourceProvider1 = mock(SourceProvider.class);
    when(extraSourceProvider1.getName()).thenReturn("extraSourceProvider1");
    when(extraSourceProviderContainer1.getSourceProvider()).thenReturn(createProxyInstance(SourceProvider.class, extraSourceProvider1));
    SourceProviderContainer extraSourceProviderContainer2 = mock(SourceProviderContainer.class);
    SourceProvider extraSourceProvider2 = mock(SourceProvider.class);
    when(extraSourceProvider2.getName()).thenReturn("extraSourceProvider2");
    when(extraSourceProviderContainer2.getSourceProvider()).thenReturn(createProxyInstance(SourceProvider.class, extraSourceProvider2));
    when(flavorContainer.getExtraSourceProviders()).thenReturn(ImmutableList.of(createProxyInstance(SourceProviderContainer.class, extraSourceProviderContainer1), createProxyInstance(SourceProviderContainer.class, extraSourceProviderContainer2)));
    AndroidProject reproxyProject = ProxyUtil.reproxy(AndroidProject.class, createProxyInstance(AndroidProject.class, androidProject));
    assertNotNull(reproxyProject);
    AndroidModuleModel androidModel = mock(AndroidModuleModel.class);
    when(androidModel.waitForAndGetProxyAndroidProject()).thenReturn(reproxyProject);
    ModuleNodeBuilder nodeBuilder = new ModuleNodeBuilder("test", androidModel, projectBasePath);
    DefaultMutableTreeNode node = nodeBuilder.getNode();
    assertTrue(node.getChildCount() > 0);
    DefaultMutableTreeNode defaultConfigNode = (DefaultMutableTreeNode) node.getChildAt(node.getChildCount() - 1);
    assertEquals("DefaultConfig", defaultConfigNode.getUserObject().toString());
    assertTrue(defaultConfigNode.getChildCount() > 0);
    DefaultMutableTreeNode sourceProvidersNode = (DefaultMutableTreeNode) defaultConfigNode.getChildAt(defaultConfigNode.getChildCount() - 1);
    assertEquals("SourceProviders", sourceProvidersNode.getUserObject().toString());
    assertEquals(3, sourceProvidersNode.getChildCount());
    assertEquals("dummySourceProvider", ((DefaultMutableTreeNode) sourceProvidersNode.getChildAt(0)).getUserObject().toString());
    assertEquals("extraSourceProvider1", ((DefaultMutableTreeNode) sourceProvidersNode.getChildAt(1)).getUserObject().toString());
    assertEquals("extraSourceProvider2", ((DefaultMutableTreeNode) sourceProvidersNode.getChildAt(2)).getUserObject().toString());
    DefaultMutableTreeNode sdkVersionsNode = (DefaultMutableTreeNode) defaultConfigNode.getChildAt(defaultConfigNode.getChildCount() - 2);
    assertEquals("SdkVersions", sdkVersionsNode.getUserObject().toString());
    // Min, Max and Target Sdk versions.
    assertEquals(3, sdkVersionsNode.getChildCount());
    DefaultMutableTreeNode nameNode = null;
    for (int i = 0; i < defaultConfigNode.getChildCount(); i++) {
        DefaultMutableTreeNode child = (DefaultMutableTreeNode) defaultConfigNode.getChildAt(i);
        if (child.getUserObject().toString().startsWith("Name ->")) {
            nameNode = child;
            break;
        }
    }
    assertNotNull(nameNode);
    // Verifies that the flavor node is inlined under default config.
    assertEquals("Name -> dummyFlavor", nameNode.getUserObject().toString());
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) ModuleNodeBuilder(com.android.tools.idea.gradle.AndroidModelView.ModuleNodeBuilder) AndroidModuleModel(com.android.tools.idea.gradle.project.model.AndroidModuleModel) AndroidProject(com.android.builder.model.AndroidProject)

Example 3 with ModuleNodeBuilder

use of com.android.tools.idea.gradle.AndroidModelView.ModuleNodeBuilder in project android by JetBrains.

the class AndroidModelViewTest method testVariantsNodeCustomization.

public void testVariantsNodeCustomization() throws Exception {
    AndroidProject androidProject = mock(AndroidProject.class);
    Variant variant = mock(Variant.class);
    when(variant.getName()).thenReturn("dummyVariant");
    when(androidProject.getVariants()).thenReturn(ImmutableList.of(createProxyInstance(Variant.class, variant)));
    AndroidArtifact mainArtifact = mock(AndroidArtifact.class);
    when(mainArtifact.getName()).thenReturn(ARTIFACT_MAIN);
    when(variant.getMainArtifact()).thenReturn(createProxyInstance(AndroidArtifact.class, mainArtifact));
    AndroidArtifact extraAndroidArtifact = mock(AndroidArtifact.class);
    when(extraAndroidArtifact.getName()).thenReturn(ARTIFACT_ANDROID_TEST);
    when(variant.getExtraAndroidArtifacts()).thenReturn(ImmutableList.of(createProxyInstance(AndroidArtifact.class, extraAndroidArtifact)));
    JavaArtifact extraJavaArtifact = mock(JavaArtifact.class);
    when(extraJavaArtifact.getName()).thenReturn(ARTIFACT_UNIT_TEST);
    when(variant.getExtraJavaArtifacts()).thenReturn(ImmutableList.of(createProxyInstance(JavaArtifact.class, extraJavaArtifact)));
    AndroidProject reproxyProject = ProxyUtil.reproxy(AndroidProject.class, createProxyInstance(AndroidProject.class, androidProject));
    assertNotNull(reproxyProject);
    AndroidModuleModel androidModel = mock(AndroidModuleModel.class);
    when(androidModel.waitForAndGetProxyAndroidProject()).thenReturn(reproxyProject);
    when(androidModel.getVariantNames()).thenReturn(ImmutableList.of("dummyVariant"));
    List<SourceProvider> mockSourceProviders = ImmutableList.of(createMockSourceProvider("src1"), createMockSourceProvider("src2"), createMockSourceProvider("src3"));
    when(androidModel.getMainSourceProviders("dummyVariant")).thenReturn(mockSourceProviders);
    when(androidModel.getTestSourceProviders("dummyVariant", ARTIFACT_ANDROID_TEST)).thenReturn(mockSourceProviders);
    when(androidModel.getTestSourceProviders("dummyVariant", ARTIFACT_UNIT_TEST)).thenReturn(mockSourceProviders);
    ModuleNodeBuilder nodeBuilder = new ModuleNodeBuilder("test", androidModel, projectBasePath);
    DefaultMutableTreeNode node = nodeBuilder.getNode();
    assertTrue(node.getChildCount() > 0);
    DefaultMutableTreeNode variantsNode = (DefaultMutableTreeNode) node.getChildAt(node.getChildCount() - 1);
    assertEquals("Variants", variantsNode.getUserObject().toString());
    assertEquals(1, variantsNode.getChildCount());
    DefaultMutableTreeNode variantNode = (DefaultMutableTreeNode) variantsNode.getChildAt(0);
    assertEquals("dummyVariant", variantNode.getUserObject().toString());
    assertTrue(variantNode.getChildCount() > 0);
    DefaultMutableTreeNode artifactsNode = (DefaultMutableTreeNode) variantNode.getChildAt(variantNode.getChildCount() - 1);
    assertEquals("Artifacts", artifactsNode.getUserObject().toString());
    assertEquals(3, artifactsNode.getChildCount());
    DefaultMutableTreeNode androidTestNode = (DefaultMutableTreeNode) artifactsNode.getChildAt(0);
    assertEquals(ARTIFACT_ANDROID_TEST, androidTestNode.getUserObject().toString());
    DefaultMutableTreeNode sourcesNode = (DefaultMutableTreeNode) androidTestNode.getChildAt(androidTestNode.getChildCount() - 1);
    verifySourcesNode(sourcesNode);
    DefaultMutableTreeNode mainNode = (DefaultMutableTreeNode) artifactsNode.getChildAt(1);
    assertEquals(ARTIFACT_MAIN, mainNode.getUserObject().toString());
    sourcesNode = (DefaultMutableTreeNode) mainNode.getChildAt(mainNode.getChildCount() - 1);
    verifySourcesNode(sourcesNode);
    DefaultMutableTreeNode unitTestNode = (DefaultMutableTreeNode) artifactsNode.getChildAt(2);
    assertEquals(ARTIFACT_UNIT_TEST, unitTestNode.getUserObject().toString());
    sourcesNode = (DefaultMutableTreeNode) unitTestNode.getChildAt(unitTestNode.getChildCount() - 1);
    verifySourcesNode(sourcesNode);
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) ModuleNodeBuilder(com.android.tools.idea.gradle.AndroidModelView.ModuleNodeBuilder) AndroidModuleModel(com.android.tools.idea.gradle.project.model.AndroidModuleModel) AndroidProject(com.android.builder.model.AndroidProject)

Example 4 with ModuleNodeBuilder

use of com.android.tools.idea.gradle.AndroidModelView.ModuleNodeBuilder in project android by JetBrains.

the class AndroidModelViewTest method testProductFlavorsNodeCustomization.

public void testProductFlavorsNodeCustomization() throws Exception {
    AndroidProject androidProject = mock(AndroidProject.class);
    ProductFlavorContainer flavorContainer = mock(ProductFlavorContainer.class);
    when(androidProject.getProductFlavors()).thenReturn(ImmutableList.of(createProxyInstance(ProductFlavorContainer.class, flavorContainer)));
    ProductFlavor flavor = mock(ProductFlavor.class);
    when(flavor.getName()).thenReturn("dummyFlavor");
    when(flavorContainer.getProductFlavor()).thenReturn(createProxyInstance(ProductFlavor.class, flavor));
    SourceProvider mainSourceProvider = mock(SourceProvider.class);
    when(mainSourceProvider.getName()).thenReturn("dummySourceProvider");
    when(flavorContainer.getSourceProvider()).thenReturn(createProxyInstance(SourceProvider.class, mainSourceProvider));
    SourceProviderContainer extraSourceProviderContainer1 = mock(SourceProviderContainer.class);
    SourceProvider extraSourceProvider1 = mock(SourceProvider.class);
    when(extraSourceProvider1.getName()).thenReturn("extraSourceProvider1");
    when(extraSourceProviderContainer1.getSourceProvider()).thenReturn(createProxyInstance(SourceProvider.class, extraSourceProvider1));
    SourceProviderContainer extraSourceProviderContainer2 = mock(SourceProviderContainer.class);
    SourceProvider extraSourceProvider2 = mock(SourceProvider.class);
    when(extraSourceProvider2.getName()).thenReturn("extraSourceProvider2");
    when(extraSourceProviderContainer2.getSourceProvider()).thenReturn(createProxyInstance(SourceProvider.class, extraSourceProvider2));
    when(flavorContainer.getExtraSourceProviders()).thenReturn(ImmutableList.of(createProxyInstance(SourceProviderContainer.class, extraSourceProviderContainer1), createProxyInstance(SourceProviderContainer.class, extraSourceProviderContainer2)));
    AndroidProject reproxyProject = ProxyUtil.reproxy(AndroidProject.class, createProxyInstance(AndroidProject.class, androidProject));
    assertNotNull(reproxyProject);
    AndroidModuleModel androidModel = mock(AndroidModuleModel.class);
    when(androidModel.waitForAndGetProxyAndroidProject()).thenReturn(reproxyProject);
    ModuleNodeBuilder nodeBuilder = new ModuleNodeBuilder("test", androidModel, projectBasePath);
    DefaultMutableTreeNode node = nodeBuilder.getNode();
    assertTrue(node.getChildCount() > 0);
    DefaultMutableTreeNode productFlavorsNode = (DefaultMutableTreeNode) node.getChildAt(node.getChildCount() - 1);
    assertEquals("ProductFlavors", productFlavorsNode.getUserObject().toString());
    assertEquals(1, productFlavorsNode.getChildCount());
    DefaultMutableTreeNode productFlavorNode = (DefaultMutableTreeNode) productFlavorsNode.getChildAt(0);
    assertEquals("dummyFlavor", productFlavorNode.getUserObject().toString());
    assertTrue(productFlavorNode.getChildCount() > 0);
    DefaultMutableTreeNode sourceProvidersNode = (DefaultMutableTreeNode) productFlavorNode.getChildAt(productFlavorNode.getChildCount() - 1);
    assertEquals("SourceProviders", sourceProvidersNode.getUserObject().toString());
    assertEquals(3, sourceProvidersNode.getChildCount());
    assertEquals("dummySourceProvider", ((DefaultMutableTreeNode) sourceProvidersNode.getChildAt(0)).getUserObject().toString());
    assertEquals("extraSourceProvider1", ((DefaultMutableTreeNode) sourceProvidersNode.getChildAt(1)).getUserObject().toString());
    assertEquals("extraSourceProvider2", ((DefaultMutableTreeNode) sourceProvidersNode.getChildAt(2)).getUserObject().toString());
    DefaultMutableTreeNode sdkVersionsNode = (DefaultMutableTreeNode) productFlavorNode.getChildAt(productFlavorNode.getChildCount() - 2);
    assertEquals("SdkVersions", sdkVersionsNode.getUserObject().toString());
    // Min, Max and Target Sdk versions.
    assertEquals(3, sdkVersionsNode.getChildCount());
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) ModuleNodeBuilder(com.android.tools.idea.gradle.AndroidModelView.ModuleNodeBuilder) AndroidModuleModel(com.android.tools.idea.gradle.project.model.AndroidModuleModel) AndroidProject(com.android.builder.model.AndroidProject)

Example 5 with ModuleNodeBuilder

use of com.android.tools.idea.gradle.AndroidModelView.ModuleNodeBuilder in project android by JetBrains.

the class AndroidModelViewTest method testCreateTreeNode.

public void testCreateTreeNode() throws Exception {
    DefaultMutableTreeNode node = new DefaultMutableTreeNode("test");
    assertEquals(0, node.getChildCount());
    MyInterface proxyObject = ProxyUtil.reproxy(MyInterface.class, createProxyInstance(true));
    assertNotNull(proxyObject);
    ModuleNodeBuilder mockNodeBuilder = new ModuleNodeBuilder("", mock(AndroidModuleModel.class), projectBasePath);
    mockNodeBuilder.addProxyObject(node, proxyObject);
    assertEquals(11, node.getChildCount());
    DefaultMutableTreeNode childAtZero = (DefaultMutableTreeNode) node.getChildAt(0);
    assertEquals(0, childAtZero.getChildCount());
    assertEquals("File -> " + FileUtil.toSystemDependentName("/a/sample/file"), childAtZero.getUserObject());
    DefaultMutableTreeNode childAtOne = (DefaultMutableTreeNode) node.getChildAt(1);
    assertEquals(0, childAtOne.getChildCount());
    assertEquals("FileUnderProject -> " + FileUtil.toSystemDependentName("b/sample/file"), childAtOne.getUserObject());
    DefaultMutableTreeNode childAtTwo = (DefaultMutableTreeNode) node.getChildAt(2);
    assertEquals(0, childAtTwo.getChildCount());
    assertEquals("Name -> aName", childAtTwo.getUserObject());
    DefaultMutableTreeNode childAtThree = (DefaultMutableTreeNode) node.getChildAt(3);
    assertEquals(0, childAtThree.getChildCount());
    assertEquals("NativeBoolean -> true", childAtThree.getUserObject());
    DefaultMutableTreeNode childAtFour = (DefaultMutableTreeNode) node.getChildAt(4);
    assertEquals(0, childAtFour.getChildCount());
    assertEquals("doesNotExist -> Error: org.gradle.tooling.model.UnsupportedMethodException", childAtFour.getUserObject());
    // BooleanList and it's children
    DefaultMutableTreeNode childAtFive = (DefaultMutableTreeNode) node.getChildAt(5);
    assertEquals(2, childAtFive.getChildCount());
    assertEquals("BooleanList", childAtFive.getUserObject());
    DefaultMutableTreeNode booleanListChildAtZero = (DefaultMutableTreeNode) childAtFive.getChildAt(0);
    assertEquals(0, booleanListChildAtZero.getChildCount());
    assertEquals("false", booleanListChildAtZero.getUserObject());
    DefaultMutableTreeNode booleanListChildAtOne = (DefaultMutableTreeNode) childAtFive.getChildAt(1);
    assertEquals(0, booleanListChildAtOne.getChildCount());
    assertEquals("true", booleanListChildAtOne.getUserObject());
    // MapToProxy and it's children
    DefaultMutableTreeNode childAtSix = (DefaultMutableTreeNode) node.getChildAt(6);
    assertEquals(2, childAtSix.getChildCount());
    assertEquals("MapToProxy", childAtSix.getUserObject());
    DefaultMutableTreeNode mapToProxyChildAtZero = (DefaultMutableTreeNode) childAtSix.getChildAt(0);
    // The object value in the map.
    assertEquals(1, mapToProxyChildAtZero.getChildCount());
    assertEquals("one", mapToProxyChildAtZero.getUserObject());
    DefaultMutableTreeNode mapToProxyChildAtOne = (DefaultMutableTreeNode) childAtSix.getChildAt(1);
    // The proxy object values in the map.
    assertEquals(2, mapToProxyChildAtOne.getChildCount());
    assertEquals("two", mapToProxyChildAtOne.getUserObject());
    // ProxyCollection and it's children
    DefaultMutableTreeNode childAtSeven = (DefaultMutableTreeNode) node.getChildAt(7);
    assertEquals(1, childAtSeven.getChildCount());
    assertEquals("ProxyCollection", childAtSeven.getUserObject());
    DefaultMutableTreeNode ProxyCollectionChildAtZero = (DefaultMutableTreeNode) childAtSeven.getChildAt(0);
    // The child proxy object attributes.
    assertEquals(11, ProxyCollectionChildAtZero.getChildCount());
    // Name derived from child.
    assertEquals("aName", ProxyCollectionChildAtZero.getUserObject());
    // ProxyList and it's children
    DefaultMutableTreeNode childAtEight = (DefaultMutableTreeNode) node.getChildAt(8);
    assertEquals(1, childAtEight.getChildCount());
    assertEquals("ProxyList", childAtEight.getUserObject());
    DefaultMutableTreeNode ProxyListChildAtZero = (DefaultMutableTreeNode) childAtEight.getChildAt(0);
    // The child proxy object attributes.
    assertEquals(11, ProxyListChildAtZero.getChildCount());
    // Name derived from child.
    assertEquals("aName", ProxyListChildAtZero.getUserObject());
    // StringCollection and it's children
    DefaultMutableTreeNode childAtNine = (DefaultMutableTreeNode) node.getChildAt(9);
    assertEquals(3, childAtNine.getChildCount());
    assertEquals("StringCollection", childAtNine.getUserObject());
    DefaultMutableTreeNode stringCollectionChildAtZero = (DefaultMutableTreeNode) childAtNine.getChildAt(0);
    assertEquals(0, stringCollectionChildAtZero.getChildCount());
    assertEquals("one", stringCollectionChildAtZero.getUserObject());
    DefaultMutableTreeNode stringCollectionChildAtOne = (DefaultMutableTreeNode) childAtNine.getChildAt(1);
    assertEquals(0, stringCollectionChildAtOne.getChildCount());
    // Sorted alphabetically
    assertEquals("three", stringCollectionChildAtOne.getUserObject());
    DefaultMutableTreeNode stringCollectionChildAtTwo = (DefaultMutableTreeNode) childAtNine.getChildAt(2);
    assertEquals(0, stringCollectionChildAtTwo.getChildCount());
    assertEquals("two", stringCollectionChildAtTwo.getUserObject());
    // StringSet and it's children
    DefaultMutableTreeNode childAtTen = (DefaultMutableTreeNode) node.getChildAt(10);
    assertEquals(2, childAtTen.getChildCount());
    assertEquals("StringSet", childAtTen.getUserObject());
    DefaultMutableTreeNode stringSetChildAtZero = (DefaultMutableTreeNode) childAtTen.getChildAt(0);
    assertEquals(0, stringSetChildAtZero.getChildCount());
    assertEquals("a", stringSetChildAtZero.getUserObject());
    DefaultMutableTreeNode stringSetChildAtOne = (DefaultMutableTreeNode) childAtTen.getChildAt(1);
    assertEquals(0, stringSetChildAtOne.getChildCount());
    assertEquals("b", stringSetChildAtOne.getUserObject());
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) ModuleNodeBuilder(com.android.tools.idea.gradle.AndroidModelView.ModuleNodeBuilder) AndroidModuleModel(com.android.tools.idea.gradle.project.model.AndroidModuleModel)

Aggregations

ModuleNodeBuilder (com.android.tools.idea.gradle.AndroidModelView.ModuleNodeBuilder)5 AndroidModuleModel (com.android.tools.idea.gradle.project.model.AndroidModuleModel)5 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)5 AndroidProject (com.android.builder.model.AndroidProject)4