sebastianbergmann/dbunit — pull request #109 by melton1968 (2013-11-12 05:45:16+00:00)
Title: Issue #76: CompositeDataSet: Mismatching documentation and implementation

This pull request addresses Issue #76 referenced in the title.

From the Issue comments, CompositeDataSet's documentation (version 3.7) states that when several datasets contain the same table the rows are appended in the specified order. The implementation throws an exception when multiple data sets define the same table as describe in the function comments.

Based on the comments in Issue #76, the following code change modifies CompositeDataSet's behavior to match the documentation. In particular, the addDataSet function is changed such that:

If the new data set defines a table that already exists in the composite, then the rows from the table in the new data set are appended in order to the existing table in the composite. If two tables have non-matching meta-data, an exception is thrown.

There was an additional suggestion in the comments for Issue #76 related to table implementations that could not represent an empty table and the table meta-data simultaneously. I could not identify a simple, clean change that would allow CompositeDataSet to handle merging an empty table with no meta-data with a table with rows and meta-data without modifying the data sets already inserted into the composite. I did not address this issue.

I have tested this change using tables with both matching meta-data and mis-matched meta-data.