Search in sources :

Example 1 with CreateNoteRequest

use of io.grafeas.v1beta1.CreateNoteRequest in project java-containeranalysis by googleapis.

the class GrafeasV1Beta1ClientTest method createNoteTest.

@Test
@SuppressWarnings("all")
public void createNoteTest() {
    String name = "name3373707";
    String shortDescription = "shortDescription-235369287";
    String longDescription = "longDescription-1747792199";
    Note expectedResponse = Note.newBuilder().setName(name).setShortDescription(shortDescription).setLongDescription(longDescription).build();
    mockGrafeasV1Beta1.addResponse(expectedResponse);
    ProjectName parent = ProjectName.of("[PROJECT]");
    String noteId = "noteId2129224840";
    Note note = Note.newBuilder().build();
    Note actualResponse = client.createNote(parent, noteId, note);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockGrafeasV1Beta1.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    CreateNoteRequest actualRequest = (CreateNoteRequest) actualRequests.get(0);
    Assert.assertEquals(parent, ProjectName.parse(actualRequest.getParent()));
    Assert.assertEquals(noteId, actualRequest.getNoteId());
    Assert.assertEquals(note, actualRequest.getNote());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : CreateNoteRequest(io.grafeas.v1beta1.CreateNoteRequest) AbstractMessage(com.google.protobuf.AbstractMessage) ProjectName(com.google.containeranalysis.v1beta1.ProjectName) Note(io.grafeas.v1beta1.Note) Test(org.junit.Test)

Aggregations

ProjectName (com.google.containeranalysis.v1beta1.ProjectName)1 AbstractMessage (com.google.protobuf.AbstractMessage)1 CreateNoteRequest (io.grafeas.v1beta1.CreateNoteRequest)1 Note (io.grafeas.v1beta1.Note)1 Test (org.junit.Test)1