use of com.google.cloud.logging.spi.v2.PagedResponseWrappers.ListSinksPagedResponse in project google-cloud-java by GoogleCloudPlatform.
the class ConfigClientTest method listSinksTest.
@Test
@SuppressWarnings("all")
public void listSinksTest() {
String nextPageToken = "";
LogSink sinksElement = LogSink.newBuilder().build();
List<LogSink> sinks = Arrays.asList(sinksElement);
ListSinksResponse expectedResponse = ListSinksResponse.newBuilder().setNextPageToken(nextPageToken).addAllSinks(sinks).build();
mockConfigServiceV2.addResponse(expectedResponse);
ParentNameOneof parent = ParentNameOneof.from(ProjectName.create("[PROJECT]"));
ListSinksPagedResponse pagedListResponse = client.listSinks(parent);
List<LogSink> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getSinksList().get(0), resources.get(0));
List<GeneratedMessageV3> actualRequests = mockConfigServiceV2.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListSinksRequest actualRequest = (ListSinksRequest) actualRequests.get(0);
Assert.assertEquals(parent, actualRequest.getParentAsParentNameOneof());
}
Aggregations