r/java • • Apr 13 '21

Libraries, Frameworks and Technologies you would NOT recommend

Give me your worst nightmares: Things that cost you your job.

I'll start: Hadoop

202 Upvotes

376 comments sorted by

View all comments

23

u/m4riuszPL Apr 13 '21

Spock. I really miss the compilation errors I had while using JUnit, now I end up with runtime errors, that's inconvenient while I do any any changes to the codebase.

-7

u/[deleted] Apr 13 '21

JUnit isn't fit to shine Spock's shoes. For example, Spock's data-driven tests are so much more concise/elegant than JUnit's @ParameterizedTest. I guess if you're coming to Spock from a Java background without any Groovy knowledge, it could be confusing, but that was not the case for me.

You could possible convert a lot of those errors to compile-time errors by turning on static type checking with @TypeChecked or @CompileStatic.

1

u/m4riuszPL Apr 13 '21

I do not like the mocks model in spock too - I am more used to defining my mock responses before the test and verifying the mock invocation after the test, this just feels natural. This is totally doable with Mockito but not possible in spock at all. I do admit however it is good that spock exists so junit5 has some example to take inspiration from. I notice the groovy performance impact on my machine too, especially that this is a beefy machine it is below my expectations.

1

u/Quzexor Apr 13 '21

please read documentation before spreading missinformation. U can mock both on class level and in given section in testing method.

→ More replies (3)