ListGcsBuckets { public static void listGcsBuckets(String googleAccessKeyId, String googleAccessKeySecret) { BasicAWSCredentials googleCreds = new BasicAWSCredentials(googleAccessKeyId, googleAccessKeySecret); AmazonS3 interopClient = AmazonS3ClientBuilder.standard() .withEndpointConfiguration( new AwsClientBuilder.EndpointConfiguration( "https: .withCredentials(new AWSStaticCredentialsProvider(googleCreds)) .build(); List<Bucket> buckets = interopClient.listBuckets(); System.out.println("Buckets:"); for (Bucket bucket : buckets) { System.out.println(bucket.getName()); } interopClient.shutdown(); }  static void listGcsBuckets(String googleAccessKeyId, String googleAccessKeySecret);  }
@Test public void testListBucket() throws Exception { ListGcsBuckets.listGcsBuckets(KEY_ID, SECRET_KEY); String output = bout.toString(); assertThat(output, CoreMatchers.containsString("Buckets:")); }