use of com.google.api.gax.grpc.ApiException in project google-cloud-java by GoogleCloudPlatform.
the class SubscriptionAdminClientTest method getSubscriptionExceptionTest.
@Test
@SuppressWarnings("all")
public void getSubscriptionExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
mockSubscriber.addException(exception);
try {
SubscriptionName subscription = SubscriptionName.create("[PROJECT]", "[SUBSCRIPTION]");
client.getSubscription(subscription);
Assert.fail("No exception raised");
} catch (ApiException e) {
Assert.assertEquals(Status.INVALID_ARGUMENT.getCode(), e.getStatusCode());
}
}
use of com.google.api.gax.grpc.ApiException in project google-cloud-java by GoogleCloudPlatform.
the class SubscriptionAdminClientTest method deleteSnapshotExceptionTest.
@Test
@SuppressWarnings("all")
public void deleteSnapshotExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
mockSubscriber.addException(exception);
try {
SnapshotName snapshot = SnapshotName.create("[PROJECT]", "[SNAPSHOT]");
client.deleteSnapshot(snapshot);
Assert.fail("No exception raised");
} catch (ApiException e) {
Assert.assertEquals(Status.INVALID_ARGUMENT.getCode(), e.getStatusCode());
}
}
use of com.google.api.gax.grpc.ApiException in project google-cloud-java by GoogleCloudPlatform.
the class TopicAdminClientTest method getTopicExceptionTest.
@Test
@SuppressWarnings("all")
public void getTopicExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
mockPublisher.addException(exception);
try {
TopicName topic = TopicName.create("[PROJECT]", "[TOPIC]");
client.getTopic(topic);
Assert.fail("No exception raised");
} catch (ApiException e) {
Assert.assertEquals(Status.INVALID_ARGUMENT.getCode(), e.getStatusCode());
}
}
use of com.google.api.gax.grpc.ApiException in project google-cloud-java by GoogleCloudPlatform.
the class TopicAdminClientTest method deleteTopicExceptionTest.
@Test
@SuppressWarnings("all")
public void deleteTopicExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
mockPublisher.addException(exception);
try {
TopicName topic = TopicName.create("[PROJECT]", "[TOPIC]");
client.deleteTopic(topic);
Assert.fail("No exception raised");
} catch (ApiException e) {
Assert.assertEquals(Status.INVALID_ARGUMENT.getCode(), e.getStatusCode());
}
}
use of com.google.api.gax.grpc.ApiException in project google-cloud-java by GoogleCloudPlatform.
the class TopicAdminClientTest method createTopicExceptionTest.
@Test
@SuppressWarnings("all")
public void createTopicExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
mockPublisher.addException(exception);
try {
TopicName name = TopicName.create("[PROJECT]", "[TOPIC]");
client.createTopic(name);
Assert.fail("No exception raised");
} catch (ApiException e) {
Assert.assertEquals(Status.INVALID_ARGUMENT.getCode(), e.getStatusCode());
}
}
Aggregations