@Test
  public void testDoBearerAuth_returnsFalseOnBasicAuth()
      throws IOException, InterruptedException, GeneralSecurityException, URISyntaxException,
          RegistryException {
    String basicAuth =
        "HTTP/1.1 401 Unauthorized\nContent-Length: 0\nWWW-Authenticate: Basic foo\n\n";
    registry = new TestWebServer(false, Arrays.asList(basicAuth), 1);

    RegistryClient registryClient = createRegistryClient(null);
    Assert.assertFalse(registryClient.doPullBearerAuth());

    Mockito.verify(eventHandlers).dispatch(logContains("attempting bearer auth"));
    Mockito.verify(eventHandlers).dispatch(logContains("server requires basic auth"));
  }
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