/** Example of updating the table's information. */ // [TARGET update(TableOption...)] public Table update() { // [START ] Table updatedTable = table.toBuilder().setDescription("new description").build().update(); // [END ] return updatedTable; }
@Test public void testUpdate() { initializeExpectedTable(4); Table expectedUpdatedTable = expectedTable.toBuilder().setDescription("Description").build(); expect(bigquery.getOptions()).andReturn(mockOptions); expect(bigquery.update(eq(expectedTable))).andReturn(expectedUpdatedTable); replay(bigquery); initializeTable(); Table actualUpdatedTable = table.update(); compareTable(expectedUpdatedTable, actualUpdatedTable); }
@Test public void testUpdateWithOptions() { initializeExpectedTable(4); Table expectedUpdatedTable = expectedTable.toBuilder().setDescription("Description").build(); expect(bigquery.getOptions()).andReturn(mockOptions); expect(bigquery.update(eq(expectedTable), eq(BigQuery.TableOption.fields()))) .andReturn(expectedUpdatedTable); replay(bigquery); initializeTable(); Table actualUpdatedTable = table.update(BigQuery.TableOption.fields()); compareTable(expectedUpdatedTable, actualUpdatedTable); }
.build()) .build() .update(BigQuery.TableOption.fields(BigQuery.TableField.TIME_PARTITIONING)); assertThat( ((StandardTableDefinition) table.getDefinition()) .build()) .build() .update(BigQuery.TableOption.fields(BigQuery.TableField.TIME_PARTITIONING)); assertThat( ((StandardTableDefinition) table.getDefinition())