use of com.google.devtools.cloudtrace.v1.ListTracesRequest in project google-cloud-java by GoogleCloudPlatform.
the class TraceServiceClientTest method listTracesTest.
@Test
@SuppressWarnings("all")
public void listTracesTest() {
String nextPageToken = "";
Trace tracesElement = Trace.newBuilder().build();
List<Trace> traces = Arrays.asList(tracesElement);
ListTracesResponse expectedResponse = ListTracesResponse.newBuilder().setNextPageToken(nextPageToken).addAllTraces(traces).build();
mockTraceService.addResponse(expectedResponse);
String projectId = "projectId-1969970175";
ListTracesPagedResponse pagedListResponse = client.listTraces(projectId);
List<Trace> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getTracesList().get(0), resources.get(0));
List<GeneratedMessageV3> actualRequests = mockTraceService.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListTracesRequest actualRequest = (ListTracesRequest) actualRequests.get(0);
Assert.assertEquals(projectId, actualRequest.getProjectId());
}
Aggregations