News for hackers. Stuff that matters.
Re:Six Years of Professional Clojure by hota_mazi on Monday August 02, 2021 @03:12PM (#28041279)
It's Mockito [1], which has been a standard for a while. There are other libraries and they use different strategies to provide this kind of functionalities (dynamic proxies, bytecode weaving, annotation processing, etc...).

[1] https://site.mockito.org/

Re:Six Years of Professional Clojure by joelbluminator on Monday August 02, 2021 @03:19PM (#28041362)
And ... is the whole user being mocked or just the method?
Re:Six Years of Professional Clojure by vincnetas on Monday August 02, 2021 @03:33PM (#28041555)
It creates a stub, but you can also configure it to pass any method calls to original implementation. You should be tiping your hat i think.

https://javadoc.io/static/org.mockito/mockito-core/3.11.2/or...

User mock = mock(User.java)

Should have been

User mock = mock(User.class)

Re:Six Years of Professional Clojure by hota_mazi on Monday August 02, 2021 @04:17PM (#28042062)
Ah oops, I've been writing exclusively Kotlin for several years, my Java is becoming rusty (no pun intended).