@Override public Iterable<Snapshot> extractResources(ListSnapshotsResponse payload) { return payload.getSnapshotsList() != null ? payload.getSnapshotsList() : ImmutableList.<Snapshot>of(); } };
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.pubsub.v1.ListSnapshotsResponse)) { return super.equals(obj); } com.google.pubsub.v1.ListSnapshotsResponse other = (com.google.pubsub.v1.ListSnapshotsResponse) obj; boolean result = true; result = result && getSnapshotsList().equals(other.getSnapshotsList()); 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 (getSnapshotsCount() > 0) { hash = (37 * hash) + SNAPSHOTS_FIELD_NUMBER; hash = (53 * hash) + getSnapshotsList().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 listSnapshotsTest() { String nextPageToken = ""; Snapshot snapshotsElement = Snapshot.newBuilder().build(); List<Snapshot> snapshots = Arrays.asList(snapshotsElement); ListSnapshotsResponse expectedResponse = ListSnapshotsResponse.newBuilder() .setNextPageToken(nextPageToken) .addAllSnapshots(snapshots) .build(); mockSubscriber.addResponse(expectedResponse); ProjectName project = ProjectName.of("[PROJECT]"); ListSnapshotsPagedResponse pagedListResponse = client.listSnapshots(project); List<Snapshot> resources = Lists.newArrayList(pagedListResponse.iterateAll()); Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getSnapshotsList().get(0), resources.get(0)); List<GeneratedMessageV3> actualRequests = mockSubscriber.getRequests(); Assert.assertEquals(1, actualRequests.size()); ListSnapshotsRequest actualRequest = (ListSnapshotsRequest) actualRequests.get(0); Assert.assertEquals(project, ProjectName.parse(actualRequest.getProject())); 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 com.google.pubsub.v1.ListSnapshotsResponse)) { return super.equals(obj); } com.google.pubsub.v1.ListSnapshotsResponse other = (com.google.pubsub.v1.ListSnapshotsResponse) obj; boolean result = true; result = result && getSnapshotsList().equals(other.getSnapshotsList()); 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 (getSnapshotsCount() > 0) { hash = (37 * hash) + SNAPSHOTS_FIELD_NUMBER; hash = (53 * hash) + getSnapshotsList().hashCode(); } hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; hash = (53 * hash) + getNextPageToken().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }