-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spying objects not working properly since 5.3.0 #2972
Comments
Seeing similar problems with spy mocks, in my case it seems like the spy wrapper isn't calling the real methods under the covers properly |
My first thought was the issue could be the JavaTimeModule being final. |
Which version of ByteBuddy are you using? Can you downgrade to the version of ByteBuddy that Mockito 5.2.0 used and let us know if that solves the issue? |
FWIW, I'm using ByteBuddy |
Hi @TimvdLippe, thanks for your response. |
I'd be surprised by that. Could you build Mockito but revert this one commit to see if it solves the issue? |
I'm also having intermittent issues spying instances with mockito 5.3.0 |
We have a bunch of tests on this, so I am a bit confused. I will have a look once I find the time. Could someone try to create a reproduction of the test without external dependencies? This would ease my work a lot, and I can use it as a regression test. |
We have a similar issue spying on objects. Fields of the real object that are initialized in the default constructor call are not properly set in the spy and therefore causing a different behavior at runtime. This could be solved by using MockSettings.useConstructor(), thankfully. Another issue is more serious: also method calls are not redirected to the spy anymore - instead, the method on the mock is called. :-( |
Can anybody who is affected bisect the commits between Mockito 5.2.0 and 5.3.0 and let us know which commit breaks the behavior? I am still stumbled by this regression and I can't piece it together with the commits that were in this minor version release. |
I tried it now and it is certainly related to the change of the visibility. I am however not yet sure how this relates, looking into. |
Found out and fixed: #2983 |
Hi.
starting with 5.3.0 we are unable to spy
ObjectMapper
with a registeredJavaTimeModule
.Could this be dependent on the changes for #2877? It looks like the module has been removed after creating the spy.
With 5.2.0 everything is working fine. Please see the minimal example below.
The text was updated successfully, but these errors were encountered: