Search in sources :

Example 1 with BigQueryError

use of com.google.cloud.bigquery.BigQueryError in project google-cloud-java by GoogleCloudPlatform.

the class ITBigQueryTest method testUpdateNonExistingTable.

@Test
public void testUpdateNonExistingTable() {
    TableInfo tableInfo = TableInfo.of(TableId.of(DATASET, "test_update_non_existing_table"), StandardTableDefinition.of(SIMPLE_SCHEMA));
    try {
        bigquery.update(tableInfo);
        fail("BigQueryException was expected");
    } catch (BigQueryException e) {
        BigQueryError error = e.getError();
        assertNotNull(error);
        assertEquals("notFound", error.getReason());
        assertNotNull(error.getMessage());
    }
}
Also used : BigQueryError(com.google.cloud.bigquery.BigQueryError) TableInfo(com.google.cloud.bigquery.TableInfo) BigQueryException(com.google.cloud.bigquery.BigQueryException) Test(org.junit.Test)

Aggregations

BigQueryError (com.google.cloud.bigquery.BigQueryError)1 BigQueryException (com.google.cloud.bigquery.BigQueryException)1 TableInfo (com.google.cloud.bigquery.TableInfo)1 Test (org.junit.Test)1