### Question:
BasicAuthHttpHeaderProvider implements HttpHeadersProvider { @Override public HttpHeaders getHeaders(Instance instance) { String username = instance.getRegistration().getMetadata().get("user.name"); String password = instance.getRegistration().getMetadata().get("user.password"); HttpHeaders headers = new HttpHeaders(); if (StringUtils.hasText(username) && StringUtils.hasText(password)) { headers.set(HttpHeaders.AUTHORIZATION, encode(username, password)); } return headers; }  @Override HttpHeaders getHeaders(Instance instance);  }### Answer:
@Test public void test_auth_header() { Registration registration = Registration.create("foo", "http: .metadata("user.name", "test") .metadata("user.password", "drowssap") .build(); Instance instance = Instance.create(InstanceId.of("id")).register(registration); assertThat(headersProvider.getHeaders(instance).get(HttpHeaders.AUTHORIZATION)).containsOnly( "Basic dGVzdDpkcm93c3NhcA=="); }
@Test public void test_no_header() { Registration registration = Registration.create("foo", "http: Instance instance = Instance.create(InstanceId.of("id")).register(registration); assertThat(headersProvider.getHeaders(instance)).isEmpty(); }