public <T extends BuildableManifestTemplate> ManifestTemplate getManifestListTemplate(
      Class<T> manifestTemplateClass) throws IOException {
    Preconditions.checkArgument(
        manifestTemplateClass == V22ManifestTemplate.class,
        "Build an OCI image index is not yet supported");
    Preconditions.checkState(!images.isEmpty(), "no images given");

    V22ManifestListTemplate manifestList = new V22ManifestListTemplate();
    for (Image image : images) {
      ImageToJsonTranslator imageTranslator = new ImageToJsonTranslator(image);

      BlobDescriptor configDescriptor =
          Digests.computeDigest(imageTranslator.getContainerConfiguration());

      BuildableManifestTemplate manifestTemplate =
          imageTranslator.getManifestTemplate(manifestTemplateClass, configDescriptor);
      BlobDescriptor manifestDescriptor = Digests.computeDigest(manifestTemplate);

      ManifestDescriptorTemplate manifest = new ManifestDescriptorTemplate();
      manifest.setMediaType(manifestTemplate.getManifestMediaType());
      manifest.setSize(manifestDescriptor.getSize());
      manifest.setDigest(manifestDescriptor.getDigest().toString());
      manifest.setPlatform(image.getArchitecture(), image.getOs());
      manifestList.addManifest(manifest);
    }
    return manifestList;
  }
@Test
  public void testGetManifestListTemplate_unsupportedImageFormat() throws IOException {
    try {
      new ManifestListGenerator(Arrays.asList(image1, image2))
          .getManifestListTemplate(OciManifestTemplate.class);
      Assert.fail();
    } catch (IllegalArgumentException ex) {
      Assert.assertEquals("Build an OCI image index is not yet supported", ex.getMessage());
    }
  }