use of io.grafeas.v1beta1.BatchCreateOccurrencesRequest in project java-containeranalysis by googleapis.
the class GrafeasV1Beta1ClientTest method batchCreateOccurrencesTest.
@Test
@SuppressWarnings("all")
public void batchCreateOccurrencesTest() {
BatchCreateOccurrencesResponse expectedResponse = BatchCreateOccurrencesResponse.newBuilder().build();
mockGrafeasV1Beta1.addResponse(expectedResponse);
ProjectName parent = ProjectName.of("[PROJECT]");
List<Occurrence> occurrences = new ArrayList<>();
BatchCreateOccurrencesResponse actualResponse = client.batchCreateOccurrences(parent, occurrences);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockGrafeasV1Beta1.getRequests();
Assert.assertEquals(1, actualRequests.size());
BatchCreateOccurrencesRequest actualRequest = (BatchCreateOccurrencesRequest) actualRequests.get(0);
Assert.assertEquals(parent, ProjectName.parse(actualRequest.getParent()));
Assert.assertEquals(occurrences, actualRequest.getOccurrencesList());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations