File tree Expand file tree Collapse file tree
google-cloud-clients/google-cloud-bigquery/src
main/java/com/google/cloud/bigquery
test/java/com/google/cloud/bigquery Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -180,7 +180,9 @@ static final class BuilderImpl extends Builder {
180180 this .statistics = JobStatistics .fromPb (jobPb );
181181 }
182182 this .userEmail = jobPb .getUserEmail ();
183- this .configuration = JobConfiguration .fromPb (jobPb .getConfiguration ());
183+ if (jobPb .getConfiguration () != null ) {
184+ this .configuration = JobConfiguration .fromPb (jobPb .getConfiguration ());
185+ }
184186 }
185187
186188 @ Override
@@ -375,7 +377,9 @@ Job toPb() {
375377 if (statistics != null ) {
376378 jobPb .setStatistics (statistics .toPb ());
377379 }
378- jobPb .setConfiguration (configuration .toPb ());
380+ if (configuration != null ){
381+ jobPb .setConfiguration (configuration .toPb ());
382+ }
379383 return jobPb ;
380384 }
381385
Original file line number Diff line number Diff line change @@ -523,6 +523,16 @@ public void testToAndFromPb() {
523523 compareJob (expectedJob , Job .fromPb (serviceMockReturnsOptions , expectedJob .toPb ()));
524524 }
525525
526+ @ Test
527+ public void testToAndFromPbWithoutConfiguration () {
528+ JobInfo jobInfo =
529+ JobInfo .newBuilder (null )
530+ .build ();
531+ initializeExpectedJob (4 , jobInfo );
532+ replay (bigquery );
533+ compareJob (expectedJob , Job .fromPb (serviceMockReturnsOptions , expectedJob .toPb ()));
534+ }
535+
526536 private void compareJob (Job expected , Job value ) {
527537 assertEquals (expected , value );
528538 compareJobInfo (expected , value );
You can’t perform that action at this time.
0 commit comments