Sunday, June 14, 2009

Testing in Hosted Mode (GWT JUnit Test) does not work

Problem

When running the test: GWT JUnit Test, the test does not work as expected. For example:

...
public void testCallTheOnBlurHandler () throws Exception (
final StringBuffer value = new StringBuffer ( "one");
TextBox textbox = new TextBox ();
RootPanel.get (). Add (TextBox);
textBox.addBlurHandler (new BlurHandler () (

@ Override
public void onBlur (BlurEvent event) (
valor.append ( "two");

)
));
textBox.setFocus (false);
assertEquals ( "Not called BlurHandler,"
"two", valor.toString ());
)

Reason

Unidentified, but I think it is a problem of compilation because of the solution found.

Solution

Run the test in web mode: GWT JUnit Test (web mode). The test work. Go back and run the test in hosted mode.It should work.

No comments:

Post a Comment