@Override
  public Optional<BlobDescriptor> handleResponse(Response response) throws RegistryErrorException {
    long contentLength = response.getContentLength();
    if (contentLength < 0) {
      throw new RegistryErrorExceptionBuilder(getActionDescription())
          .addReason("Did not receive Content-Length header")
          .build();
    }

    return Optional.of(new BlobDescriptor(contentLength, blobDigest));
  }
@Test
  public void testHandleResponse() throws RegistryErrorException {
    Mockito.when(mockResponse.getContentLength()).thenReturn(0L);
    BlobDescriptor expectedBlobDescriptor = new BlobDescriptor(0, fakeDigest);

    BlobDescriptor blobDescriptor = testBlobChecker.handleResponse(mockResponse).get();

    Assert.assertEquals(expectedBlobDescriptor, blobDescriptor);
  }