@Override public Iterable<ProductSet> extractResources(ListProductSetsResponse payload) { return payload.getProductSetsList(); } };
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.vision.v1.ListProductSetsResponse)) { return super.equals(obj); } com.google.cloud.vision.v1.ListProductSetsResponse other = (com.google.cloud.vision.v1.ListProductSetsResponse) obj; boolean result = true; result = result && getProductSetsList().equals(other.getProductSetsList()); 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 (getProductSetsCount() > 0) { hash = (37 * hash) + PRODUCT_SETS_FIELD_NUMBER; hash = (53 * hash) + getProductSetsList().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 listProductSetsTest() { String nextPageToken = ""; ProductSet productSetsElement = ProductSet.newBuilder().build(); List<ProductSet> productSets = Arrays.asList(productSetsElement); ListProductSetsResponse expectedResponse = ListProductSetsResponse.newBuilder() .setNextPageToken(nextPageToken) .addAllProductSets(productSets) .build(); mockProductSearch.addResponse(expectedResponse); String formattedParent = ProductSearchClient.formatLocationName("[PROJECT]", "[LOCATION]"); ListProductSetsPagedResponse pagedListResponse = client.listProductSets(formattedParent); List<ProductSet> resources = Lists.newArrayList(pagedListResponse.iterateAll()); Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getProductSetsList().get(0), resources.get(0)); List<GeneratedMessageV3> actualRequests = mockProductSearch.getRequests(); Assert.assertEquals(1, actualRequests.size()); ListProductSetsRequest actualRequest = (ListProductSetsRequest) actualRequests.get(0); Assert.assertEquals(formattedParent, actualRequest.getParent()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Override public Iterable<ProductSet> extractResources(ListProductSetsResponse payload) { return payload.getProductSetsList(); } };
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.vision.v1.ListProductSetsResponse)) { return super.equals(obj); } com.google.cloud.vision.v1.ListProductSetsResponse other = (com.google.cloud.vision.v1.ListProductSetsResponse) obj; boolean result = true; result = result && getProductSetsList().equals(other.getProductSetsList()); 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 (getProductSetsCount() > 0) { hash = (37 * hash) + PRODUCT_SETS_FIELD_NUMBER; hash = (53 * hash) + getProductSetsList().hashCode(); } hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; hash = (53 * hash) + getNextPageToken().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }