@Test
  public void testNewRegistryErrorException_nonJsonErrorOutput() {
    ResponseException httpException = Mockito.mock(ResponseException.class);
    // Registry returning non-structured error output
    Mockito.when(httpException.getContent()).thenReturn(">>>>> (404) page not found <<<<<");
    Mockito.when(httpException.getStatusCode()).thenReturn(404);

    RegistryErrorException registryException =
        endpointCaller.newRegistryErrorException(httpException);
    Assert.assertSame(httpException, registryException.getCause());
    Assert.assertEquals(
        "Tried to actionDescription but failed because: registry returned error code 404; "
            + "possible causes include invalid or wrong reference. Actual error output follows:\n"
            + ">>>>> (404) page not found <<<<<\n",
        registryException.getMessage());
  }
Implementation of {@link RegistryEndpointProvider} for testing.
jib-core/src/test/java/com/google/cloud/tools/jib/registry/RegistryEndpointCallerTest.java