我有我使用AutoBeanCodex
編碼和解碼AutoBeans的測試。 當我嘗試測試其使用AutoBeanCodex.decode(...)
方法,我得到像下面的錯誤:GWTMockito:如何模擬AutoBeanCodex?
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 ...
第一個問題是如何做我處理我gwtmockito測試AutoBeanCodex
?
我必須使用像這樣的假冒供應商,GwtMockito.useProviderForType(Class, FakeProvider)
?
如果有多種方法可以處理AutoBeanCodex
,那麼最佳方法是什麼?
提交gwtmockito團隊的問題,https://github.com/google/gwtmockito/issues/22。 – Jonathan
問題已解決 – Jonathan