FlowHelper.setContextObject(objectModel, flowContextObject);
objectModel.put(ObjectModelHelper.REQUEST_OBJECT, request);
Map contextObjectModel = new HashMap();
contextObjectModel.put(ContextHelper.CONTEXT_OBJECT_MODEL, objectModel);
Context context = new DefaultContext(contextObjectModel);
Source sampleSource = new ResourceSource("resource://org/apache/cocoon/woody/datatype/FlowJXPathSelectionListTestCase.source.xml");
Document sample = parser.parse(sampleSource.getInputStream());
Element datatypeElement = (Element) sample.getElementsByTagNameNS(Constants.WD_NS, "datatype").item(0);
Datatype datatype = datatypeManager.createDatatype(datatypeElement, false);
FlowJXPathSelectionList list = new FlowJXPathSelectionList
(context, "beans", "key", "value", datatype);
DOMBuilder dest = new DOMBuilder();
list.generateSaxFragment(dest, Locale.ENGLISH);
Source expectedSource = new ResourceSource("resource://org/apache/cocoon/woody/datatype/FlowJXPathSelectionListTestCaseWithNull.dest.xml");
Document expected = parser.parse(expectedSource.getInputStream());
assertEqual("Test if generated list matches expected",
expected, dest.getDocument());
}