posted 19 years ago
[EFH]: I think this falls under the "Yes, that'd be cute" category.
I'd put it in the "Yes, Java's designers should be kicking themselves for not including better methods for arrays from the beginning" category. But either way, I agree it's not likely to happen now; the window of opportunity was missed.
[Serge]: Yeah Jeanne, this could be a workaround, but doesn't work if you have classes that extend Assert, not my base test case.
Sure it works - with minor modifications to what Jeanne said. Make your new method static, just like all the other asserts in JUnit's Assert class. Then you can call it quite easily with something like "MyAssertionClass.assertArraysEqual(arr1, arr2);". If you don't like typing the "MyAssertionClass", well JDK 1.5 allows you static imports. But that's a minor issue. It's quite easy to call public static methods from anywhere you want; it just takes a tiny bit more typing.
"I'm not back." - Bill Harding, Twister