static int toInteger(final JsonNode object) {
    if (object instanceof NumericNode) {
      return object.intValue();
    }
    if (object instanceof TextNode) {
      try {
        return Integer.parseInt(object.textValue());
      } catch (final NumberFormatException e) {
        throw failedStringCoercionException(SqlBaseType.INTEGER);
      }
    }
    throw invalidConversionException(object, SqlBaseType.INTEGER);
  }
@Test
  public void shouldConvertDoubleToIntCorrectly() {
    final Integer i = JsonSerdeUtils.toInteger(JsonNodeFactory.instance.numberNode(1.0d));
    assertThat(i, equalTo(1));
  }