@Test
  public void testCall_credentialsNotSentOverHttp() throws IOException, RegistryException {
    ResponseException unauthorizedException =
        mockResponseException(HttpStatusCodes.STATUS_CODE_UNAUTHORIZED);
    Mockito.when(unauthorizedException.requestAuthorizationCleared()).thenReturn(true);
    setUpRegistryResponse(unauthorizedException);

    try {
      endpointCaller.call();
      Assert.fail("Call should have failed");

    } catch (RegistryCredentialsNotSentException ex) {
      Assert.assertEquals(
          "Required credentials for serverUrl/imageName were not sent because the connection was over HTTP",
          ex.getMessage());
    }
  }
Implementation of {@link RegistryEndpointProvider} for testing.
jib-core/src/test/java/com/google/cloud/tools/jib/registry/RegistryEndpointCallerTest.java