GcsUtil { public boolean bucketAccessible(GcsPath path) throws IOException { return bucketAccessible(path, createBackOff(), Sleeper.DEFAULT); } private  GcsUtil(
      Storage storageClient,
      HttpRequestInitializer httpRequestInitializer,
      ExecutorService executorService,
      Boolean shouldUseGrpc,
      @Nullable Integer uploadBufferSizeBytes); static String getNonWildcardPrefix(String globExp); static boolean isWildcard(GcsPath spec); List<GcsPath> expand(GcsPath gcsPattern); long fileSize(GcsPath path); StorageObject getObject(GcsPath gcsPath); List<StorageObjectOrIOException> getObjects(List<GcsPath> gcsPaths); Objects listObjects(String bucket, String prefix, @Nullable String pageToken); Objects listObjects(
      String bucket, String prefix, @Nullable String pageToken, @Nullable String delimiter); SeekableByteChannel open(GcsPath path); WritableByteChannel create(GcsPath path, String type); WritableByteChannel create(GcsPath path, String type, Integer uploadBufferSizeBytes); boolean bucketAccessible(GcsPath path); long bucketOwner(GcsPath path); void createBucket(String projectId, Bucket bucket); void copy(Iterable<String> srcFilenames, Iterable<String> destFilenames); void remove(Collection<String> filenames);  }
@Test public void testBucketAccessible() throws IOException { GcsOptions pipelineOptions = gcsOptionsWithTestCredential(); GcsUtil gcsUtil = pipelineOptions.getGcsUtil(); Storage mockStorage = Mockito.mock(Storage.class); gcsUtil.setStorageClient(mockStorage); Storage.Buckets mockStorageObjects = Mockito.mock(Storage.Buckets.class); Storage.Buckets.Get mockStorageGet = Mockito.mock(Storage.Buckets.Get.class); BackOff mockBackOff = BackOffAdapter.toGcpBackOff(FluentBackoff.DEFAULT.backoff()); when(mockStorage.buckets()).thenReturn(mockStorageObjects); when(mockStorageObjects.get("testbucket")).thenReturn(mockStorageGet); when(mockStorageGet.execute()) .thenThrow(new SocketTimeoutException("SocketException")) .thenReturn(new Bucket()); assertTrue( gcsUtil.bucketAccessible( GcsPath.fromComponents("testbucket", "testobject"), mockBackOff, new FastNanoClockAndSleeper())); }