static BuildResult fromImage(Image image, Class<? extends BuildableManifestTemplate> targetFormat)
      throws IOException {
    ImageToJsonTranslator imageToJsonTranslator = new ImageToJsonTranslator(image);
    BlobDescriptor containerConfigurationBlobDescriptor =
        Digests.computeDigest(imageToJsonTranslator.getContainerConfiguration());
    BuildableManifestTemplate manifestTemplate =
        imageToJsonTranslator.getManifestTemplate(
            targetFormat, containerConfigurationBlobDescriptor);
    DescriptorDigest imageDigest = Digests.computeJsonDigest(manifestTemplate);
    DescriptorDigest imageId = containerConfigurationBlobDescriptor.getDigest();
    return new BuildResult(imageDigest, imageId, false);
  }
@Test
  public void testFromImage() throws IOException {
    Image image1 = Image.builder(V22ManifestTemplate.class).setUser("user").build();
    Image image2 = Image.builder(V22ManifestTemplate.class).setUser("user").build();
    Image image3 = Image.builder(V22ManifestTemplate.class).setUser("anotherUser").build();
    Assert.assertEquals(
        BuildResult.fromImage(image1, V22ManifestTemplate.class),
        BuildResult.fromImage(image2, V22ManifestTemplate.class));
    Assert.assertNotEquals(
        BuildResult.fromImage(image1, V22ManifestTemplate.class),
        BuildResult.fromImage(image3, V22ManifestTemplate.class));
  }