Comparing binary column

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Comparing binary column

Shaer, Ofira
Hi Everybody.
 
I am using dbunit to compare certain tables content with an xml image.
One of the tables have a binary column. When the comparison fails, I get a totally gibberish message:
 
junit.framework.ComparisonFailure: value (table=PUNIQUE, row=0, col=PACKET) expected:<[kD9CARBlhjEAAAACkhAD6AAAAAAAAAAAAAAAAAAAcgIAARkALZYBpnYeVTAwMDAwMDBOAAABGmdo
J163IwAAAAYAAAAAAAAASAAAAAAAAAAAAAAAIRAAAPD6DglIAAAA6DIRCWAGKQA5AwAAYAYpADgD
AAB4+w4JYAYpAEgAAABgBikA8PoOCckDAAB4shwAyAMAAOj6DglgBikAeP0oAGAGKQDo+Q4JVNf/
vw==]> but was:<[[B@8c1dd9]>
 
 
I debugged it and found there is one byte that fails the comparison(expected 39, found 7) - why don't I simply get the not equal byte values, but the above weird string?
Anyway to fix that?
 
 
Thanks.
Ofira.
 
 


This e-mail is confidential, the property of NDS Ltd and intended for the addressee only. Any dissemination, copying or distribution of this message or any attachments by anyone other than the intended recipient is strictly prohibited. If you have received this message in error, please immediately notify the [hidden email] and destroy the original message. Messages sent to and from NDS may be monitored. NDS cannot guarantee any message delivery method is secure or error-free. Information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. We do not accept responsibility for any errors or omissions in this message and/or attachment that arise as a result of transmission. You should carry out your own virus checks before opening any attachment. Any views or opinions presented are solely those of the author and do not necessarily represent those of NDS.

To protect the environment please do not print this e-mail unless necessary.

NDS Limited Registered Office: One London Road, Staines,Middlesex TW18 4EX, United Kingdom. A company registered in England and Wales Registered no. 3080780 VAT no. GB 603 8808 40-00

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user
Reply | Threaded
Open this post in threaded view
|

Re: Comparing binary column

Luiz Eduardo Guida Valmont-2
Ofira,

AFAIK, or rather AFAIRemember, JUnit calls toString on the object passed to the asserting methods. That said, it is rather strange that your failure outputs expected and actual values differently. Were they instances of the same class, there'd be no reason for them to be output so differently. So... are you sure the objects you are actually handing to the assert method are of the same class?

Also, can you send the test lines that declare/import these object's classes?

Meanwhile, try debugging the result of "getClass().getName()" on the aforementioned objects. Imho, they should be output in a similar fashion, even if the output is gidderish.

Regards,
Luiz

2009/6/14 Shaer, Ofira <[hidden email]>
Hi Everybody.
 
I am using dbunit to compare certain tables content with an xml image.
One of the tables have a binary column. When the comparison fails, I get a totally gibberish message:
 
junit.framework.ComparisonFailure: value (table=PUNIQUE, row=0, col=PACKET) expected:<[kD9CARBlhjEAAAACkhAD6AAAAAAAAAAAAAAAAAAAcgIAARkALZYBpnYeVTAwMDAwMDBOAAABGmdo
J163IwAAAAYAAAAAAAAASAAAAAAAAAAAAAAAIRAAAPD6DglIAAAA6DIRCWAGKQA5AwAAYAYpADgD
AAB4+w4JYAYpAEgAAABgBikA8PoOCckDAAB4shwAyAMAAOj6DglgBikAeP0oAGAGKQDo+Q4JVNf/
vw==]> but was:<[[B@8c1dd9]>
 
 
I debugged it and found there is one byte that fails the comparison(expected 39, found 7) - why don't I simply get the not equal byte values, but the above weird string?
Anyway to fix that?
 
 
Thanks.
Ofira.
 
 


This e-mail is confidential, the property of NDS Ltd and intended for the addressee only. Any dissemination, copying or distribution of this message or any attachments by anyone other than the intended recipient is strictly prohibited. If you have received this message in error, please immediately notify the [hidden email] and destroy the original message. Messages sent to and from NDS may be monitored. NDS cannot guarantee any message delivery method is secure or error-free. Information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. We do not accept responsibility for any errors or omissions in this message and/or attachment that arise as a result of transmission. You should carry out your own virus checks before opening any attachment. Any views or opinions presented are solely those of the author and do not necessarily represent those of NDS.

To protect the environment please do not print this e-mail unless necessary.

NDS Limited Registered Office: One London Road, Staines,Middlesex TW18 4EX, United Kingdom. A company registered in England and Wales Registered no. 3080780 VAT no. GB 603 8808 40-00

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user



------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user