I came across a funny issue on utils (available here) today, basically 2 unit tests were not executed by Apache Maven on Travis CI.
It’s funny beacause it happened to me before, so I knew how to fix this problem.
On my machine I usually run JUnit tests with the JUnit plugin integrated into the Eclipse IDE because it’s nice, green/red, failure log, stacktrace and stuff.
Instead, when calling from the command line
mvn test, Maven uses the maven-surefire-plugin to execute the tests. In its documentation it says that the default configuration, which I can’t be bothered to change, is to pick up every file name that matches this expressions:
A typo like NullCheckerTests, instead of NullCheckerTest prevents the tests in the class from being executed because the class it’s just ignored during test execution.
The solution it’s easy, following naming conventions, I think it’s nice to call all my test with an ending *Test in the name of the file and class, after all if you’re declaring an xxx test class, so it should be called
XxxTest in a file named
An example of the problem and the relative solution can be found here.
I thought that sharing this issue could be useful if anybody encountered the same problem.
By the way, because of this issue I released version 1.0.5 of utils.
Long time, no see.. It’s been a very busy year to say the least.
I always liked to solve problems, to write code and experiment with stuff, so as you do, I developed some personal projects to try out new things.
I usually develop in Java, using Apache Maven as my build and dependency management tool, in my spare time and at my job too. I’ve noticed that I usually keep my general purpose utilities classes under packages like *.utils or *.helper.
This led to a lot of copy-pasted code all over the place. A lot of methods were also untested. I couldn’t even be bothered to look inside the other projects if there was already what I needed, so I ended up re-writing already existent stuff, that’s for sure.
I finally decided that I’m done with this mess.
I started a project called utils, and I choose that it should be open source and available under the BSD 3-Clause License.
The source code is hosted on GitHub and I put the project under continuous integration testing with a service called Travis CI. I use another service called Codacy that provides automated code analysis. I also discovered another service called JitPack looking around for a quick way to share my artifacts online. The home page of JitPack reads “Easy to use package repository for Git” and I can say that’s really great! It uses maven as the build tool, provides artifacts for sources/javadoc and it’s integrated with GitHub release system (just tag your code on git and you’re good to go basically, artifacts are online usually the order of seconds).
All this services are free for open source and it’s a great technological stack to write good code, check them out.
Here’s what i’ve setup for the project:
utils is open source and in development so, of course suggestions, critics, contributions and whatever are welcome.