Source:
<code>private void doExceptionHandlingTest(Router router, RouterUsage routerUsage, RouterErrorCode routerErrorCode, String expectedErrorMsg) throws Exception { BlobProperties putBlobProperties = new BlobProperties(100, "serviceId", "memberId", "contentType", false, Utils.Infinite_Time); byte[] putUserMetadata = getByteArray(10); byte[] putContent = getByteArray(100); RouterOperationCallback<String> putBlobCallback = null; RouterOperationCallback<BlobInfo> getBlobInfoCallback = null; RouterOperationCallback<ReadableStreamChannel> getBlobCallback = null; RouterOperationCallback<Void> deleteBlobCallback = null; if (RouterUsage.WithCallback.equals(routerUsage)) { putBlobCallback = new RouterOperationCallback<String>(); getBlobInfoCallback = new RouterOperationCallback<BlobInfo>(); getBlobCallback = new RouterOperationCallback<ReadableStreamChannel>(); deleteBlobCallback = new RouterOperationCallback<Void>(); } String blobId = "@@placeholder@"; try { blobId = putBlob(router, putBlobProperties, putUserMetadata, putContent, putBlobCallback); fail("Operation would have thrown exception which should have been propagated"); } catch (Exception e) { <START> checkException(e, routerErrorCode, expectedErrorMsg); <END> } try { getBlobInfoAndCompare(router, blobId, putBlobProperties, putUserMetadata, getBlobInfoCallback); fail("Operation would have thrown exception which should have been propagated"); } catch (Exception e) { checkException(e, routerErrorCode, expectedErrorMsg); } try { getBlobAndCompare(router, blobId, putContent, getBlobCallback); fail("MockCoordinator would have thrown exception which should have been propagated"); } catch (Exception e) { checkException(e, routerErrorCode, expectedErrorMsg); } try { deleteBlob(router, blobId, deleteBlobCallback); fail("MockCoordinator would have thrown exception which should have been propagated"); } catch (Exception e) { checkException(e, routerErrorCode, expectedErrorMsg); } }</code><technical_language>methods do similar - verifyExceptionMatch(), matchRouterErrorCode() checkException(). I assume thought this necessary this way</technical_language>

Target:
private void doExceptionHandlingTest(Router router, RouterUsage routerUsage, RouterErrorCode routerErrorCode, String expectedErrorMsg) throws Exception { BlobProperties putBlobProperties = new BlobProperties(100, "serviceId", "memberId", "contentType", false, Utils.Infinite_Time); byte[] putUserMetadata = getByteArray(10); byte[] putContent = getByteArray(100); RouterOperationCallback<String> putBlobCallback = null; RouterOperationCallback<BlobInfo> getBlobInfoCallback = null; RouterOperationCallback<ReadableStreamChannel> getBlobCallback = null; RouterOperationCallback<Void> deleteBlobCallback = null; if (RouterUsage.WithCallback.equals(routerUsage)) { putBlobCallback = new RouterOperationCallback<String>(); getBlobInfoCallback = new RouterOperationCallback<BlobInfo>(); getBlobCallback = new RouterOperationCallback<ReadableStreamChannel>(); deleteBlobCallback = new RouterOperationCallback<Void>(); } String blobId = "@@placeholder@"; try { blobId = putBlob(router, putBlobProperties, putUserMetadata, putContent, putBlobCallback); fail("Operation would have thrown exception which should have been propagated"); } catch (Exception e) { verifyExpectedException(e, routerErrorCode, expectedErrorMsg); } try { getBlobInfoAndCompare(router, blobId, putBlobProperties, putUserMetadata, getBlobInfoCallback); fail("Operation would have thrown exception which should have been propagated"); } catch (Exception e) { verifyExpectedException(e, routerErrorCode, expectedErrorMsg); } try { getBlobAndCompare(router, blobId, putContent, getBlobCallback); fail("MockCoordinator would have thrown exception which should have been propagated"); } catch (Exception e) { verifyExpectedException(e, routerErrorCode, expectedErrorMsg); } try { deleteBlob(router, blobId, deleteBlobCallback); fail("MockCoordinator would have thrown exception which should have been propagated"); } catch (Exception e) { verifyExpectedException(e, routerErrorCode, expectedErrorMsg); } }