@Nullable
  DockerCredentialHelper getCredentialHelperFor(String registry) {
    List<Predicate<String>> registryMatchers = getRegistryMatchersFor(registry);

    Map.Entry<String, String> firstCredHelperMatch =
        findFirstInMapByKey(dockerConfigTemplate.getCredHelpers(), registryMatchers);
    if (firstCredHelperMatch != null) {
      return new DockerCredentialHelper(
          firstCredHelperMatch.getKey(),
          Paths.get("docker-credential-" + firstCredHelperMatch.getValue()));
    }

    if (dockerConfigTemplate.getCredsStore() != null) {
      return new DockerCredentialHelper(
          registry, Paths.get("docker-credential-" + dockerConfigTemplate.getCredsStore()));
    }

    return null;
  }
@Test
  public void testGetCredentialHelperFor_withHttps() throws URISyntaxException, IOException {
    Path json = Paths.get(Resources.getResource("core/json/dockerconfig.json").toURI());

    DockerConfig dockerConfig =
        new DockerConfig(JsonTemplateMapper.readJsonFromFile(json, DockerConfigTemplate.class));

    Assert.assertEquals(
        Paths.get("docker-credential-credHelper for https__with.protocol.in.helpers"),
        dockerConfig.getCredentialHelperFor("with.protocol.in.helpers").getCredentialHelper());
  }