### Question:
GetBlobOperation extends GetOperation { @Override void poll(RequestRegistrationCallback<GetOperation> requestRegistrationCallback) { if (isOperationComplete()) { return; } if (operationException.get() == null) { if (firstChunk.isReady() || firstChunk.isInProgress()) { firstChunk.poll(requestRegistrationCallback); } if (firstChunk.isComplete()) { onChunkOperationComplete(firstChunk); if (blobDataChannel != null) { blobDataChannel.maybeWriteToChannel(); } if (dataChunks != null) { for (GetChunk dataChunk : dataChunks) { if (dataChunk.isFree() && chunkIdIterator.hasNext()) { dataChunk.initialize(chunkIdIterator.nextIndex(), chunkIdIterator.next()); } if (dataChunk.isInProgress() || (dataChunk.isReady() && numChunksRetrieved.get() - blobDataChannel.getNumChunksWrittenOut() < routerConfig.routerMaxInMemGetChunks)) { dataChunk.poll(requestRegistrationCallback); if (dataChunk.isComplete()) { onChunkOperationComplete(dataChunk); if (isOperationComplete()) { break; } } } } } } } if (operationException.get() != null) { abort(operationException.get()); } } GetBlobOperation(RouterConfig routerConfig, NonBlockingRouterMetrics routerMetrics, ClusterMap clusterMap,
      ResponseHandler responseHandler, BlobId blobId, GetBlobOptionsInternal options,
      Callback<GetBlobResultInternal> callback, RouterCallback routerCallback, BlobIdFactory blobIdFactory,
      KeyManagementService kms, CryptoService cryptoService, CryptoJobHandler cryptoJobHandler, Time time,
      boolean isEncrypted);   }### Answer:
@Test public void testSetOperationException() throws Exception { doPut(); GetBlobOperation op = createOperation(routerConfig, null); RouterErrorCode[] routerErrorCodes = new RouterErrorCode[8]; routerErrorCodes[0] = RouterErrorCode.BlobDoesNotExist; routerErrorCodes[1] = RouterErrorCode.OperationTimedOut; routerErrorCodes[2] = RouterErrorCode.UnexpectedInternalError; routerErrorCodes[3] = RouterErrorCode.AmbryUnavailable; routerErrorCodes[4] = RouterErrorCode.RangeNotSatisfiable; routerErrorCodes[5] = RouterErrorCode.BlobExpired; routerErrorCodes[6] = RouterErrorCode.BlobDeleted; routerErrorCodes[7] = RouterErrorCode.InvalidBlobId; for (int i = 0; i < routerErrorCodes.length; ++i) { op.setOperationException(new RouterException("RouterError", routerErrorCodes[i])); op.poll(requestRegistrationCallback); while (!op.isOperationComplete()) { time.sleep(routerConfig.routerRequestTimeoutMs + 1); op.poll(requestRegistrationCallback); } Assert.assertEquals(((RouterException) op.operationException.get()).getErrorCode(), routerErrorCodes[i]); } for (int i = routerErrorCodes.length - 1; i >= 0; --i) { op.setOperationException(new RouterException("RouterError", routerErrorCodes[i])); op.poll(requestRegistrationCallback); while (!op.isOperationComplete()) { time.sleep(routerConfig.routerRequestTimeoutMs + 1); op.poll(requestRegistrationCallback); } Assert.assertEquals(((RouterException) op.operationException.get()).getErrorCode(), routerErrorCodes[routerErrorCodes.length - 1]); } op.operationException.set(null); Exception nonRouterException = new Exception(); op.setOperationException(nonRouterException); op.poll(requestRegistrationCallback); while (!op.isOperationComplete()) { time.sleep(routerConfig.routerRequestTimeoutMs + 1); op.poll(requestRegistrationCallback); } Assert.assertEquals(nonRouterException, op.operationException.get()); op.setOperationException(new RouterException("RouterError", RouterErrorCode.BlobDeleted)); op.poll(requestRegistrationCallback); while (!op.isOperationComplete()) { time.sleep(routerConfig.routerRequestTimeoutMs + 1); op.poll(requestRegistrationCallback); } Assert.assertEquals(((RouterException) op.operationException.get()).getErrorCode(), RouterErrorCode.BlobDeleted); }