// update the locator with the location
locator.setSystemId(baseURI.toExternalForm());
// set the next process
XMLProcessTestable next = new XMLProcessTestable();
process.setNextProcess(next);
// call setDocumentLocator()
process.setDocumentLocator(locator);
process.startDocument();
// get hold of the pipeline context
XMLPipelineContext context
= process.getPipeline().getPipelineContext();
// ensure that the XMLPipelineContext has a current locator and
// base uri
assertNotNull(
"XMLPipelineContext should have a non null current locator",
context.getCurrentLocator());
assertNotNull(
"XMLPipelineContext should have a non null current base URI",
context.getCurrentBaseURI());
// invoke the method that is being tested
process.endDocument();
// ensure that the pipeline context has had both the current locator
// and base uri popped off.
assertNull("endDocument should pop the current locator",
context.getCurrentLocator());
assertNull("endDocument should pop the current base uri",
context.getCurrentBaseURI());
// ensure that the event is not forwarded to the next process
next.assertEndDocumentNotInvoked();
}