当前位置: 首页>>代码示例>>Java>>正文


Java IDataSet.iterator方法代码示例

本文整理汇总了Java中org.dbunit.dataset.IDataSet.iterator方法的典型用法代码示例。如果您正苦于以下问题:Java IDataSet.iterator方法的具体用法?Java IDataSet.iterator怎么用?Java IDataSet.iterator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.dbunit.dataset.IDataSet的用法示例。


在下文中一共展示了IDataSet.iterator方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testLoadDataSet_lessColumnsLast

import org.dbunit.dataset.IDataSet; //导入方法依赖的package包/类
/**
   * Test the loading of a data set with 2 rows for a table, but the second
   * row has less columns than the first one.
   */
  @Test
  public void testLoadDataSet_lessColumnsLast() throws Exception {
      MultiSchemaDataSet result = multiSchemaXmlDataSetReader.readDataSetXml(toFile(getClass().getResource("LessColumnsLastDataSet.xml")));

      // there should be 1 dataset for the default schema A
      assertLenientEquals(new String[]{"SCHEMA_A"}, result.getSchemaNames());

      // the dataset should contain 2 tables with the same name
      IDataSet dataSet = result.getDataSetForSchema("SCHEMA_A");
      assertLenientEquals(new String[]{"TABLE_A"}, dataSet.getTableNames());
      assertEquals(2, dataSet.getTable("TABLE_A").getRowCount());
      ITableIterator tableIterator = dataSet.iterator();

      // first table TABLE_A row should contain 3 columns
      assertTrue(tableIterator.next());
      ITable table = tableIterator.getTable();
      assertEquals(2, table.getRowCount());
      assertPropertyLenientEquals("columnName", asList("COLUMN_1", "COLUMN_2", "COLUMN_3"), asList(table.getTableMetaData().getColumns()));
      assertEquals("1", table.getValue(0, "COLUMN_1"));
      assertEquals("2", table.getValue(0, "COLUMN_2"));
      assertEquals("3", table.getValue(0, "COLUMN_3"));
}
 
开发者ID:linux-china,项目名称:unitils,代码行数:27,代码来源:MultiSchemaXmlDataSetReaderTest.java

示例2: testLoadDataSet_lessColumnsFirst

import org.dbunit.dataset.IDataSet; //导入方法依赖的package包/类
/**
 * Test the loading of a data set with 2 rows for a table, but the first
 * row has less columns than the second one.
 */
@Test
public void testLoadDataSet_lessColumnsFirst() throws Exception {
    MultiSchemaDataSet result = multiSchemaXmlDataSetReader.readDataSetXml(toFile(getClass().getResource("LessColumnsFirstDataSet.xml")));

    // there should be 1 dataset for the default schema A
    assertLenientEquals(new String[]{"SCHEMA_A"}, result.getSchemaNames());

    // the dataset should contain 2 tables with the same name
    IDataSet dataSet = result.getDataSetForSchema("SCHEMA_A");
    assertLenientEquals(new String[]{"TABLE_A"}, dataSet.getTableNames());
    assertEquals(2, dataSet.getTable("TABLE_A").getRowCount());
    ITableIterator tableIterator = dataSet.iterator();

    // first table TABLE_A row should contain 1 column
    assertTrue(tableIterator.next());
    ITable table = tableIterator.getTable();
    assertPropertyLenientEquals("columnName", asList("COLUMN_1", "COLUMN_2", "COLUMN_3"), asList(table.getTableMetaData().getColumns()));
    assertEquals(2, table.getRowCount());
    assertEquals("4", table.getValue(0, "COLUMN_2"));
}
 
开发者ID:linux-china,项目名称:unitils,代码行数:25,代码来源:MultiSchemaXmlDataSetReaderTest.java


注:本文中的org.dbunit.dataset.IDataSet.iterator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。