### Question:
JsonToImageTranslator { public static Image toImage(V21ManifestTemplate manifestTemplate) throws LayerPropertyNotFoundException, BadContainerConfigurationFormatException { Image.Builder imageBuilder = Image.builder(V21ManifestTemplate.class); for (DescriptorDigest digest : Lists.reverse(manifestTemplate.getLayerDigests())) { imageBuilder.addLayer(new DigestOnlyLayer(digest)); } if (manifestTemplate.getContainerConfiguration().isPresent()) { configureBuilderWithContainerConfiguration( imageBuilder, manifestTemplate.getContainerConfiguration().get()); } return imageBuilder.build(); } private  JsonToImageTranslator(); static Image toImage(V21ManifestTemplate manifestTemplate); static Image toImage(
      BuildableManifestTemplate manifestTemplate,
      ContainerConfigurationTemplate containerConfigurationTemplate);  }### Answer:
@Test public void testToImage_v21() throws IOException, LayerPropertyNotFoundException, DigestException, URISyntaxException, BadContainerConfigurationFormatException { Path jsonFile = Paths.get(getClass().getClassLoader().getResource("core/json/v21manifest.json").toURI()); V21ManifestTemplate manifestTemplate = JsonTemplateMapper.readJsonFromFile(jsonFile, V21ManifestTemplate.class); Image image = JsonToImageTranslator.toImage(manifestTemplate); List<Layer> layers = image.getLayers(); Assert.assertEquals(2, layers.size()); Assert.assertEquals( DescriptorDigest.fromDigest( "sha256:5bd451067f9ab05e97cda8476c82f86d9b69c2dffb60a8ad2fe3723942544ab3"), layers.get(0).getBlobDescriptor().getDigest()); Assert.assertEquals( DescriptorDigest.fromDigest( "sha256:8c662931926fa990b41da3c9f42663a537ccd498130030f9149173a0493832ad"), layers.get(1).getBlobDescriptor().getDigest()); }
@Test public void testToImage_canParseTimestampWithOffset() throws IOException, LayerPropertyNotFoundException, URISyntaxException, LayerCountMismatchException, BadContainerConfigurationFormatException { Path containerConfigJson = Paths.get( getClass().getClassLoader().getResource("core/json/containerconfig.json").toURI()); ContainerConfigurationTemplate containerConfig = JsonTemplateMapper.readJsonFromFile( containerConfigJson, ContainerConfigurationTemplate.class); containerConfig.setCreated("2020-04-21T13:22:10.836777828-07:00"); Path manifestJson = Paths.get(getClass().getClassLoader().getResource("core/json/v22manifest.json").toURI()); V22ManifestTemplate manifest = JsonTemplateMapper.readJsonFromFile(manifestJson, V22ManifestTemplate.class); JsonToImageTranslator.toImage(manifest, containerConfig); }