Live data from Hacker News

Stepping down as Mockito maintainer after ten years

github.com

21–30 of 220 posts

Re: Stepping down as Mockito maintainer after ten years

#21

Earlier quoted context omitted.

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.

your test environment should not have the credentials to write to prod data. yiiiiikes!

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 ten years

#22
post #2

For those, like me, who haven't heard of it: Mockito is the "most popular mocking framework for Java".

It also translates to “small booger”, in Spanish, which always made me question who thought the name was a good idea over there.

Actually, no. "small booger" would be _moquito_ in spanish.

Re: Stepping down as Mockito maintainer after ten years

#23
post #8

>Mockito 5 shipped a breaking change where its main artifact is now an agent. That's because starting JVM 22, the previous so-called "dynamic attachment of agents" is put behind a flag Wouldn't this hold back enterprise adoption, the same way breaking changes meant that Java 8 was widely used for a long time?

[deleted]

Re: Stepping down as Mockito maintainer after ten years

#24

Earlier quoted context omitted.

It also translates to “small booger”, in Spanish, which always made me question who thought the name was a good idea over there.

Why? Every name you pick is likely to be weird in one language or another. Mockito does one thing well as a name, and that is hinting strongly at what it is (a mocking library).

>is likely to be weird in one language or another.

But this name is weird in the specific language it’s imitating (both the -ito termination for diminutives and the drink on which I assumed the name is based are Spanish).

Re: Stepping down as Mockito maintainer after ten years

#25
post #4

As someone who is not in the Java world, why does Java need a mocking library? Interface based polymorphism is not enough?

Mockito allows one to write mocks in tests for code that doesn't use dependency injection and isn't properly testable in any other way. On the one hand, you should just design things to be testable from the start. On the other... I'm already working in this codebase with 20 years of legacy untestable design...

Google API libraries mark every class as "final" so it's not trivial to mock-extend it for tests. But third-party IO is exactly the thing you'd want to mock.

Probably because they zealously followed "Effective Java" book.

Re: Stepping down as Mockito maintainer after ten years

#27
post #4

As someone who is not in the Java world, why does Java need a mocking library? Interface based polymorphism is not enough?

because even supposing you have an interface for your thing under test (which you don't necessarily, nor do you necessarily want to have to) it lets you skip over having to do any fake implementations, have loads of variations of said fake implementations, have that code live somewhere, etc etc.

Instead your mocks are all just inline in the test code: ephemeral, basically declarative therefore readily readable & grokable without too much diversion, and easily changed.

A really good usecase for Java's 'Reflection' feature.

Re: Stepping down as Mockito maintainer after ten years

#28

What does Agent mean in this context? And what is "dynamic attachment of agents"?

A JVM agent is able to instrument and modify running JVM applications. Stuff like debugging, hot patching, etc rely on this. You used to be able to tell the JVM to listen on a port where you could connect debuggers (agents) dynamically at runtime, but that was deemed a security issue so now you can only declare specific agents at launch time through command-line flags.

Re: Stepping down as Mockito maintainer after ten years

#30

Earlier quoted context omitted.

It also translates to “small booger”, in Spanish, which always made me question who thought the name was a good idea over there.

Actually, no. "small booger" would be _moquito_ in spanish.

Fair. The spelling is off, but the pronunciation is the same.
Post reply on HN