1 21 22 package org.dbunit.dataset.xml; 23 24 import org.dbunit.dataset.AbstractTableTest; 25 import org.dbunit.dataset.Column; 26 import org.dbunit.dataset.IDataSet; 27 import org.dbunit.dataset.ITable; 28 29 import java.io.File ; 30 31 36 public class FlatXmlTableTest extends AbstractTableTest 37 { 38 public FlatXmlTableTest(String s) 39 { 40 super(s); 41 } 42 43 protected ITable createTable() throws Exception 44 { 45 return createDataSet(true).getTable("TEST_TABLE"); 46 } 47 48 protected IDataSet createDataSet(boolean noneAsNull) throws Exception 49 { 50 return new FlatXmlDataSet(new File ("src/xml/flatXmlTableTest.xml")); 51 } 52 53 public void testGetMissingValue() throws Exception 54 { 55 int row = 0; 56 Object [] expected = {"row 1 col 0", null, "row 1 col 2"}; 57 58 ITable table = createDataSet(false).getTable("MISSING_VALUES"); 59 60 Column[] columns = table.getTableMetaData().getColumns(); 61 assertEquals("column count", expected.length, columns.length); 62 assertEquals("row count", 1, table.getRowCount()); 63 for (int i = 0; i < columns.length; i++) 64 { 65 assertEquals("value " + i, expected[i], 66 table.getValue(row, columns[i].getColumnName())); 67 } 68 } 69 70 79 } 80 81 82 83 84 85 86 87 88 89 | Popular Tags |