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 import java.io.FileReader ; 31 import java.io.Reader ; 32 33 38 public class XmlTableTest extends AbstractTableTest 39 { 40 public XmlTableTest(String s) 41 { 42 super(s); 43 } 44 45 protected ITable createTable() throws Exception 46 { 47 return createDataSet().getTable("TEST_TABLE"); 48 } 49 50 protected IDataSet createDataSet() throws Exception 51 { 52 Reader in = new FileReader ( 53 new File ("src/xml/xmlTableTest.xml")); 54 return new XmlDataSet(in); 55 } 56 57 public void testGetMissingValue() throws Exception 58 { 59 Object [] expected = {null, ITable.NO_VALUE, "value", "", " ", ITable.NO_VALUE}; 60 61 ITable table = createDataSet().getTable("MISSING_AND_NULL_VALUES"); 62 63 Column[] columns = table.getTableMetaData().getColumns(); 64 assertEquals("column count", expected.length, columns.length); 65 for (int i = 0; i < columns.length; i++) 66 { 67 assertEquals("value " + i, expected[i], 68 table.getValue(0, columns[i].getColumnName())); 69 } 70 } 71 72 } 73 74 75 76 77 78 | Popular Tags |