this looks more like a WicketTester failure then a failure of the real code
are you really porting to 1.2? You should try to go from 2.0 to 1.3 because
else you need
to change quite a lot more
johan
On 4/4/07, Gohan <[EMAIL PROTECTED]> wrote:
I'm porting an application from wicket 2.0 to 1.2 but I run into trouble
when
executing tests for some of the classes. The tests worked in Wicket 2.0.
Bellow is a simple example the demonstrate the problem:
public class FormPage extends WebPage {
private static final long serialVersionUID = 1067399768727619005L;
public FormPage() {
final Label label = new Label("labelId", new Model(
"Result will be shown here"));
add(label);
Form form = new Form("formId", new
CompoundPropertyModel(new Model(
new Person())));
form.add(new TextField("firstName"));
form.add(new TextField("lastName"));
form.add(new Button("buttonId", new Model("Submit")) {
private static final long serialVersionUID =
-6844333946044170902L;
@Override
@SuppressWarnings("unchecked")
public void onSubmit() {
Person person = (Person)
getForm().getModelObject();
label
.setModel(new Model("You
entered: "
+
person.getFullname()));
}
});
add(form);
}
}
One of the test that I've created earlier and that worked with Wicket 2.0
looks like this:
@Test
public void submit() {
FormPage formPage = (FormPage) tester.getLastRenderedPage
();
Form form = (Form) formPage.get("formId");
TextField firstName = (TextField) form.get("firstName");
firstName.setModelValue("Firstname");
TextField lastName = (TextField) form.get("lastName");
lastName.setModelValue("Lastname");
FormTester formTester = tester.newFormTester("formId");
formTester.submit("buttonId");
// Get the label and validate the model object
Label label = (Label) formPage.get("labelId");
assertEquals("Label model does not match.",
"You entered: Firstname Lastname",
label.getModelObject());
}
However this does not seem to work with wicket 1.2. The last line of the
test fails saying:
"Label model does not match. expected:<You entered: [Firstname Lastname]>
but was:<You entered: [null null]>"
The problem seem to be that the call to ..setModelValue(..) doesn't update
the model or it get "lost" when I press the submit button somehow. How can
I
fix this?
thanks
--
View this message in context:
http://www.nabble.com/Testing-trouble-when-backporting-application-from-2.0-to-1.2.5-tf3528486.html#a9846434
Sent from the Wicket - User mailing list archive at Nabble.com.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share
your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user