use of com.android.tools.idea.gradle.structure.configurables.ui.dependencies.AbstractDeclaredDependenciesTableModel.DependencyCellRenderer in project android by JetBrains.
the class AbstractDeclaredDependenciesTableModelTest method testShowArtifactDependencySpec.
public void testShowArtifactDependencySpec() {
PsArtifactDependencySpec spec = new PsArtifactDependencySpec("appcompat-v7", "com.android.support", "23.1.0");
when(myLibraryDependency.getResolvedSpec()).thenReturn(spec);
when(myLibraryDependency.getDeclaredSpec()).thenReturn(spec);
when(myLibraryDependency.toText(PLAIN_TEXT)).thenReturn("com.android.support:appcompat-v7:23.1.0");
ColumnInfo[] columnInfos = myTableModel.getColumnInfos();
PsUISettings.getInstance().DECLARED_DEPENDENCIES_SHOW_GROUP_ID = true;
//noinspection unchecked
ColumnInfo<PsAndroidDependency, String> specColumnInfo = columnInfos[0];
DependencyCellRenderer renderer = (DependencyCellRenderer) specColumnInfo.getRenderer(myLibraryDependency);
assertNotNull(renderer);
String text = renderer.getText();
assertEquals("com.android.support:appcompat-v7:23.1.0", text);
PsUISettings.getInstance().DECLARED_DEPENDENCIES_SHOW_GROUP_ID = false;
text = renderer.getText();
assertEquals("appcompat-v7:23.1.0", text);
}
Aggregations