Syntax Highlighter CSS (shCore.css)

Syntax Highlighter CSS (shThemeDefault.css)

Syntax Highlighter JS (shCore.js)

Syntax Highlighter JS (shAutoloader)

Highlight CSS (default.css)

Highlight JS (highlight.pack.js)

Syntax Highlighter CSS (custom.css)

Thursday, October 25, 2007

DbUnit gotchas on inserting data

If you have an XML dataset that looks something like this:

<orders id="1" date_paid="2000-07-01"/>
<orders id="2" date_paid="2000-04-01" date_voided="2000-04-02"/>
<orders id="3" date_paid="2000-03-01" date_voided="2000-03-02"/>
<orders id="4" date_paid="2000-02-01" date_voided="2000-02-02"/>
<orders id="5" date_paid="2000-01-02" email=""/>

You might be stumped when you run your test and DbUnit won't insert data into the date_voided and email columns (I know I was). Apparently, DbUnit will use the first <orders> element as a template (eg insert into orders(id, date_created, date_paid) values(...)), thus ignoring the other columns. The solution is to change your first element to make all the relevant columns null or some default value:

<orders id="1" date_paid="2000-07-01" date_voided="[null]" email="[null]"/>
Post a Comment