### Question:
RegistryClient { public boolean doPullBearerAuth() throws IOException, RegistryException { return doBearerAuth(true); } private  RegistryClient(
      EventHandlers eventHandlers,
      @Nullable Credential credential,
      RegistryEndpointRequestProperties registryEndpointRequestProperties,
      @Nullable String userAgent,
      FailoverHttpClient httpClient); static Factory factory(
      EventHandlers eventHandlers,
      String serverUrl,
      String imageName,
      FailoverHttpClient httpClient); static Factory factory(
      EventHandlers eventHandlers,
      String serverUrl,
      String imageName,
      String sourceImageName,
      FailoverHttpClient httpClient); void configureBasicAuth(); boolean doPullBearerAuth(); boolean doPushBearerAuth(); void authPullByWwwAuthenticate(String wwwAuthenticate); Optional<ManifestAndDigest<ManifestTemplate>> checkManifest(String imageQualifier); ManifestAndDigest<T> pullManifest(
      String imageQualifier, Class<T> manifestTemplateClass); ManifestAndDigest<ManifestTemplate> pullManifest(String imageQualifier); DescriptorDigest pushManifest(ManifestTemplate manifestTemplate, String imageTag); Optional<BlobDescriptor> checkBlob(DescriptorDigest blobDigest); Blob pullBlob(
      DescriptorDigest blobDigest,
      Consumer<Long> blobSizeListener,
      Consumer<Long> writtenByteCountListener); boolean pushBlob(
      DescriptorDigest blobDigest,
      Blob blob,
      @Nullable String sourceRepository,
      Consumer<Long> writtenByteCountListener);  }### Answer:
@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")); }