Search in sources :

Example 1 with BatchCreateOccurrencesRequest

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()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ProjectName(com.google.containeranalysis.v1beta1.ProjectName) ArrayList(java.util.ArrayList) BatchCreateOccurrencesRequest(io.grafeas.v1beta1.BatchCreateOccurrencesRequest) Occurrence(io.grafeas.v1beta1.Occurrence) BatchCreateOccurrencesResponse(io.grafeas.v1beta1.BatchCreateOccurrencesResponse) Test(org.junit.Test)

Aggregations

ProjectName (com.google.containeranalysis.v1beta1.ProjectName)1 AbstractMessage (com.google.protobuf.AbstractMessage)1 BatchCreateOccurrencesRequest (io.grafeas.v1beta1.BatchCreateOccurrencesRequest)1 BatchCreateOccurrencesResponse (io.grafeas.v1beta1.BatchCreateOccurrencesResponse)1 Occurrence (io.grafeas.v1beta1.Occurrence)1 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1