use of com.google.api.gax.grpc.ApiException in project google-cloud-java by GoogleCloudPlatform.
the class GroupServiceClientTest method deleteGroupExceptionTest.
@Test
@SuppressWarnings("all")
public void deleteGroupExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
mockGroupService.addException(exception);
try {
GroupName name = GroupName.create("[PROJECT]", "[GROUP]");
client.deleteGroup(name);
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 GroupServiceClientTest method listGroupMembersExceptionTest.
@Test
@SuppressWarnings("all")
public void listGroupMembersExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
mockGroupService.addException(exception);
try {
GroupName name = GroupName.create("[PROJECT]", "[GROUP]");
client.listGroupMembers(name);
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 GroupServiceClientTest method createGroupExceptionTest.
@Test
@SuppressWarnings("all")
public void createGroupExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
mockGroupService.addException(exception);
try {
ProjectName name = ProjectName.create("[PROJECT]");
Group group = Group.newBuilder().build();
client.createGroup(name, group);
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 GroupServiceClientTest method updateGroupExceptionTest.
@Test
@SuppressWarnings("all")
public void updateGroupExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
mockGroupService.addException(exception);
try {
Group group = Group.newBuilder().build();
client.updateGroup(group);
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 ConfigClientTest method updateSinkExceptionTest.
@Test
@SuppressWarnings("all")
public void updateSinkExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
mockConfigServiceV2.addException(exception);
try {
SinkNameOneof sinkName = SinkNameOneof.from(SinkName.create("[PROJECT]", "[SINK]"));
LogSink sink = LogSink.newBuilder().build();
client.updateSink(sinkName, sink);
Assert.fail("No exception raised");
} catch (ApiException e) {
Assert.assertEquals(Status.INVALID_ARGUMENT.getCode(), e.getStatusCode());
}
}
Aggregations