Commits

James Murty  committed e2ae869

Bucket status lookup test is now less prone to failure

  • Participants
  • Parent commits b64980f

Comments (0)

Files changed (1)

File src/org/jets3t/tests/BaseStorageServiceTests.java

         String bucketName = getBucketNameForTest("testBucketStatusLookup");
         RestStorageService service = getStorageService(getCredentials());
 
-        // Non-existent bucket
-        int status = service.checkBucketStatus(bucketName);
-        assertEquals(S3Service.BUCKET_STATUS__DOES_NOT_EXIST, status);
+        try {
+            // Non-existent bucket
+            int status = service.checkBucketStatus(bucketName);
+            assertEquals(S3Service.BUCKET_STATUS__DOES_NOT_EXIST, status);
 
-        // Bucket is owned by someone else
-        // NOTE: This test will fail if you actually own the "testing" bucket,
-        // or if it is owned by someone else but has been made publicly readable.
-        status = service.checkBucketStatus("testing");
-        assertEquals(S3Service.BUCKET_STATUS__ALREADY_CLAIMED, status);
+            // Bucket is owned by someone else
+            // NOTE: This test will fail if you actually own the "testing" bucket,
+            // or if it is owned by someone else but has been made publicly readable.
+            status = service.checkBucketStatus("testing");
+            assertEquals(S3Service.BUCKET_STATUS__ALREADY_CLAIMED, status);
 
-        try {
             service.createBucket(bucketName);
             // Bucket now exists and is owned by me.
             status = service.checkBucketStatus(bucketName);