Search in sources :

Example 6 with CreateViewRequest

use of com.google.logging.v2.CreateViewRequest in project gapic-generator-java by googleapis.

the class ConfigClientTest method createViewExceptionTest.

@Test
public void createViewExceptionTest() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockConfigServiceV2.addException(exception);
    try {
        CreateViewRequest request = CreateViewRequest.newBuilder().setParent("parent-995424086").setViewId("viewId-816632160").setView(LogView.newBuilder().build()).build();
        client.createView(request);
        Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
    // Expected exception.
    }
}
Also used : InvalidArgumentException(com.google.api.gax.rpc.InvalidArgumentException) StatusRuntimeException(io.grpc.StatusRuntimeException) CreateViewRequest(com.google.logging.v2.CreateViewRequest) Test(org.junit.Test)

Aggregations

CreateViewRequest (com.google.logging.v2.CreateViewRequest)6 LogView (com.google.logging.v2.LogView)4 Test (org.junit.Test)4 InvalidArgumentException (com.google.api.gax.rpc.InvalidArgumentException)2 ConfigClient (com.google.cloud.logging.v2.ConfigClient)2 AbstractMessage (com.google.protobuf.AbstractMessage)2 StatusRuntimeException (io.grpc.StatusRuntimeException)2