@Override
  public ManifestTemplate call() throws IOException {
    Preconditions.checkState(!builtImages.isEmpty(), "no images given");
    EventHandlers eventHandlers = buildContext.getEventHandlers();
    try (TimerEventDispatcher ignored = new TimerEventDispatcher(eventHandlers, DESCRIPTION);
        ProgressEventDispatcher ignored2 =
            progressEventDispatcherFactory.create(
                "building a manifest list or a single manifest", 1)) {

      if (builtImages.size() == 1) {
        eventHandlers.dispatch(LogEvent.info("Building a single manifest"));
        ImageToJsonTranslator imageTranslator = new ImageToJsonTranslator(builtImages.get(0));
        BlobDescriptor configDescriptor =
            Digests.computeDigest(imageTranslator.getContainerConfiguration());
        return imageTranslator.getManifestTemplate(
            buildContext.getTargetFormat(), configDescriptor);
      }

      eventHandlers.dispatch(LogEvent.info("Building a manifest list"));
      return new ManifestListGenerator(builtImages)
          .getManifestListTemplate(buildContext.getTargetFormat());
    }
  }
@Test
  public void testCall_manifestList() 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:9467fc431ac5dd84dafdc13f75111fc467cd57aff4732edda8c9e0bbcabe0183",
    //      "size":338,
    //      "platform":{
    //        "architecture":"amd64",
    //        "os":"linux"
    //      }
    //    },
    //    {
    //      "mediaType":"application/vnd.docker.distribution.manifest.v2+json",
    //      "digest":"sha256:439351c848845c46a3952f28416992b66003361d00943b6cdb04b6d5533f02bf",
    //      "size":338,
    //      "platform":{
    //        "architecture":"arm64",
    //        "os":"windows"
    //      }
    //    }
    //  ]
    // }

    ManifestTemplate manifestTemplate =
        new BuildManifestListOrSingleManifestStep(
                buildContext, progressDispatcherFactory, Arrays.asList(image1, image2))
            .call();

    Assert.assertTrue(manifestTemplate instanceof V22ManifestListTemplate);
    V22ManifestListTemplate manifestList = (V22ManifestListTemplate) manifestTemplate;
    Assert.assertEquals(2, manifestList.getSchemaVersion());
    Assert.assertEquals(
        Arrays.asList("sha256:9467fc431ac5dd84dafdc13f75111fc467cd57aff4732edda8c9e0bbcabe0183"),
        manifestList.getDigestsForPlatform("amd64", "linux"));
    Assert.assertEquals(
        Arrays.asList("sha256:439351c848845c46a3952f28416992b66003361d00943b6cdb04b6d5533f02bf"),
        manifestList.getDigestsForPlatform("arm64", "windows"));
  }