private void verifyBlobWriteTo(String expected, Blob blob) throws IOException {
    OutputStream outputStream = new ByteArrayOutputStream();
    BlobDescriptor blobDescriptor = blob.writeTo(outputStream);

    String output = outputStream.toString();
    Assert.assertEquals(expected, output);

    byte[] expectedBytes = expected.getBytes(StandardCharsets.UTF_8);
    Assert.assertEquals(expectedBytes.length, blobDescriptor.getSize());

    DescriptorDigest expectedDigest =
        Digests.computeDigest(new ByteArrayInputStream(expectedBytes)).getDigest();
    Assert.assertEquals(expectedDigest, blobDescriptor.getDigest());
  }
Checks that the {@link Blob} streams the expected string.
jib-core/src/test/java/com/google/cloud/tools/jib/blob/BlobTest.java