@Override public Iterable<Note> extractResources(ListNotesResponse payload) { return payload.getNotesList() != null ? payload.getNotesList() : ImmutableList.<Note>of(); } };
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof io.grafeas.v1beta1.ListNotesResponse)) { return super.equals(obj); } io.grafeas.v1beta1.ListNotesResponse other = (io.grafeas.v1beta1.ListNotesResponse) obj; boolean result = true; result = result && getNotesList().equals(other.getNotesList()); result = result && getNextPageToken().equals(other.getNextPageToken()); result = result && unknownFields.equals(other.unknownFields); return result; }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (getNotesCount() > 0) { hash = (37 * hash) + NOTES_FIELD_NUMBER; hash = (53 * hash) + getNotesList().hashCode(); } hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; hash = (53 * hash) + getNextPageToken().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
@Test @SuppressWarnings("all") public void listNotesTest() { String nextPageToken = ""; Note notesElement = Note.newBuilder().build(); List<Note> notes = Arrays.asList(notesElement); ListNotesResponse expectedResponse = ListNotesResponse.newBuilder().setNextPageToken(nextPageToken).addAllNotes(notes).build(); mockGrafeasV1Beta1.addResponse(expectedResponse); ProjectName parent = ProjectName.of("[PROJECT]"); String filter = "filter-1274492040"; ListNotesPagedResponse pagedListResponse = client.listNotes(parent, filter); List<Note> resources = Lists.newArrayList(pagedListResponse.iterateAll()); Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getNotesList().get(0), resources.get(0)); List<GeneratedMessageV3> actualRequests = mockGrafeasV1Beta1.getRequests(); Assert.assertEquals(1, actualRequests.size()); ListNotesRequest actualRequest = (ListNotesRequest) actualRequests.get(0); Assert.assertEquals(parent, ProjectName.parse(actualRequest.getParent())); Assert.assertEquals(filter, actualRequest.getFilter()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof io.grafeas.v1beta1.ListNotesResponse)) { return super.equals(obj); } io.grafeas.v1beta1.ListNotesResponse other = (io.grafeas.v1beta1.ListNotesResponse) obj; boolean result = true; result = result && getNotesList().equals(other.getNotesList()); result = result && getNextPageToken().equals(other.getNextPageToken()); result = result && unknownFields.equals(other.unknownFields); return result; }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (getNotesCount() > 0) { hash = (37 * hash) + NOTES_FIELD_NUMBER; hash = (53 * hash) + getNotesList().hashCode(); } hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; hash = (53 * hash) + getNextPageToken().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }