// Path: google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/ErrorStatsServiceClient.java
// public static class ListEventsPagedResponse
//     extends AbstractPagedListResponse<
//         ListEventsRequest,
//         ListEventsResponse,
//         ErrorEvent,
//         ListEventsPage,
//         ListEventsFixedSizeCollection> {
// 
//   public static ApiFuture<ListEventsPagedResponse> createAsync(
//       PageContext<ListEventsRequest, ListEventsResponse, ErrorEvent> context,
//       ApiFuture<ListEventsResponse> futureResponse) {
//     ApiFuture<ListEventsPage> futurePage =
//         ListEventsPage.createEmptyPage().createPageAsync(context, futureResponse);
//     return ApiFutures.transform(
//         futurePage, input -> new ListEventsPagedResponse(input), MoreExecutors.directExecutor());
//   }
// 
//   private ListEventsPagedResponse(ListEventsPage page) {
//     super(page, ListEventsFixedSizeCollection.createEmptyCollection());
//   }
// }
// 
// Path: google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/ErrorStatsServiceClient.java
// public static class ListGroupStatsPagedResponse
//     extends AbstractPagedListResponse<
//         ListGroupStatsRequest,
//         ListGroupStatsResponse,
//         ErrorGroupStats,
//         ListGroupStatsPage,
//         ListGroupStatsFixedSizeCollection> {
// 
//   public static ApiFuture<ListGroupStatsPagedResponse> createAsync(
//       PageContext<ListGroupStatsRequest, ListGroupStatsResponse, ErrorGroupStats> context,
//       ApiFuture<ListGroupStatsResponse> futureResponse) {
//     ApiFuture<ListGroupStatsPage> futurePage =
//         ListGroupStatsPage.createEmptyPage().createPageAsync(context, futureResponse);
//     return ApiFutures.transform(
//         futurePage,
//         input -> new ListGroupStatsPagedResponse(input),
//         MoreExecutors.directExecutor());
//   }
// 
//   private ListGroupStatsPagedResponse(ListGroupStatsPage page) {
//     super(page, ListGroupStatsFixedSizeCollection.createEmptyCollection());
//   }
// }


