use of io.grpc.StatusRuntimeException in project google-cloud-java by GoogleCloudPlatform.
the class MetricServiceClientTest method listMetricDescriptorsExceptionTest.
@Test
@SuppressWarnings("all")
public void listMetricDescriptorsExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
mockMetricService.addException(exception);
try {
ProjectName name = ProjectName.create("[PROJECT]");
client.listMetricDescriptors(name);
Assert.fail("No exception raised");
} catch (ApiException e) {
Assert.assertEquals(Status.INVALID_ARGUMENT.getCode(), e.getStatusCode());
}
}
use of io.grpc.StatusRuntimeException in project google-cloud-java by GoogleCloudPlatform.
the class MetricServiceClientTest method listTimeSeriesExceptionTest.
@Test
@SuppressWarnings("all")
public void listTimeSeriesExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
mockMetricService.addException(exception);
try {
ProjectName name = ProjectName.create("[PROJECT]");
String filter = "filter-1274492040";
TimeInterval interval = TimeInterval.newBuilder().build();
ListTimeSeriesRequest.TimeSeriesView view = ListTimeSeriesRequest.TimeSeriesView.FULL;
client.listTimeSeries(name, filter, interval, view);
Assert.fail("No exception raised");
} catch (ApiException e) {
Assert.assertEquals(Status.INVALID_ARGUMENT.getCode(), e.getStatusCode());
}
}
use of io.grpc.StatusRuntimeException in project google-cloud-java by GoogleCloudPlatform.
the class SubscriptionAdminClientTest method acknowledgeExceptionTest.
@Test
@SuppressWarnings("all")
public void acknowledgeExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
mockSubscriber.addException(exception);
try {
SubscriptionName subscription = SubscriptionName.create("[PROJECT]", "[SUBSCRIPTION]");
List<String> ackIds = new ArrayList<>();
client.acknowledge(subscription, ackIds);
Assert.fail("No exception raised");
} catch (ApiException e) {
Assert.assertEquals(Status.INVALID_ARGUMENT.getCode(), e.getStatusCode());
}
}
use of io.grpc.StatusRuntimeException in project google-cloud-java by GoogleCloudPlatform.
the class SubscriptionAdminClientTest method createSnapshotExceptionTest.
@Test
@SuppressWarnings("all")
public void createSnapshotExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
mockSubscriber.addException(exception);
try {
SnapshotName name = SnapshotName.create("[PROJECT]", "[SNAPSHOT]");
SubscriptionName subscription = SubscriptionName.create("[PROJECT]", "[SUBSCRIPTION]");
client.createSnapshot(name, subscription);
Assert.fail("No exception raised");
} catch (ApiException e) {
Assert.assertEquals(Status.INVALID_ARGUMENT.getCode(), e.getStatusCode());
}
}
use of io.grpc.StatusRuntimeException in project google-cloud-java by GoogleCloudPlatform.
the class SubscriptionAdminClientTest method modifyAckDeadlineExceptionTest.
@Test
@SuppressWarnings("all")
public void modifyAckDeadlineExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
mockSubscriber.addException(exception);
try {
SubscriptionName subscription = SubscriptionName.create("[PROJECT]", "[SUBSCRIPTION]");
List<String> ackIds = new ArrayList<>();
int ackDeadlineSeconds = 2135351438;
client.modifyAckDeadline(subscription, ackIds, ackDeadlineSeconds);
Assert.fail("No exception raised");
} catch (ApiException e) {
Assert.assertEquals(Status.INVALID_ARGUMENT.getCode(), e.getStatusCode());
}
}
Aggregations