use of org.apache.beam.vendor.grpc.v1p43p2.io.grpc.StatusRuntimeException in project google-cloud-java by GoogleCloudPlatform.
the class SubscriptionAdminClientTest method createSubscriptionExceptionTest.
@Test
@SuppressWarnings("all")
public void createSubscriptionExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
mockSubscriber.addException(exception);
try {
SubscriptionName name = SubscriptionName.create("[PROJECT]", "[SUBSCRIPTION]");
TopicName topic = TopicName.create("[PROJECT]", "[TOPIC]");
PushConfig pushConfig = PushConfig.newBuilder().build();
int ackDeadlineSeconds = 2135351438;
client.createSubscription(name, topic, pushConfig, ackDeadlineSeconds);
Assert.fail("No exception raised");
} catch (ApiException e) {
Assert.assertEquals(Status.INVALID_ARGUMENT.getCode(), e.getStatusCode());
}
}
use of org.apache.beam.vendor.grpc.v1p43p2.io.grpc.StatusRuntimeException in project google-cloud-java by GoogleCloudPlatform.
the class GroupServiceClientTest method getGroupExceptionTest.
@Test
@SuppressWarnings("all")
public void getGroupExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
mockGroupService.addException(exception);
try {
GroupName name = GroupName.create("[PROJECT]", "[GROUP]");
client.getGroup(name);
Assert.fail("No exception raised");
} catch (ApiException e) {
Assert.assertEquals(Status.INVALID_ARGUMENT.getCode(), e.getStatusCode());
}
}
use of org.apache.beam.vendor.grpc.v1p43p2.io.grpc.StatusRuntimeException in project google-cloud-java by GoogleCloudPlatform.
the class MetricServiceClientTest method createMetricDescriptorExceptionTest.
@Test
@SuppressWarnings("all")
public void createMetricDescriptorExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
mockMetricService.addException(exception);
try {
ProjectName name = ProjectName.create("[PROJECT]");
MetricDescriptor metricDescriptor = MetricDescriptor.newBuilder().build();
client.createMetricDescriptor(name, metricDescriptor);
Assert.fail("No exception raised");
} catch (ApiException e) {
Assert.assertEquals(Status.INVALID_ARGUMENT.getCode(), e.getStatusCode());
}
}
use of org.apache.beam.vendor.grpc.v1p43p2.io.grpc.StatusRuntimeException in project google-cloud-java by GoogleCloudPlatform.
the class MetricServiceClientTest method getMonitoredResourceDescriptorExceptionTest.
@Test
@SuppressWarnings("all")
public void getMonitoredResourceDescriptorExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
mockMetricService.addException(exception);
try {
MonitoredResourceDescriptorName name = MonitoredResourceDescriptorName.create("[PROJECT]", "[MONITORED_RESOURCE_DESCRIPTOR]");
client.getMonitoredResourceDescriptor(name);
Assert.fail("No exception raised");
} catch (ApiException e) {
Assert.assertEquals(Status.INVALID_ARGUMENT.getCode(), e.getStatusCode());
}
}
use of org.apache.beam.vendor.grpc.v1p43p2.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());
}
}
Aggregations