@Test
/**
 * Test to make sure that the interceptor revokes credentials if an RPC receives an
 * UNAUTHENTICATED status.
 */
public void testInvalidAuthToken() throws IOException {

  Status grpcStatus = Status.UNAUTHENTICATED;
  // Something bad happened, and authentication could not be established
  when(mockCache.getHeader(any(Long.class), any(TimeUnit.class)))
      .thenReturn(new OAuthCredentialsCache.HeaderToken(grpcStatus, null));
  ClientCall<ReadRowsRequest, ReadRowsResponse> call =
      underTest.interceptCall(BigtableGrpc.getReadRowsMethod(), CallOptions.DEFAULT, mockChannel);
  call.start(mockListener, new Metadata());
  // Since the auth header is not available, the call should immediately fail with a non-OK status
  verify(mockListener, times(1)).onClose(same(grpcStatus), any(Metadata.class));
  // Users might do some additional work with call, so it shouldn't be null, but should not
  // forward the request to the underlying call either.
  // Verify that request, sendMessage, halfClose and cancel calls on the call object returned from
  // is not null and does not
  call.request(1);
  verify(mockClientCall, times(0)).request(anyInt());
  call.halfClose();
  verify(mockClientCall, times(0)).halfClose();
  call.sendMessage(ReadRowsRequest.getDefaultInstance());
  verify(mockClientCall, times(0)).sendMessage(any(ReadRowsRequest.class));
  call.cancel("", null);
  verify(mockClientCall, times(0)).cancel(anyString(), any(Throwable.class));
}