Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2006

Tip: Looking for answers? Try searching our database.

print the content of Vector in assertEquals()

Thread view: 
Petterson Mikael - 05 Apr 2006 12:44 GMT
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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.