antoinemeyer/mock-in-bean

Context gets corrupted with "nulls"

Closed this issue · 3 comments

When I run tests and inspect the beans retrieved in the application context with the debugger, they all have null fields.
After running a few tests my context gets corrupted by the many "nulls" that get injected back as "original values".
I really don't understand what I got wrong...

Do you have some code to showcase the issue so that I can have a look?

Sorry about all this.
It turns out that's just how the application context work. When I'm getting a bean I'm not seeing all the autowired fields since they are "proxied". I fiddled with the way you retrieve the "original value" in your code when trying to figure out how it worked and accidentally messed it up.

Thank you very much for this project. It's very helpful. I'm on a legacy project with tons of @SpringBootTest and besides running all these tests at once being slow we see other side effects. Now it's all solved thanks to your help !

Okay cool, glad it's helpful! 😄