public class FormTest extends TestCase {
public void testStaticForm() throws Exception {
StaticForm target = new StaticForm();
MFormModel model = new FormModelBuilder( MSingleton.instance().getActivator(), target, FormModelBuilder.DEFAULT_SCHEMA );
target.setInput("string");
model.loadFromTarget();
assertEquals("string", ((FString)model.getElement("input")).getValue());
((FString)model.getElement("input")).setValue("newstring");
assertNotSame("set", "newstring", target.getInput());
model.saveToTarget(false);
assertEquals("newstring", ((FString)model.getElement("input")).getValue());
try {
((FString)model.getElement("input2")).setValue("");
// should hrow an error
assertTrue(true);
} catch (ValidateException e) {
}
try {
((FString)model.getElement("input2")).setValue("123456");
// should hrow an error
assertTrue(true);
} catch (ValidateException e) {
}