use of io.grafeas.v1beta1.CreateOccurrenceRequest in project java-containeranalysis by googleapis.
the class GrafeasV1Beta1ClientTest method createOccurrenceTest.
@Test
@SuppressWarnings("all")
public void createOccurrenceTest() {
String name = "name3373707";
String noteName = "noteName1780787896";
String remediation = "remediation779381797";
Occurrence expectedResponse = Occurrence.newBuilder().setName(name).setNoteName(noteName).setRemediation(remediation).build();
mockGrafeasV1Beta1.addResponse(expectedResponse);
ProjectName parent = ProjectName.of("[PROJECT]");
Occurrence occurrence = Occurrence.newBuilder().build();
Occurrence actualResponse = client.createOccurrence(parent, occurrence);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockGrafeasV1Beta1.getRequests();
Assert.assertEquals(1, actualRequests.size());
CreateOccurrenceRequest actualRequest = (CreateOccurrenceRequest) actualRequests.get(0);
Assert.assertEquals(parent, ProjectName.parse(actualRequest.getParent()));
Assert.assertEquals(occurrence, actualRequest.getOccurrence());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations