News for hackers. Stuff that matters.
Re:Stepping down as Mockito maintainer after 10 years by krackers on Sunday December 28, 2025 @04:26PM (#46414695)
Mocks make it easy to record and assert on method invocations. Additionally spys (instance mocks) are really useful when you need to forward to the real method or rely on some state.

At the moment I can't see anything Mokckito gives that you technically couldn't implement yourself via subclassing and overriding, but it'd be a lot of boilerplate to proxy things and record the arguments.

Re:Stepping down as Mockito maintainer after 10 years by sunnybeetroot on Sunday December 28, 2025 @04:41PM (#46414818)
Subclasing and overriding is not a good idea. There is no compilation failure if you forget to override a function which can lead to flakey tests at best and prod data impact at worst.
Re:Stepping down as Mockito maintainer after 10 years by wmichelin on Sunday December 28, 2025 @04:43PM (#46414824)
your test environment should not have the credentials to write to prod data. yiiiiikes!
Re:Stepping down as Mockito maintainer after 10 years by sunnybeetroot on Sunday December 28, 2025 @04:46PM (#46414848)
Credentials end up existing in prod because the person used Mochito and didn’t override the function for providing credentials :’c
Re:Stepping down as Mockito maintainer after 10 years by senbrow on Sunday December 28, 2025 @05:26PM (#46415147)
Credentials should only be provided at the application root, which is going to be a different root for a test harness.

Mockito shouldn't change whether or not this is possible; the code shouldn't have the prod creds (or any external resource references) hard coded in the compiled bytecode.

Re:Stepping down as Mockito maintainer after 10 years by sunnybeetroot on Sunday December 28, 2025 @05:32PM (#46415190)
I totally agree, I’m being tongue in cheek, but given how poor some codebases can be, the more precautions the better ie compilation failures on non-mocked functions.