コード例 #1
0
  @Test
  public void testNumberIsHandledAsNumber() throws Exception {
    Table table = dataContext.getDefaultSchema().getTableByName(peopleIndexType);
    Column column = table.getColumnByName("age");
    ColumnType type = column.getType();
    assertEquals(ColumnType.BIGINT, type);

    DataSet dataSet = dataContext.query().from(table).select(column).execute();
    while (dataSet.next()) {
      Object value = dataSet.getRow().getValue(column);
      assertTrue(
          "Got class: " + value.getClass() + ", expected Number (or subclass)",
          value instanceof Number);
    }
  }
コード例 #2
0
  @Test
  public void testDateIsHandledAsDate() throws Exception {
    Table table = dataContext.getDefaultSchema().getTableByName("tweet1");
    Column column = table.getColumnByName("postDate");
    ColumnType type = column.getType();
    assertEquals(ColumnType.DATE, type);

    DataSet dataSet = dataContext.query().from(table).select(column).execute();
    while (dataSet.next()) {
      Object value = dataSet.getRow().getValue(column);
      assertTrue(
          "Got class: " + value.getClass() + ", expected Date (or subclass)",
          value instanceof Date);
    }
  }