google / gwtmockito

Better GWT unit testing
https://google.github.io/gwtmockito
Apache License 2.0
157 stars 51 forks source link

Allow ResourcePrototype methods in fake ClientBundle #83

Closed zbynek closed 5 years ago

zbynek commented 5 years ago

This PR allows you to mock ResourcePrototypes that have a method producing another ResourcePrototype (usecase: SVGResource that can produce SVGs in different colors)

googlebot commented 5 years ago

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

zbynek commented 5 years ago

I signed it!

googlebot commented 5 years ago

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

ekuefler commented 5 years ago

Thanks! Is it possible to add a test for this like in https://github.com/google/gwtmockito/blob/master/gwtmockito/src/test/java/com/google/gwtmockito/GwtMockitoTest.java#L384?

zbynek commented 5 years ago

@ekuefler thanks for checking, I added a test.

ekuefler commented 5 years ago

Thank you!

zbynek commented 5 years ago

@ekuefler do you have any plans for the next release?

ekuefler commented 5 years ago

I've pushed a new snapshot release at https://oss.sonatype.org/content/repositories/snapshots/com/google/gwt/gwtmockito/gwtmockito/1.1.9-SNAPSHOT/. Could you try that out to confirm it's working as expected? If so, there are a couple more things I need to verify, then I'll plan on doing a full release of 1.1.9 in a week or two.

zbynek commented 5 years ago

Sorry for the delay. I can confirm the fix works with 1.1.9-SNAPSHOT.

FYI: there is (unrelated?) IllegalAccessError when protected nested interface https://github.com/geogebra/geogebra/blob/3bfd6e55d130793c5420151fdfe768b063878f3a/common/src/main/java/org/geogebra/common/io/MyXMLio.java#L472 is implemented in a nested subclass https://github.com/geogebra/geogebra/blob/master/web/src/main/java/org/geogebra/web/html5/io/MyXMLioW.java#L50

java.lang.IllegalAccessError: class org.geogebra.web.html5.io.MyXMLioW$XMLStreamStringW cannot access its superinterface org.geogebra.common.io.MyXMLio$XMLStream

I guess this kind of nesting is not a common usecase and there are easy ways to avoid it (e.g. make the interface public), so not a problem a for me.