I do not want to use the Xml/dtd files to create a IDataSet
in my dbunit Java
class that extends DatabaseTestCase
, Can it be created using a List<myOjectInstances> objs;
I can't find any other solutions. Thanks
How about DefaultDataSet
intialized by a DefaultTable
? The latter can be easily constructed in code from one or more lists:
DefaultTable fourColTable = new DefaultTable("4COLUMNTABLE",
new Column[] {
new Column("COL1", DataType.BIGINT),
new Column("COL2", DataType.BIGINT),
new Column("COL3", DataType.VARCHAR),
new Column("COL4", DataType.VARCHAR)
});
for (int i = 0; i < someVal; i++)
fourColTable.addRow(new Object[] { list1.get(i), list2.get(i), ..., ... });
DefaultDataSet dds = new DefaultDataSet(fourColTable);
EDIT: If you want to insert many tables into a data sent, try it like this:
ITable[] tables = { new DefaultTable(...), new DefaultTable(...), ... };