Sunday, February 04, 2007

TestNG and JUnit Have The Same Bug in Primitive Array

In my previous post about incorrect result for JUnit against primitive array type. I run the same test case with TestNG, it seems like it has the same wrong result as JUnit:

Test case:

@Test
public void intArr() {
int[] intArr00 = {1};
int[] intArr01 = {1};
assertEquals(intArr00, intArr01);
}

Test result:
FAILED: intArr
java.lang.AssertionError: expected:<[I@127734f> but was:<[I@1037c71>
at SimpleTest.intArr(SimpleTest.java:18)

Andres Almiray suggested to try ArrayAssertions from EZMorph.