Source:
void GetNonExistantBlob(AmbryCoordinator ac) throws InterruptedException, StoreException, IOException, CoordinatorException { BlobProperties putBlobProperties = new BlobProperties(100, "serviceId", "memberId", "contentType", false, Utils.Infinite_Time); ByteBuffer putUserMetadata = ByteBuffer.allocate(10); for (byte b = 0; b < 10; b++) { putUserMetadata.put(b); } ByteBuffer putContent = ByteBuffer.allocate(100); for (byte b = 0; b < 100; b++) { putContent.put(b); } putContent.flip(); InputStream blobData = new ByteBufferInputStream(putContent); String blobId = ac.putBlob(putBlobProperties, putUserMetadata, blobData); String nonExistantBlobId = (char) (blobId.charAt(0) + 1) + blobId.substring(1); try { BlobOutput getBlobOutput = ac.getBlob(nonExistantBlobId); fail("GetBlob for a non existing blob should have thrown CoordinatorException " + blobId); } catch (CoordinatorException coordinatorException) { assertEquals(coordinatorException.getErrorCode(), CoordinatorError.BlobDoesNotExist); } try { BlobProperties getBlobProperties = ac.getBlobProperties(nonExistantBlobId); fail("GetBlobProperties for a non existing blob should have thrown CoordinatorException " + blobId); } catch (CoordinatorException coordinatorException) { assertEquals(coordinatorException.getErrorCode(), CoordinatorError.BlobDoesNotExist); } try { ByteBuffer getUserMetadata = ac.getBlobUserMetadata(nonExistantBlobId); fail("GetUserMetaData for a non existing blob should have thrown CoordinatorException " + blobId); } catch (CoordinatorException coordinatorException) { assertEquals(coordinatorException.getErrorCode(), CoordinatorError.BlobDoesNotExist); } try { ac.deleteBlob(blobId); } catch (CoordinatorException coordinatorException) { fail("DeleteBlob of a non existing blob should not have thrown CoordinatorException " + blobId); } }

Target:
void GetNonExistantBlob(AmbryCoordinator ac) throws InterruptedException, StoreException, IOException, CoordinatorException { BlobProperties putBlobProperties = new BlobProperties(100, "serviceId", "memberId", "contentType", false, Utils.Infinite_Time); ByteBuffer putUserMetadata = ByteBuffer.allocate(10); for (byte b = 0; b < 10; b++) { putUserMetadata.put(b); } ByteBuffer putContent = ByteBuffer.allocate(100); for (byte b = 0; b < 100; b++) { putContent.put(b); } putContent.flip(); InputStream blobData = new ByteBufferInputStream(putContent); String blobId = ac.putBlob(putBlobProperties, putUserMetadata, blobData); String nonExistantBlobId = (char) (blobId.charAt(0) + 1) + blobId.substring(1); try { BlobOutput getBlobOutput = ac.getBlob(nonExistantBlobId); fail("GetBlob for a non existing blob should have thrown CoordinatorException " + blobId); } catch (CoordinatorException coordinatorException) { assertEquals(coordinatorException.getErrorCode(), CoordinatorError.BlobDoesNotExist); } try { BlobProperties getBlobProperties = ac.getBlobProperties(nonExistantBlobId); fail("GetBlobProperties for a non existing blob should have thrown CoordinatorException " + blobId); } catch (CoordinatorException coordinatorException) { assertEquals(coordinatorException.getErrorCode(), CoordinatorError.BlobDoesNotExist); } try { ByteBuffer getUserMetadata = ac.getBlobUserMetadata(nonExistantBlobId); fail("GetUserMetaData for a non existing blob should have thrown CoordinatorException " + blobId); } catch (CoordinatorException coordinatorException) { assertEquals(coordinatorException.getErrorCode(), CoordinatorError.BlobDoesNotExist); } try { ac.deleteBlob(nonExistantBlobId); fail("DeleteBlob of a non existing blob should have thrown CoordinatorException " + blobId); } catch (CoordinatorException coordinatorException) { assertEquals(coordinatorException.getErrorCode(), CoordinatorError.BlobDoesNotExist); } }