Hi,
I have the following in my test:
> public void assertSubscToNot(Vector zeroTimesSignal,
> Vector moreThanOneTimesSignal,
> Vector nullRequestSignal) {
> assertEquals("Subscription occurred >1 time. ", 0,
> moreThanOneTimesSignal.size());
> assertEquals("Subscription occurred 0 times. ", 0,
> zeroTimesSignal.size());
> assertEquals("Null request signal ", 0, nullRequestSignal.size());
> }
The problem i have is that I need to print the content of the Vector
when it is unequal. Any hints on how I can do this?
cheers,
//miakel
Bart Cremers - 05 Apr 2006 12:55 GMT
You can wrap the assertEquals statements in a try/catch statement:
try {
assertEquals(...);
} catch (AssertionFailedError e) {
// Print contents here
throw e; // Rethrow to make the test fail.
}
Regards,
Bart