r/java • • Jun 01 '24

What java technology (library, framework, feature) would not recommend and why?

165 Upvotes

464 comments sorted by

View all comments

124

u/progmakerlt Jun 01 '24 edited Jun 01 '24

PowerMock. Ability to mock static methods is cool, but can lead to disastrous results, when tests pass once and then randomly fail.

Edit: typo.

14

u/agentoutlier Jun 01 '24

I will just add that "mocking" especially using a library (and especially the one mentioned) should be the last resort after you have eliminated all other options.

I find custom built mocks like Spring's Servlet Mocks acceptable but still rather use the real thing.

1

u/progmakerlt Jun 01 '24

But sometimes you have to mock stuff, especially if it’s an external library or hard to mock stuff.

→ More replies (2)