@Test
  public void testPullManifest()
      throws IOException, InterruptedException, GeneralSecurityException, URISyntaxException,
          RegistryException {
    String manifestResponse =
        "HTTP/1.1 200 OK\nContent-Length: 307\n\n{\n"
            + "    \"schemaVersion\": 2,\n"
            + "    \"mediaType\": \"application/vnd.docker.distribution.manifest.v2+json\",\n"
            + "    \"config\": {\n"
            + "        \"mediaType\": \"application/vnd.docker.container.image.v1+json\",\n"
            + "        \"size\": 7023,\n"
            + "        \"digest\": \"sha256:b5b2b2c507a0944348e0303114d8d93aaaa081732b86451d9bce1f432a537bc7\"\n"
            + "    }\n"
            + "}";

    registry = new TestWebServer(false, Arrays.asList(manifestResponse), 1);
    RegistryClient registryClient = createRegistryClient(null);
    ManifestAndDigest<?> manifestAndDigest = registryClient.pullManifest("image-tag");

    Assert.assertEquals(
        "sha256:6b61466eabab6e5ffb68ae2bd9b85c789225540c2ac54ea1f71eb327588e8946",
        manifestAndDigest.getDigest().toString());

    Assert.assertTrue(manifestAndDigest.getManifest() instanceof V22ManifestTemplate);
    V22ManifestTemplate manifest = (V22ManifestTemplate) manifestAndDigest.getManifest();
    Assert.assertEquals(2, manifest.getSchemaVersion());
    Assert.assertEquals(
        "application/vnd.docker.distribution.manifest.v2+json", manifest.getManifestMediaType());
    Assert.assertEquals(
        "sha256:b5b2b2c507a0944348e0303114d8d93aaaa081732b86451d9bce1f432a537bc7",
        manifest.getContainerConfiguration().getDigest().toString());
    Assert.assertEquals(7023, manifest.getContainerConfiguration().getSize());

    MatcherAssert.assertThat(
        registry.getInputRead(),
        CoreMatchers.containsString("GET /v2/foo/bar/manifests/image-tag "));
  }
Tests for {@link RegistryClient}. More comprehensive tests can be found in the integration tests.
jib-core/src/test/java/com/google/cloud/tools/jib/registry/RegistryClientTest.java