Closed manandbytes closed 6 years ago
Would you mind to Rebase and merge [1] to avoid merge commits in the master branch?
Why does maven care what the classname is? I thought maven found tests via the test folder?
I just looked it up and you're right. Maven is insane. I'd love to know why they insist on a separate test folder then...
Maven is insane.
Will not start flame war ;-)
I'd love to know why they insist on a separate test folder then
There are a lot of practical reasons, like for any mature project. It is just a convention (AKA default) of the plugin that actually runs tests by delegating this to different test frameworks.
Because of classpaths (AKA scopes in Maven lingo) - you have to prevent tests leaking into production code's classpath but it is hard for generic plugin to know the difference between them.
And it is much more future-proof (about 10 years old already and working pretty well) to have a separate home for anything test-related (quite often you end up with abstract parents, utility classes etc that are not tests).
BTW, thanks for merging ;-)
Yep. I can see the reasons for a separate top level test dir, but you then shouldn't need an arbitrary naming convention for test classes. It already has the @Test annotation anyway.
It already has the @test annotation anyway.
As far as I remember, this Maven feature predates this specific annotation and annotation-driven versions of JUnit/TestNG.
As far as I remember, this Maven feature predates this specific annotation and annotation-driven versions of JUnit/TestNG.
That makes more sense. And really that's Java's fault - testing should be part of the standard library.
Rename Versions to VersionsTest to make it run during Maven's test phase: