示例#1
0
 @Test(expected = IllegalStateException.class)
 public void testWrongDate() {
   ExcelRange range = ExcelRange.sheetIndex(0).rowFrom(1).rowTo(2).columnRange("A", "G");
   ExcelRangeData data = instance.readRange(range);
   data.getDate(0, 1);
 }
示例#2
0
  @Test
  public void testReadFixedRows() throws Exception {
    ExcelRange range = ExcelRange.sheetIndex(0).rowFrom(1).rowTo(2).columnRange("A", "G");
    ExcelRangeData data = instance.readRange(range);
    assertEquals(2, data.getRowCount());

    assertEquals("suilink", data.getString(0, 0));
    assertEquals("广州穗灵通讯科技有限公司", data.getString(0, 1));
    assertTrue(DateUtils.isSameDay(data.getDate(0, 2), parseDate(2002, 7, 1)));
    assertNull(data.getDate(0, 3));
    assertEquals(1, data.getInt(0, 4).intValue());
    assertEquals(1L, data.getLong(0, 4).longValue());
    assertEquals(1.0, data.getDouble(0, 4).doubleValue(), 0.0001);
    assertNull(data.getDate(0, 5));
    assertFalse(data.getBoolean(0, 6));
    assertTrue(data.getBoolean(1, 6));
  }