// =====================================================================
// Set Expectations
// =====================================================================
WebRequestParameter parameter = new WebRequestParameter();
entityFactoryMock.expects.createParameter().returns(parameter);
HTTPMessageEntities entities = new SimpleHTTPMessageEntities();
entityFactoryMock.expects.createHTTPMessageEntities().returns(entities);
expectAddSimpleElementProcess(parameter);
contextMock.expects.getProperty(WebRequestParameter.class).returns(
null);
contextMock.expects.setProperty(WebRequestParameter.class,
entities, false);
// =====================================================================
// Test Expectations
// =====================================================================
addAttribute("name", name);
addAttribute("value", value);
addAttribute("from", from);
addAttribute("target", target);
DynamicElementRule rule = new ParameterRule(entityFactoryMock);
XMLProcess process = (XMLProcess) rule.startElement(dynamicProcessMock,
elementName, attributes);
dynamicProcessMock.expects.removeProcess(process);
rule.endElement(dynamicProcessMock, elementName, process);
assertNotNull(parameter);
if (name == null) {
assertEquals("Name value should match", from,
parameter.getName());
} else {
assertEquals("Name value should match", name,
parameter.getName());
}
assertEquals("Value value should match", value,
parameter.getValue());
assertEquals("From value should match", from,
parameter.getFrom());
assertEquals("Target value should match", target,
parameter.getTarget());
}