Search in sources :

Example 1 with BigQuerySQLException

use of com.google.cloud.bigquery.BigQuerySQLException in project java-bigquery by googleapis.

the class ITNightlyBigQueryTest method testInvalidQuery.

@Test
public void testInvalidQuery() throws BigQuerySQLException {
    Connection connection = getConnection();
    try {
        BigQueryResult bigQueryResult = connection.executeSelect(INVALID_QUERY);
        fail("BigQuerySQLException was expected");
    } catch (BigQuerySQLException ex) {
        assertNotNull(ex.getMessage());
        assertTrue(ex.getMessage().toLowerCase().contains("unexpected keyword into"));
    } finally {
        connection.close();
    }
}
Also used : BigQuerySQLException(com.google.cloud.bigquery.BigQuerySQLException) Connection(com.google.cloud.bigquery.Connection) BigQueryResult(com.google.cloud.bigquery.BigQueryResult) Test(org.junit.Test)

Aggregations

BigQueryResult (com.google.cloud.bigquery.BigQueryResult)1 BigQuerySQLException (com.google.cloud.bigquery.BigQuerySQLException)1 Connection (com.google.cloud.bigquery.Connection)1 Test (org.junit.Test)1