@@ -552,6 +552,20 @@ public void testCreateTable() {
552552 assertEquals (new Table (bigquery , new TableInfo .BuilderImpl (tableInfo )), table );
553553 }
554554
555+ @ Test
556+ public void testCreateTableWithoutProject () {
557+ TableInfo tableInfo = TABLE_INFO .setProjectId (PROJECT );
558+ TableId tableId = TableId .of ("" , TABLE_ID .getDataset (), TABLE_ID .getTable ());
559+ tableInfo .toBuilder ().setTableId (tableId );
560+ EasyMock .expect (bigqueryRpcMock .create (tableInfo .toPb (), EMPTY_RPC_OPTIONS ))
561+ .andReturn (tableInfo .toPb ());
562+ EasyMock .replay (bigqueryRpcMock );
563+ BigQueryOptions bigQueryOptions = createBigQueryOptionsForProject (PROJECT , rpcFactoryMock );
564+ bigquery = bigQueryOptions .getService ();
565+ Table table = bigquery .create (tableInfo );
566+ assertEquals (new Table (bigquery , new TableInfo .BuilderImpl (tableInfo )), table );
567+ }
568+
555569 @ Test
556570 public void testCreateTableWithSelectedFields () {
557571 Capture <Map <BigQueryRpc .Option , Object >> capturedOptions = Capture .newInstance ();
@@ -728,6 +742,16 @@ public void testDeleteTableFromTableIdWithProject() {
728742 assertTrue (bigquery .delete (tableId ));
729743 }
730744
745+ @ Test
746+ public void testDeleteTableFromTableIdWithoutProject () {
747+ TableId tableId = TableId .of ("" , TABLE_ID .getDataset (), TABLE_ID .getTable ());
748+ EasyMock .expect (bigqueryRpcMock .deleteTable (PROJECT , DATASET , TABLE )).andReturn (true );
749+ EasyMock .replay (bigqueryRpcMock );
750+ BigQueryOptions bigQueryOptions = createBigQueryOptionsForProject (PROJECT , rpcFactoryMock );
751+ bigquery = bigQueryOptions .getService ();
752+ assertTrue (bigquery .delete (tableId ));
753+ }
754+
731755 @ Test
732756 public void testUpdateTable () {
733757 TableInfo updatedTableInfo =
@@ -741,6 +765,20 @@ public void testUpdateTable() {
741765 assertEquals (new Table (bigquery , new TableInfo .BuilderImpl (updatedTableInfo )), table );
742766 }
743767
768+ @ Test
769+ public void testUpdateTableWithoutProject () {
770+ TableInfo tableInfo = TABLE_INFO .setProjectId (PROJECT );
771+ TableId tableId = TableId .of ("" , TABLE_ID .getDataset (), TABLE_ID .getTable ());
772+ tableInfo .toBuilder ().setTableId (tableId );
773+ EasyMock .expect (bigqueryRpcMock .patch (tableInfo .toPb (), EMPTY_RPC_OPTIONS ))
774+ .andReturn (tableInfo .toPb ());
775+ EasyMock .replay (bigqueryRpcMock );
776+ BigQueryOptions bigQueryOptions = createBigQueryOptionsForProject (PROJECT , rpcFactoryMock );
777+ bigquery = bigQueryOptions .getService ();
778+ Table table = bigquery .update (tableInfo );
779+ assertEquals (new Table (bigquery , new TableInfo .BuilderImpl (tableInfo )), table );
780+ }
781+
744782 @ Test
745783 public void testUpdateTableWithSelectedFields () {
746784 Capture <Map <BigQueryRpc .Option , Object >> capturedOptions = Capture .newInstance ();
0 commit comments