import static com.google.devtools.clouderrorreporting.v1beta1.ErrorStatsServiceClient.ListEventsPagedResponse;
import static com.google.devtools.clouderrorreporting.v1beta1.ErrorStatsServiceClient.ListGroupStatsPagedResponse;
import com.google.api.gax.core.NoCredentialsProvider;
import com.google.api.gax.grpc.GaxGrpcProperties;
import com.google.api.gax.grpc.testing.LocalChannelProvider;
import com.google.api.gax.grpc.testing.MockGrpcService;
import com.google.api.gax.grpc.testing.MockServiceHelper;
import com.google.api.gax.rpc.ApiClientHeaderProvider;
import com.google.api.gax.rpc.InvalidArgumentException;
import com.google.common.collect.Lists;
import com.google.protobuf.AbstractMessage;
import io.grpc.StatusRuntimeException;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
import javax.annotation.Generated;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
  }

  @Test
  public void listGroupStatsExceptionTest2() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockErrorStatsService.addException(exception);

    try {
      String projectName = "projectName-940047036";
      QueryTimeRange timeRange = QueryTimeRange.newBuilder().build();
      client.listGroupStats(projectName, timeRange);
      Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
      // Expected exception.
    }
  }

  @Test
  public void listEventsTest() throws Exception {
    ErrorEvent responsesElement = ErrorEvent.newBuilder().build();
    ListEventsResponse expectedResponse =
        ListEventsResponse.newBuilder()
            .setNextPageToken("")
            .addAllErrorEvents(Arrays.asList(responsesElement))
            .build();
    mockErrorStatsService.addResponse(expectedResponse);

    ProjectName projectName = ProjectName.of("[PROJECT]");
    String groupId = "groupId293428218";

// Path: google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/ErrorStatsServiceClient.java
// public static class ListEventsPagedResponse
//     extends AbstractPagedListResponse<
//         ListEventsRequest,
//         ListEventsResponse,
//         ErrorEvent,
//         ListEventsPage,
//         ListEventsFixedSizeCollection> {
// 
//   public static ApiFuture<ListEventsPagedResponse> createAsync(
//       PageContext<ListEventsRequest, ListEventsResponse, ErrorEvent> context,
//       ApiFuture<ListEventsResponse> futureResponse) {
//     ApiFuture<ListEventsPage> futurePage =
//         ListEventsPage.createEmptyPage().createPageAsync(context, futureResponse);
//     return ApiFutures.transform(
//         futurePage, input -> new ListEventsPagedResponse(input), MoreExecutors.directExecutor());
//   }
// 
//   private ListEventsPagedResponse(ListEventsPage page) {
//     super(page, ListEventsFixedSizeCollection.createEmptyCollection());
//   }
// }
// 
// Path: google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/ErrorStatsServiceClient.java
// public static class ListGroupStatsPagedResponse
//     extends AbstractPagedListResponse<
//         ListGroupStatsRequest,
//         ListGroupStatsResponse,
//         ErrorGroupStats,
//         ListGroupStatsPage,
//         ListGroupStatsFixedSizeCollection> {
// 
//   public static ApiFuture<ListGroupStatsPagedResponse> createAsync(
//       PageContext<ListGroupStatsRequest, ListGroupStatsResponse, ErrorGroupStats> context,
//       ApiFuture<ListGroupStatsResponse> futureResponse) {
//     ApiFuture<ListGroupStatsPage> futurePage =
//         ListGroupStatsPage.createEmptyPage().createPageAsync(context, futureResponse);
//     return ApiFutures.transform(
//         futurePage,
//         input -> new ListGroupStatsPagedResponse(input),
//         MoreExecutors.directExecutor());
//   }
// 
//   private ListGroupStatsPagedResponse(ListGroupStatsPage page) {
//     super(page, ListGroupStatsFixedSizeCollection.createEmptyCollection());
//   }
// }


// Path: google-cloud-errorreporting/src/test/java/com/google/devtools/clouderrorreporting/v1beta1/ErrorStatsServiceClientTest.java
import static com.google.devtools.clouderrorreporting.v1beta1.ErrorStatsServiceClient.ListEventsPagedResponse;
import static com.google.devtools.clouderrorreporting.v1beta1.ErrorStatsServiceClient.ListGroupStatsPagedResponse;
import com.google.api.gax.core.NoCredentialsProvider;
import com.google.api.gax.grpc.GaxGrpcProperties;
import com.google.api.gax.grpc.testing.LocalChannelProvider;
import com.google.api.gax.grpc.testing.MockGrpcService;
import com.google.api.gax.grpc.testing.MockServiceHelper;
import com.google.api.gax.rpc.ApiClientHeaderProvider;
import com.google.api.gax.rpc.InvalidArgumentException;
import com.google.common.collect.Lists;
import com.google.protobuf.AbstractMessage;
import io.grpc.StatusRuntimeException;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
import javax.annotation.Generated;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

  }

  @Test
  public void listGroupStatsExceptionTest2() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockErrorStatsService.addException(exception);

    try {
      String projectName = "projectName-940047036";
      QueryTimeRange timeRange = QueryTimeRange.newBuilder().build();
      client.listGroupStats(projectName, timeRange);
      Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
      // Expected exception.
    }
  }

  @Test
  public void listEventsTest() throws Exception {
    ErrorEvent responsesElement = ErrorEvent.newBuilder().build();
    ListEventsResponse expectedResponse =
        ListEventsResponse.newBuilder()
            .setNextPageToken("")
            .addAllErrorEvents(Arrays.asList(responsesElement))
            .build();
    mockErrorStatsService.addResponse(expectedResponse);

    ProjectName projectName = ProjectName.of("[PROJECT]");
    String groupId = "groupId293428218";

    ListEventsPagedResponse pagedListResponse = client.listEvents(projectName, groupId);