/**
* Test getChildren with stop elements.
*/
public void testGetChildrenStopElements() {
JDOMFactory factory = new DefaultJDOMFactory();
Element parent1 = factory.element("parent1");
Element child1a = factory.element("child1a");
Element child2a = factory.element("child2a");
parent1.addContent(child1a);
parent1.addContent(child2a);
Element parent2 = factory.element("parent2");
Element child1b = factory.element("child1b");
Element child2b = factory.element("child2b");
parent2.addContent(child1b);
parent2.addContent(child2b);
String [] stopElements = { parent1.getName(), parent2.getName() };
ElementChildrenTreeContentProvider provider =
new ElementChildrenTreeContentProvider(null, stopElements,
false, false);
Object [] elements = provider.getChildren(parent1);
assertEquals("There should be no child elements for parent1", 0,
elements.length);
elements = provider.getChildren(parent2);
assertEquals("There should be no child elements for parent2", 0,
elements.length);
// Make parent1 and parent2 child of some root element to ensure that
// they do appear in the root's children.
Element root = factory.element("root");
root.addContent(parent1);
root.addContent(parent2);
elements = provider.getChildren(root);
assertEquals("There should be two child elements for root.", 2,