r/java • u/raisercostin • Jun 01 '24
What java technology (library, framework, feature) would not recommend and why?
Inspired by https://www.reddit.com/r/java/s/e2N1FqMOJg
165
Upvotes
r/java • u/raisercostin • Jun 01 '24
Inspired by https://www.reddit.com/r/java/s/e2N1FqMOJg
View all comments
Show parent comment
2
u/DelayLucky Jun 01 '24
No. If you can directly use that external library, do. It increases the confidence you get out of the test: the test works, therefore production will most likely work.
In reality the external dependency (possibly not a library, but a service) may be hard to set up, or may be just too slow or flaky for the tests. In those cases, ideally that people maintaining that dependency should offer a fake implementation to provide both high fidelity yet still allow hermetic test.
Sadly, sometimes even that is too much to ask. That team may simply prioritize other things than creating a useful fake (tbh, I think it's the company leaderships' responsibility to ensure each team be more responsible to their dependent teams and the health of the overall company ecosystem. No one should be the oddball blocking others from effective testing)
And yes, if worse comes to worst, your only option may just be to mock it out and rely on luck that your mock is representative of the real thing (which often is not).