use of com.intellij.util.xml.stubs.model.Bar in project intellij-community by JetBrains.
the class DomStubUsingTest method testFoo.
public void testFoo() {
DomFileElement<Foo> fileElement = prepare("foo.xml", Foo.class);
PsiFile file = fileElement.getFile();
assertFalse(file.getNode().isParsed());
Foo foo = fileElement.getRootElement();
assertEquals("foo", foo.getId().getValue());
assertFalse(file.getNode().isParsed());
List<Bar> bars = foo.getBars();
assertFalse(file.getNode().isParsed());
final List<GenericDomValue<String>> listElements = foo.getLists();
final GenericDomValue<String> listElement0 = listElements.get(0);
assertEquals("list0", listElement0.getValue());
final GenericDomValue<String> listElement1 = listElements.get(1);
assertEquals("list1", listElement1.getValue());
assertFalse(file.getNode().isParsed());
assertEquals(2, bars.size());
Bar bar = bars.get(0);
String value = bar.getString().getStringValue();
assertEquals("xxx", value);
Object o = bar.getString().getValue();
assertEquals("xxx", o);
Integer integer = bar.getInt().getValue();
assertEquals(666, integer.intValue());
assertFalse(file.getNode().isParsed());
Bar emptyBar = bars.get(1);
GenericAttributeValue<String> string = emptyBar.getString();
assertNull(string.getXmlElement());
assertFalse(file.getNode().isParsed());
}
use of com.intellij.util.xml.stubs.model.Bar in project intellij-community by JetBrains.
the class DomStubUsingTest method testParent.
public void testParent() {
DomFileElement<Foo> element = prepare("parent.xml", Foo.class);
Bar bar = element.getRootElement().getBars().get(0);
GenericAttributeValue<Integer> notStubbed = bar.getNotStubbed();
DomElement parent = notStubbed.getParent();
assertEquals(bar, parent);
NotStubbed child = bar.getNotStubbeds().get(0);
parent = child.getParent();
assertEquals(bar, parent);
}
use of com.intellij.util.xml.stubs.model.Bar in project intellij-community by JetBrains.
the class DomStubUsingTest method testChildrenOfType.
public void testChildrenOfType() {
DomFileElement<Foo> element = prepare("foo.xml", Foo.class);
Foo foo = element.getRootElement();
List<Bar> bars = DomUtil.getChildrenOf(foo, Bar.class);
assertEquals(2, bars.size());
}
use of com.intellij.util.xml.stubs.model.Bar in project intellij-community by JetBrains.
the class DomStubUsingTest method testAccessingPsi.
public void testAccessingPsi() {
DomFileElement<Foo> element = prepare("foo.xml", Foo.class);
assertNotNull(element.getXmlElement());
XmlTag tag = element.getRootTag();
assertNotNull(tag);
Foo foo = element.getRootElement();
assertNotNull(foo.getXmlTag());
Bar bar = foo.getBars().get(0);
assertNotNull(bar.getXmlElement());
XmlAttribute attribute = bar.getString().getXmlAttribute();
assertNotNull(attribute);
}
use of com.intellij.util.xml.stubs.model.Bar in project intellij-community by JetBrains.
the class DomStubUsingTest method testStubbedElementUndefineNotExisting.
public void testStubbedElementUndefineNotExisting() {
final DomFileElement<Foo> fileElement = prepare("foo.xml", Foo.class);
final Bar bar = fileElement.getRootElement().getBars().get(0);
assertUndefine(bar);
}
Aggregations