Wednesday, June 20, 2012

How to ignore a class in JUnit tests

You may need to ignore a whole class in a test folder, or just a single test in a test case. To do it you should use @Ignore annotation.

This is how you should import it:


To ignore a whole class just add @Ignore annotation to it:

If you do it none of the tests in the ignored class will be called by JUnit. Optionaly you can add a text comment to an ignore annotation:

If you want to ignore only a single test you should write:

or alternatively with text comment:

The other way to ignore a test is to remove @Test annotation. But if you add @Ignore annotation to your test method, JUnit will report that some methods in your test set were ignored and this can be used as a remainder to fix it later.

That's all.
Good luck.

Tuesday, June 12, 2012

How to fix hg error "no tool found to merge"

Hello.

Sometimes merging your changes with changes of other people you may encounter a problem when hg cannot merge a file and displays the following error:

This often happens with binary files, but if it happens with a text file, you are in trouble, because you definitely do not want to merge big files by yourself.
Under the cut I'll show a simple solution for this.

Saturday, June 9, 2012

How to change @author property in Netbeans 7

When you create a new class in Netbeans, it automatically create code like this:

To change the author name you should do the following:

Friday, June 1, 2012

How to install a jar into local Maven repository

Hello.
I often  face a problem when I need to use some Java library in my Maven based project, but this library is not available in any Maven repository and is distributed as a .jar file. In this post I'll describe two ways how to fix this problem.