Search in sources :

Example 51 with InstanceName

use of com.google.spanner.admin.database.v1.InstanceName in project java-spanner by googleapis.

the class InstanceAdminClientTest method getInstanceExceptionTest.

@Test
public void getInstanceExceptionTest() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockInstanceAdmin.addException(exception);
    try {
        InstanceName name = InstanceName.of("[PROJECT]", "[INSTANCE]");
        client.getInstance(name);
        Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
    // Expected exception.
    }
}
Also used : InstanceName(com.google.spanner.admin.instance.v1.InstanceName) InvalidArgumentException(com.google.api.gax.rpc.InvalidArgumentException) StatusRuntimeException(io.grpc.StatusRuntimeException) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)44 AbstractMessage (com.google.protobuf.AbstractMessage)24 StatusRuntimeException (io.grpc.StatusRuntimeException)24 ByteString (com.google.protobuf.ByteString)21 InvalidArgumentException (com.google.api.gax.rpc.InvalidArgumentException)20 InstanceName (com.google.bigtable.admin.v2.InstanceName)20 InstanceName (com.google.spanner.admin.database.v1.InstanceName)16 ExecutionException (java.util.concurrent.ExecutionException)11 Operation (com.google.longrunning.Operation)9 InstanceName (com.google.spanner.admin.instance.v1.InstanceName)9 ArrayList (java.util.ArrayList)7 Table (com.google.bigtable.admin.v2.Table)5 Database (com.google.spanner.admin.database.v1.Database)5 GrpcCallContext (com.google.api.gax.grpc.GrpcCallContext)4 Backup (com.google.spanner.admin.database.v1.Backup)4 InstanceConfigName (com.google.spanner.admin.instance.v1.InstanceConfigName)4 IOException (java.io.IOException)4 ExpectedException (org.junit.rules.ExpectedException)4 AppProfile (com.google.bigtable.admin.v2.AppProfile)3 ColumnFamily (com.google.bigtable.admin.v2.ColumnFamily)3