use of org.jetbrains.android.dom.structure.resources.ResourceStructureViewBuilder in project android by JetBrains.
the class StructureViewTest method testResourceStructure.
public void testResourceStructure() throws Exception {
VirtualFile file = copyFileToProject("resources/resources_structure.xml", "/res/values/styles.xml");
PsiFile psiFile = PsiManager.getInstance(getProject()).findFile(file);
assertInstanceOf(psiFile, XmlFile.class);
DomFileElement<Resources> element = DomManager.getDomManager(getProject()).getFileElement(((XmlFile) psiFile), Resources.class);
assertNotNull(element);
StructureViewModel model = new ResourceStructureViewBuilder(element).createStructureViewModel(null);
String expected = "Resources file 'styles.xml'\n" + " Style - AppTheme\n" + " String - test_string\n" + " Style - SecondStyle\n";
assertEquals(expected, model.getRoot().toString());
}
Aggregations