I have tests which I am writing that use AutoBeanCodex
to encode and decode AutoBeans.
When I try to test methods which use AutoBeanCodex.decode(...)
, I get errors like the following:
java.lang.ClassCastException: com.google.web.bindery.autobean.shared.AutoBean$$EnhancerByMockitoWithCGLIB$$78caf05b cannot be cast to com.google.web.bindery.autobean.shared.impl.AbstractAutoBean
at com.google.web.bindery.autobean.shared.impl.AutoBeanCodexImpl.doDecode(AutoBeanCodexImpl.java:549)
at com.google.web.bindery.autobean.shared.AutoBeanCodex.decode(AutoBeanCodex.java:39)
at ...
First question is how do I deal with AutoBeanCodex
in my gwtmockito tests?
Do I have to use a fake provider like so, GwtMockito.useProviderForType(Class, FakeProvider)
?
If there are multiple ways to deal with AutoBeanCodex
, what is the best approach?