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