use of com.hazelcast.sql.SqlColumnType.OBJECT in project hazelcast by hazelcast.
the class BetweenOperatorIntegrationTest method checkValues.
protected void checkValues(String sql, SqlColumnType expectedType, Object[] expectedResults, Object... params) {
List<SqlRow> rows = execute(sql, params);
assertEquals(expectedResults.length, rows.size());
if (rows.size() == 0) {
return;
}
if (rows.get(0).getObject(0) instanceof Integer) {
rows.sort(Comparator.comparingInt(a -> a.getObject(0)));
} else if (rows.get(0).getObject(0) instanceof Comparable) {
rows.sort((a, b) -> ((Comparable<?>) a.getObject(0)).compareTo(b.getObject(0)));
}
for (int i = 0; i < expectedResults.length; i++) {
SqlRow row = rows.get(i);
assertEquals(expectedType, row.getMetadata().getColumn(0).getType());
assertEquals(expectedResults[i], row.getObject(0));
}
}
Aggregations