Sunday, February 04, 2007

Working Way To Test Primitive Array

I have tried Andres's EZMorph. By using his ArrayAssertions, the below simple test case finally passed successfully.

@Test
public void intArr() {
int[] intArr00 = {1};
int[] intArr01 = {1};
ArrayAssertions.assertEquals(intArr00, intArr01);
}
I have tested with my another test case that involves int array of 6 elements and it passed a well. If your test class only contains primitive array, you can just replace your import class import static org.testng.Assert.*; with import static net.sf.ezmorph.test.ArrayAssertions.*; without changing piece of your code.



1 comments:

Andres Almiray said...

I'm glad that it finally worked for you :-)