|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
FlatXmlDataSet Expected data when data has carriage returns and tabs in whitespaceHi I am using DbUnit 2.2.2 to test a XML data load process (where I perform several transformations). Some of the data has carriage returns and tabs as whitespace. If I use FlatXmlDataSet then I get errors on these fields (with carriage returns and tabs in whitespace) Example: junit.framework.AssertionFailedError: value (table=COUNTRY, row=8, col=COUNTRY_NAME): expected:<NETHERLANDS ANTILLES (Curacao, Bonaire, St Eustatius, Saba & south St Martin> but was:<NETHERLANDS ANTILLES (Curacao, Bonaire, St Eustatius, Saba & south St Martin> Interestingly when I look at the FlatXmlDataSet file (which I would like to use as expected results) then there are the tabs and line space in it for the expected results (as there are in the database). It seems that when I do the assertion this is somehow missing When I use XmlDataSet (with expected results created by exporting with “xml” format) then I do not get this problem BUT I do not get any comparison for CDATA elements which means any data with spaces – not really what I want Is this expected behaviour? Code used: public TableChecker(String expectedResultsFile, IDataSet databaseDataSet) throws Exception { expectedDataSet = new FlatXmlDataSet(getClass().getResourceAsStream(expectedResultsFile)); //expectedDataSet = new XmlDataSet(getClass().getResourceAsStream(expectedResultsFile)); this.databaseDataSet = databaseDataSet; } public void checkCountry() throws Exception { ITable expectedTable = expectedDataSet.getTable("COUNTRY"); ITable actualTable = databaseDataSet.getTable("COUNTRY"); logger.debug("Checking database against expected results - COUNTRY"); Assertion.assertEquals(expectedTable, actualTable); } office: +44-(0)117 3024378 mobile: +44-(0)7720 425253 email: steven.hicks@... British Telecommunications plc This electronic message contains information from British Telecommunications plc which may be privileged and confidential. The information is intended to be for the use of the individual(s) or entity named above. If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. If you have received this electronic message in error, please notify us by telephone or e-mail (to the number or address above) immediately
------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ dbunit-user mailing list dbunit-user@... https://lists.sourceforge.net/lists/listinfo/dbunit-user |
|
|
Re: FlatXmlDataSet Expected data when data has carriage returns and tabs in whitespaceNot really an answer so much as a couple more pieces of related data:
I upload and import data from xml using " " for newline in order for them to be properly parsed. And, as you mentioned, when I download and export data to xml, it contains embedded newlines inside the CDATA, instead of the newlines. Not sure if that is somehow helpful or not.... -Mike On 5/13/08, steven.hicks@... <steven.hicks@...> wrote: > > > > Hi > > I am using DbUnit 2.2.2 to test a XML data load process (where I perform > several transformations). Some of the data has carriage returns and tabs as > whitespace. > > If I use FlatXmlDataSet then I get errors on these fields (with carriage > returns and tabs in whitespace) > > Example: > > junit.framework.AssertionFailedError: value (table=COUNTRY, > row=8, col=COUNTRY_NAME): expected:<NETHERLANDS ANTILLES (Curacao, Bonaire, > St Eustatius, Saba & south St Martin> but was:<NETHERLANDS ANTILLES > (Curacao, Bonaire, St Eustatius, > > Saba & south St Martin> > > Interestingly when I look at the FlatXmlDataSet file (which I would like to > use as expected results) then there are the tabs and line space in it for > the expected results (as there are in the database). It seems that when I do > the assertion this is somehow missing > > When I use XmlDataSet (with expected results created by exporting with "xml" > format) then I do not get this problem BUT I do not get any comparison for > CDATA elements which means any data with spaces – not really what I want > > Is this expected behaviour? > > > Code used: > > public TableChecker(String expectedResultsFile, IDataSet databaseDataSet) > throws Exception { > > expectedDataSet = new > FlatXmlDataSet(getClass().getResourceAsStream(expectedResultsFile)); > > //expectedDataSet = new > XmlDataSet(getClass().getResourceAsStream(expectedResultsFile)); > > this.databaseDataSet = databaseDataSet; > > } > > public void checkCountry() throws Exception { > > ITable expectedTable = expectedDataSet.getTable("COUNTRY"); > > ITable actualTable = databaseDataSet.getTable("COUNTRY"); > > logger.debug("Checking database against expected results - > COUNTRY"); > > Assertion.assertEquals(expectedTable, actualTable); > > } > > Steve Hicks > > > office: +44-(0)117 3024378 > > mobile: +44-(0)7720 425253 > > email: steven.hicks@... > > British Telecommunications plc > Registered office: 81 Newgate Street London EC1A 7AJ > Registered in England no. 1800000 > > This electronic message contains information from British Telecommunications > plc which may be privileged and confidential. The information is intended to > be for the use of the individual(s) or entity named above. If you are not > the intended recipient, be aware that any disclosure, copying, distribution > or use of the contents of this information is prohibited. If you have > received this electronic message in error, please notify us by telephone or > e-mail (to the number or address above) immediately > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > dbunit-user mailing list > dbunit-user@... > https://lists.sourceforge.net/lists/listinfo/dbunit-user > > ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ dbunit-user mailing list dbunit-user@... https://lists.sourceforge.net/lists/listinfo/dbunit-user |
| Free Forum Powered by Nabble | Forum Help |