Search in sources :

Example 6 with QueryTester

use of io.crate.testing.QueryTester in project crate by crate.

the class ByteColumnReferenceTest method testByteExpression.

@Test
public void testByteExpression() throws Exception {
    QueryTester.Builder builder = new QueryTester.Builder(createTempDir(), THREAD_POOL, clusterService, Version.CURRENT, "create table t (x byte)");
    builder.indexValues("x", IntStream.range(-2, 3).boxed().toArray());
    try (QueryTester tester = builder.build()) {
        List<Object> objects = tester.runQuery("x", "true");
        assertThat(objects, Matchers.contains((byte) -2, (byte) -1, (byte) 0, (byte) 1, (byte) 2));
    }
}
Also used : QueryTester(io.crate.testing.QueryTester) Test(org.junit.Test) CrateDummyClusterServiceUnitTest(io.crate.test.integration.CrateDummyClusterServiceUnitTest)

Aggregations

QueryTester (io.crate.testing.QueryTester)6 CrateDummyClusterServiceUnitTest (io.crate.test.integration.CrateDummyClusterServiceUnitTest)5 Test (org.junit.Test)5 ArrayType (io.crate.types.ArrayType)1 List (java.util.List)1 Supplier (java.util.function.Supplier)1