StorageSample { public static List<StorageObject> listBucket(String bucketName) throws IOException, GeneralSecurityException { Storage client = StorageFactory.getService(); Storage.Objects.List listRequest = client.objects().list(bucketName); List<StorageObject> results = new ArrayList<StorageObject>(); Objects objects; do { objects = listRequest.execute(); results.addAll(objects.getItems()); listRequest.setPageToken(objects.getNextPageToken()); } while (null != objects.getNextPageToken()); return results; }  static List<StorageObject> listBucket(String bucketName); static Bucket getBucket(String bucketName); static void uploadFile(String name, String contentType, File file, String bucketName); static void deleteObject(String path, String bucketName); static void main(String[] args);  }
@Test public void testListBucket() throws Exception { List<StorageObject> listing = StorageSample.listBucket(BUCKET); assertThat(listing).isNotEmpty(); }