null and mysql

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

null and mysql

Ryan Golhar-2
Hi - I'm using DBUnit 2.4.8 to test some Java code.  In doing some, I need to verify some columns are in fact null.  When I specify null for the column value, I get an exception

Caused by: org.dbunit.dataset.datatype.TypeCastException: Unable to typecast value <null> of type <java.lang.String> to INTEGER


If I eliminate the column from my xml dataset, it works okay, but other tests fail because the column count doesn't match.  

I think the easiest thing to do is to provide a way to pass NULL, but can't find it.  Does anyone know how to do this?


On another note, can DBUnit read mysql xml dumps?  There is an implementation of this in DBUnit for PHP, but I  haven't seen it for Java.

Ryan


------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system,
user administration capabilities and model configuration. Take
the hassle out of deploying and managing Subversion and the
tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user
Reply | Threaded
Open this post in threaded view
|

Re: null and mysql

Rafael Vanderlei
I don't know about the ability to read mysql xml dumps, but for the null values in the columns, have you tried using ReplacementDataSet? See [1] for more details.

[1] http://www.dbunit.org/components.html

Rafael.

On Thu, Aug 18, 2011 at 1:32 PM, Ryan Golhar <[hidden email]> wrote:
Hi - I'm using DBUnit 2.4.8 to test some Java code.  In doing some, I need to verify some columns are in fact null.  When I specify null for the column value, I get an exception

Caused by: org.dbunit.dataset.datatype.TypeCastException: Unable to typecast value <null> of type <java.lang.String> to INTEGER


If I eliminate the column from my xml dataset, it works okay, but other tests fail because the column count doesn't match.  

I think the easiest thing to do is to provide a way to pass NULL, but can't find it.  Does anyone know how to do this?


On another note, can DBUnit read mysql xml dumps?  There is an implementation of this in DBUnit for PHP, but I  haven't seen it for Java.

Ryan


------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system,
user administration capabilities and model configuration. Take
the hassle out of deploying and managing Subversion and the
tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user



------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system,
user administration capabilities and model configuration. Take
the hassle out of deploying and managing Subversion and the
tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user
Reply | Threaded
Open this post in threaded view
|

Re: null and mysql

Ryan Golhar-2
That worked, thanks.  

If the addition of a new module to load an xml dump from mysql would be helpful, perhaps I can try to import the php one in java when I have some downtime.

On Thu, Aug 18, 2011 at 2:36 PM, Rafael Vanderlei <[hidden email]> wrote:
I don't know about the ability to read mysql xml dumps, but for the null values in the columns, have you tried using ReplacementDataSet? See [1] for more details.

[1] http://www.dbunit.org/components.html

Rafael.

On Thu, Aug 18, 2011 at 1:32 PM, Ryan Golhar <[hidden email]> wrote:
Hi - I'm using DBUnit 2.4.8 to test some Java code.  In doing some, I need to verify some columns are in fact null.  When I specify null for the column value, I get an exception

Caused by: org.dbunit.dataset.datatype.TypeCastException: Unable to typecast value <null> of type <java.lang.String> to INTEGER


If I eliminate the column from my xml dataset, it works okay, but other tests fail because the column count doesn't match.  

I think the easiest thing to do is to provide a way to pass NULL, but can't find it.  Does anyone know how to do this?


On another note, can DBUnit read mysql xml dumps?  There is an implementation of this in DBUnit for PHP, but I  haven't seen it for Java.

Ryan


------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system,
user administration capabilities and model configuration. Take
the hassle out of deploying and managing Subversion and the
tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user



------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system,
user administration capabilities and model configuration. Take
the hassle out of deploying and managing Subversion and the
tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user



------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system,
user administration capabilities and model configuration. Take
the hassle out of deploying and managing Subversion and the
tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user