Do you feel sometimes limited with the assert statment that JUnit
offers? Well I was and while I wanted to check that two char arrays are
different I've found a cool new feature of JUnit: Hamcrest. See how you
could check that two arrays are different:
assertThat(arrayOne,not(arrayTwo));
That's it. I've seen such expressions a lot when articles try to sell
me a cool new scripting language but I haven't been aware that you
could do this also in Java.
Oh wait, you need two static import statements to get it work:
import static
org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
Page where I've found the tip: Stackoverflow
Update 2011-03-31:
Today I've found the reason why I haven't used this cool feature. It
isn't shipped with Eclipse 3.4 which I have to use at work.