/** * Tests the {@link AbstractAddAdapterRule#startElement} method * * @throws Exception if an error occurs */ public void testStartElement() throws Exception { // create an expanded name ExpandedName eName = new ImmutableExpandedName("testNamespace", "testLocalName"); Attributes atts = new AttributesImpl(); XMLPipeline pipeline = dynamicProcess.getPipeline(); NamespacePrefixTracker tracker = pipeline.getPipelineContext().getNamespacePrefixTracker(); // register the prefix with the tracker tracker.startPrefixMapping("p", "testNamespace"); // invoke startElement on the rule Object returned = rule.startElement(dynamicProcess, eName, atts); // ensure the process was added to the pipeline assertSame( "Adapter Process was not added to the pipeline", adapterProcess, pipeline.getHeadProcess()); // ensure the object return was the addapter process assertSame( "startElement should return the adapter process that was " + "added to the pipeline", adapterProcess, returned); // ensure the adapters processes setElementDetails method was invoked adapterProcess.assertSetElementDetailsInvoked( "testNamespace", "testLocalName", "p:testLocalName"); // ensure the processAttributes method was invoked ok adapterProcess.assertProcessAttributesInvoked(atts); }