Skip to content
This repository was archived by the owner on Nov 9, 2023. It is now read-only.

Commit 8471fc8

Browse files
chore: update java microgenerator to 1.0.2 Adds request initialization to sample code (#385)
This PR was generated using Autosynth. 🌈 Synth log will be available here: https://source.cloud.google.com/results/invocations/ec2612ad-1aa2-48fe-9cb7-87d107cbcd42/targets - [ ] To automatically regenerate this PR, check this box. PiperOrigin-RevId: 362856902 Source-Link: googleapis/googleapis@1305ca4
1 parent 136d117 commit 8471fc8

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta1/MockDocumentUnderstandingServiceImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public void reset() {
6262
@Override
6363
public void batchProcessDocuments(
6464
BatchProcessDocumentsRequest request, StreamObserver<Operation> responseObserver) {
65-
Object response = responses.remove();
65+
Object response = responses.poll();
6666
if (response instanceof Operation) {
6767
requests.add(request);
6868
responseObserver.onNext(((Operation) response));
@@ -74,7 +74,7 @@ public void batchProcessDocuments(
7474
new IllegalArgumentException(
7575
String.format(
7676
"Unrecognized response type %s for method BatchProcessDocuments, expected %s or %s",
77-
response.getClass().getName(),
77+
response == null ? "null" : response.getClass().getName(),
7878
Operation.class.getName(),
7979
Exception.class.getName())));
8080
}

google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta2/MockDocumentUnderstandingServiceImpl.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public void reset() {
6262
@Override
6363
public void batchProcessDocuments(
6464
BatchProcessDocumentsRequest request, StreamObserver<Operation> responseObserver) {
65-
Object response = responses.remove();
65+
Object response = responses.poll();
6666
if (response instanceof Operation) {
6767
requests.add(request);
6868
responseObserver.onNext(((Operation) response));
@@ -74,7 +74,7 @@ public void batchProcessDocuments(
7474
new IllegalArgumentException(
7575
String.format(
7676
"Unrecognized response type %s for method BatchProcessDocuments, expected %s or %s",
77-
response.getClass().getName(),
77+
response == null ? "null" : response.getClass().getName(),
7878
Operation.class.getName(),
7979
Exception.class.getName())));
8080
}
@@ -83,7 +83,7 @@ public void batchProcessDocuments(
8383
@Override
8484
public void processDocument(
8585
ProcessDocumentRequest request, StreamObserver<Document> responseObserver) {
86-
Object response = responses.remove();
86+
Object response = responses.poll();
8787
if (response instanceof Document) {
8888
requests.add(request);
8989
responseObserver.onNext(((Document) response));
@@ -95,7 +95,7 @@ public void processDocument(
9595
new IllegalArgumentException(
9696
String.format(
9797
"Unrecognized response type %s for method ProcessDocument, expected %s or %s",
98-
response.getClass().getName(),
98+
response == null ? "null" : response.getClass().getName(),
9999
Document.class.getName(),
100100
Exception.class.getName())));
101101
}

google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta3/MockDocumentProcessorServiceImpl.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public void reset() {
6262
@Override
6363
public void processDocument(
6464
ProcessRequest request, StreamObserver<ProcessResponse> responseObserver) {
65-
Object response = responses.remove();
65+
Object response = responses.poll();
6666
if (response instanceof ProcessResponse) {
6767
requests.add(request);
6868
responseObserver.onNext(((ProcessResponse) response));
@@ -74,7 +74,7 @@ public void processDocument(
7474
new IllegalArgumentException(
7575
String.format(
7676
"Unrecognized response type %s for method ProcessDocument, expected %s or %s",
77-
response.getClass().getName(),
77+
response == null ? "null" : response.getClass().getName(),
7878
ProcessResponse.class.getName(),
7979
Exception.class.getName())));
8080
}
@@ -83,7 +83,7 @@ public void processDocument(
8383
@Override
8484
public void batchProcessDocuments(
8585
BatchProcessRequest request, StreamObserver<Operation> responseObserver) {
86-
Object response = responses.remove();
86+
Object response = responses.poll();
8787
if (response instanceof Operation) {
8888
requests.add(request);
8989
responseObserver.onNext(((Operation) response));
@@ -95,7 +95,7 @@ public void batchProcessDocuments(
9595
new IllegalArgumentException(
9696
String.format(
9797
"Unrecognized response type %s for method BatchProcessDocuments, expected %s or %s",
98-
response.getClass().getName(),
98+
response == null ? "null" : response.getClass().getName(),
9999
Operation.class.getName(),
100100
Exception.class.getName())));
101101
}
@@ -104,7 +104,7 @@ public void batchProcessDocuments(
104104
@Override
105105
public void reviewDocument(
106106
ReviewDocumentRequest request, StreamObserver<Operation> responseObserver) {
107-
Object response = responses.remove();
107+
Object response = responses.poll();
108108
if (response instanceof Operation) {
109109
requests.add(request);
110110
responseObserver.onNext(((Operation) response));
@@ -116,7 +116,7 @@ public void reviewDocument(
116116
new IllegalArgumentException(
117117
String.format(
118118
"Unrecognized response type %s for method ReviewDocument, expected %s or %s",
119-
response.getClass().getName(),
119+
response == null ? "null" : response.getClass().getName(),
120120
Operation.class.getName(),
121121
Exception.class.getName())));
122122
}

synth.metadata

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,31 @@
44
"git": {
55
"name": ".",
66
"remote": "https://github.com/googleapis/java-document-ai.git",
7-
"sha": "b074e0b4bf48b6b140cfe30158fde6a5a2ab1dfc"
7+
"sha": "136d1178d13f3a2bd3f93be6106a97f04aa7bcae"
88
}
99
},
1010
{
1111
"git": {
1212
"name": "googleapis",
1313
"remote": "https://github.com/googleapis/googleapis.git",
14-
"sha": "0c6dd7aa98ebee634ec62568237f7ee17034ad08",
15-
"internalRef": "361590205"
14+
"sha": "1305ca41d554eb0725237561e34129373bb8cbc1",
15+
"internalRef": "362856902"
1616
}
1717
},
1818
{
1919
"git": {
2020
"name": "googleapis",
2121
"remote": "https://github.com/googleapis/googleapis.git",
22-
"sha": "0c6dd7aa98ebee634ec62568237f7ee17034ad08",
23-
"internalRef": "361590205"
22+
"sha": "1305ca41d554eb0725237561e34129373bb8cbc1",
23+
"internalRef": "362856902"
2424
}
2525
},
2626
{
2727
"git": {
2828
"name": "googleapis",
2929
"remote": "https://github.com/googleapis/googleapis.git",
30-
"sha": "0c6dd7aa98ebee634ec62568237f7ee17034ad08",
31-
"internalRef": "361590205"
30+
"sha": "1305ca41d554eb0725237561e34129373bb8cbc1",
31+
"internalRef": "362856902"
3232
}
3333
},
3434
{

0 commit comments

Comments
 (0)