ipfs-shipyard / java-ipfs-http-client

A Java implementation of the HTTP IPFS API
MIT License
539 stars 243 forks source link

Enable tests for versions #99

Closed manandbytes closed 6 years ago

manandbytes commented 6 years ago

Rename Versions to VersionsTest to make it run during Maven's test phase:

Running io.ipfs.api.VersionsTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.108 sec - in io.ipfs.api.VersionsTest
manandbytes commented 6 years ago

Would you mind to Rebase and merge [1] to avoid merge commits in the master branch?

[1] https://help.github.com/articles/about-pull-request-merges/#rebase-and-merge-your-pull-request-commits

ianopolous commented 6 years ago

Why does maven care what the classname is? I thought maven found tests via the test folder?

ianopolous commented 6 years ago

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...

manandbytes commented 6 years ago

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 ;-)

ianopolous commented 6 years ago

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.

manandbytes commented 5 years ago

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.

ianopolous commented 5 years ago

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.