use of com.google.cloud.compute.v1.DiskTypesClient.AggregatedListPagedResponse in project java-compute by googleapis.
the class UrlMapsClientTest method aggregatedListTest.
@Test
public void aggregatedListTest() throws Exception {
UrlMapsScopedList responsesElement = UrlMapsScopedList.newBuilder().build();
UrlMapsAggregatedList expectedResponse = UrlMapsAggregatedList.newBuilder().setNextPageToken("").putAllItems(Collections.singletonMap("items", responsesElement)).build();
mockService.addResponse(expectedResponse);
String project = "project-6911";
AggregatedListPagedResponse pagedListResponse = client.aggregatedList(project);
List<Map.Entry<String, UrlMapsScopedList>> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getItemsMap().entrySet().iterator().next(), resources.get(0));
List<String> actualRequests = mockService.getRequestPaths();
Assert.assertEquals(1, actualRequests.size());
String apiClientHeaderKey = mockService.getRequestHeaders().get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()).iterator().next();
Assert.assertTrue(GaxHttpJsonProperties.getDefaultApiClientHeaderPattern().matcher(apiClientHeaderKey).matches());
}
Aggregations