@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_emptyImagesList() throws IOException {
    try {
      new BuildManifestListOrSingleManifestStep(
              buildContext, progressDispatcherFactory, Collections.emptyList())
          .call();
      Assert.fail();
    } catch (IllegalStateException ex) {
      Assert.assertEquals("no images given", ex.getMessage());
    }
  }