@VisibleForTesting
  URL getAuthenticationUrl(@Nullable Credential credential, Map<String, String> repositoryScopes)
      throws MalformedURLException {
    return isOAuth2Auth(credential)
        ? new URL(realm) // Required parameters will be sent via POST .
        : new URL(realm + "?" + getServiceScopeRequestParameters(repositoryScopes));
  }
@Test
  public void getAuthenticationUrl_basicAuth() throws MalformedURLException {
    Assert.assertEquals(
        new URL("https://somerealm?service=someservice&scope=repository:someimage:scope"),
        registryAuthenticator.getAuthenticationUrl(
            null, Collections.singletonMap("someimage", "scope")));
  }