Open RadoBuransky opened 8 years ago
@RadoBuransky this one-liner saved my day, thanks!
Thanks a ton! It worked for me.
For the javaheads, it is very similar:
SomeService mockedService = Mockito.mock(SomeService.class, withSettings().serializable());
Man that's just so miraculous !! I never considered mockito could do that and I was even creating my own inherited mocks...
Hi, creating a trait that overrides that method fixed the serialization issue. But now I get a different one:
java.lang.ClassNotFoundException: com.my.package.MyMockedObject$MockitoMock$2133292710
Anybody had the same problem?
I had the same issue as @rugobal mentioned. I had to stub the mock object by declaring it as serializable. The following links Not Serializable and Class Cast Exception have some useful information about these issues.
You saved my life.
One single line can save some serialization pain when using Mockito. Perhaps it makes sense to create a mixin for
StreamingSuiteCommon
withMockitoSugar
and this:Otherwise you get following error: