*/
public void testGetInitialValue() throws Exception {
// a) Expect null as the result
XFTextInputAttributes attributes = new XFTextInputAttributes();
FormInstance formInstance = new FormInstance(NDimensionalIndex.ZERO_DIMENSIONS);
final Form form = new Form(null);
formInstance.setFormat(form);
attributes.setFormData(formInstance);
TestMarinerRequestContext requestContext = new TestMarinerRequestContext();
ContextInternals.setEnvironmentContext(requestContext,
new TestEnvironmentContext());
TestMarinerPageContext pageContext = new TestMarinerPageContext();
FormDescriptor fd = new FormDescriptor();
String formSpecifier =
pageContext.getFormDataManager().getFormSpecifier(fd);
ContextInternals.setMarinerPageContext(requestContext, pageContext);
pageContext.pushRequestContext(requestContext);
protocol.setMarinerPageContext(pageContext);
String result = protocol.getInitialValue(attributes);
assertEquals(null, result);
// b) Expect 'Test' as the result
attributes.setInitial("Test");
result = protocol.getInitialValue(attributes);
assertEquals("Test", result);
// c) Expect value of textComponentID as the result.
attributes.setInitial(new LiteralTextAssetReference("foobar"));
result = protocol.getInitialValue(attributes);
assertEquals("foobar", result);
// d) Expect the value of textComponentID (since sessionContext.
// getAttribute return null).
attributes.setInitial(new LiteralTextAssetReference("foobar"));
final XFFormAttributes formAttributes = new XFFormAttributes();
formAttributes.setFormSpecifier(formSpecifier);
attributes.setFormAttributes(formAttributes);
form.addFormFragment(new FormFragment(null));
result = protocol.getInitialValue(attributes);
assertEquals("foobar", result);
}