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() throws IOException {

    // Expected Manifest List JSON
    //  {
    //  "schemaVersion":2,
    //  "mediaType":"application/vnd.docker.distribution.manifest.list.v2+json",
    //  "manifests":[
    //    {
    //      "mediaType":"application/vnd.docker.distribution.manifest.v2+json",
    //      "digest":"sha256:1f25787aab4669d252bdae09a72b9c345d2a7b8c64c8dbfba4c82af4834dbccc",
    //      "size":264,
    //      "platform":{
    //        "architecture":"amd64",
    //        "os":"linux"
    //      }
    //    },
    //    {
    //      "mediaType":"application/vnd.docker.distribution.manifest.v2+json",
    //      "digest":"sha256:51038a7a91c0e8f747e05dd84c3b0393a7016ec312ce384fc945356778497ae3",
    //      "size":264,
    //      "platform":{
    //        "architecture":"arm64",
    //        "os":"windows"
    //      }
    //    }
    //   ]
    // }

    ManifestTemplate manifestTemplate =
        manifestListGenerator.getManifestListTemplate(V22ManifestTemplate.class);
    Assert.assertTrue(manifestTemplate instanceof V22ManifestListTemplate);
    V22ManifestListTemplate manifestList = (V22ManifestListTemplate) manifestTemplate;
    Assert.assertEquals(2, manifestList.getSchemaVersion());
    Assert.assertEquals(
        Arrays.asList("sha256:1f25787aab4669d252bdae09a72b9c345d2a7b8c64c8dbfba4c82af4834dbccc"),
        manifestList.getDigestsForPlatform("amd64", "linux"));
    Assert.assertEquals(
        Arrays.asList("sha256:51038a7a91c0e8f747e05dd84c3b0393a7016ec312ce384fc945356778497ae3"),
        manifestList.getDigestsForPlatform("arm64", "windows"));
  }