Tuesday, May 3, 2016

GWT unit tests along with JsInterop and external javascript

My test case is simple, but it's not working.
I have an external .js file containing an object, Person, which has 2
fields, firstName and lastName, and a method, getFullName. It also have a
constructor that initialize those 2 fields.

I have created a java object Person which is annotated with
@JsInterop(isNative=true, namespace="...", name=Person).

My test case is to create a person and to ask for its full name:
Person pilot = new Person("Kimi", "Raikkonen");
assertTrue(person.getFullName().equals("Kimi Raikkonen"));

The problem is that the Person pilot is not initialized correctly and the
method getFullName() couldn't be found. Neither the fields doesn't exist in
pilot object..

Note that this happens ONLY at GWT Unit Test running, and NOT when I run my
application normally; at normal running, it works as expected.

Have someone did unit test for gwt using jsinterop and external js? Is there
something that I've missed?

Thank you.



--
View this message in context: http://google-web-toolkit.2317884.n4.nabble.com/GWT-unit-tests-along-with-JsInterop-and-external-javascript-tp15739.html
Sent from the Google Web Toolkit mailing list archive at Nabble.com.

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment