use of com.google.monitoring.v3.ListGroupMembersRequest in project google-cloud-java by GoogleCloudPlatform.
the class GroupServiceClientTest method listGroupMembersTest.
@Test
@SuppressWarnings("all")
public void listGroupMembersTest() {
String nextPageToken = "";
int totalSize = -705419236;
MonitoredResource membersElement = MonitoredResource.newBuilder().build();
List<MonitoredResource> members = Arrays.asList(membersElement);
ListGroupMembersResponse expectedResponse = ListGroupMembersResponse.newBuilder().setNextPageToken(nextPageToken).setTotalSize(totalSize).addAllMembers(members).build();
mockGroupService.addResponse(expectedResponse);
GroupName name = GroupName.create("[PROJECT]", "[GROUP]");
ListGroupMembersPagedResponse pagedListResponse = client.listGroupMembers(name);
List<MonitoredResource> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getMembersList().get(0), resources.get(0));
List<GeneratedMessageV3> actualRequests = mockGroupService.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListGroupMembersRequest actualRequest = (ListGroupMembersRequest) actualRequests.get(0);
Assert.assertEquals(name, actualRequest.getNameAsGroupName());
}
Aggregations