use of com.google.devtools.clouderrorreporting.v1beta1.ErrorEvent in project google-cloud-java by GoogleCloudPlatform.
the class ErrorStatsServiceClientTest method listEventsTest.
@Test
@SuppressWarnings("all")
public void listEventsTest() {
String nextPageToken = "";
ErrorEvent errorEventsElement = ErrorEvent.newBuilder().build();
List<ErrorEvent> errorEvents = Arrays.asList(errorEventsElement);
ListEventsResponse expectedResponse = ListEventsResponse.newBuilder().setNextPageToken(nextPageToken).addAllErrorEvents(errorEvents).build();
mockErrorStatsService.addResponse(expectedResponse);
ProjectName projectName = ProjectName.create("[PROJECT]");
String groupId = "groupId506361563";
ListEventsPagedResponse pagedListResponse = client.listEvents(projectName, groupId);
List<ErrorEvent> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getErrorEventsList().get(0), resources.get(0));
List<GeneratedMessageV3> actualRequests = mockErrorStatsService.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListEventsRequest actualRequest = (ListEventsRequest) actualRequests.get(0);
Assert.assertEquals(projectName, actualRequest.getProjectNameAsProjectName());
Assert.assertEquals(groupId, actualRequest.getGroupId());
}
Aggregations