use of io.grpc.StatusRuntimeException 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 io.grpc.StatusRuntimeException 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 io.grpc.StatusRuntimeException 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());
}
}
use of io.grpc.StatusRuntimeException in project google-cloud-java by GoogleCloudPlatform.
the class ConfigClientTest method deleteSinkExceptionTest.
@Test
@SuppressWarnings("all")
public void deleteSinkExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
mockConfigServiceV2.addException(exception);
try {
SinkNameOneof sinkName = SinkNameOneof.from(SinkName.create("[PROJECT]", "[SINK]"));
client.deleteSink(sinkName);
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 ConfigClientTest method createSinkExceptionTest.
@Test
@SuppressWarnings("all")
public void createSinkExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
mockConfigServiceV2.addException(exception);
try {
ParentNameOneof parent = ParentNameOneof.from(ProjectName.create("[PROJECT]"));
LogSink sink = LogSink.newBuilder().build();
client.createSink(parent, sink);
Assert.fail("No exception raised");
} catch (ApiException e) {
Assert.assertEquals(Status.INVALID_ARGUMENT.getCode(), e.getStatusCode());
}
}
Aggregations