File tree 2 files changed +16
-2
lines changed
google-cloud-clients/google-cloud-bigquery/src
main/java/com/google/cloud/bigquery
test/java/com/google/cloud/bigquery
2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -180,7 +180,9 @@ static final class BuilderImpl extends Builder {
180
180
this .statistics = JobStatistics .fromPb (jobPb );
181
181
}
182
182
this .userEmail = jobPb .getUserEmail ();
183
- this .configuration = JobConfiguration .fromPb (jobPb .getConfiguration ());
183
+ if (jobPb .getConfiguration () != null ) {
184
+ this .configuration = JobConfiguration .fromPb (jobPb .getConfiguration ());
185
+ }
184
186
}
185
187
186
188
@ Override
@@ -375,7 +377,9 @@ Job toPb() {
375
377
if (statistics != null ) {
376
378
jobPb .setStatistics (statistics .toPb ());
377
379
}
378
- jobPb .setConfiguration (configuration .toPb ());
380
+ if (configuration != null ){
381
+ jobPb .setConfiguration (configuration .toPb ());
382
+ }
379
383
return jobPb ;
380
384
}
381
385
Original file line number Diff line number Diff line change @@ -523,6 +523,16 @@ public void testToAndFromPb() {
523
523
compareJob (expectedJob , Job .fromPb (serviceMockReturnsOptions , expectedJob .toPb ()));
524
524
}
525
525
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
+
526
536
private void compareJob (Job expected , Job value ) {
527
537
assertEquals (expected , value );
528
538
compareJobInfo (expected , value );
You can’t perform that action at this time.
0 commit comments