### Question:
CloudFoundryHttpHeaderProvider implements HttpHeadersProvider { @Override public HttpHeaders getHeaders(Instance instance) { String applicationId = instance.getRegistration().getMetadata().get("applicationId"); String instanceId = instance.getRegistration().getMetadata().get("instanceId"); if (StringUtils.hasText(applicationId) && StringUtils.hasText(instanceId)) { HttpHeaders headers = new HttpHeaders(); headers.set("X-CF-APP-INSTANCE", applicationId + ":" + instanceId); return headers; } return HttpHeaders.EMPTY; }  @Override HttpHeaders getHeaders(Instance instance);  }### Answer:
@Test public void test_cloud_foundry_header() { Registration registration = Registration.create("foo", "http: .metadata("applicationId", "549e64cf-a478-423d-9d6d-02d803a028a8") .metadata("instanceId", "0") .build(); Instance instance = Instance.create(InstanceId.of("id")).register(registration); assertThat(headersProvider.getHeaders(instance).get("X-CF-APP-INSTANCE")).containsOnly( "549e64cf-a478-423d-9d6d-02d803a028a8:0"); }
@Test public void test_cloud_foundry_header() { Registration registration = Registration.create("foo", "http: .metadata("applicationId", "549e64cf-a478-423d-9d6d-02d803a028a8").metadata("instanceId", "0").build(); Instance instance = Instance.create(InstanceId.of("id")).register(registration); assertThat(headersProvider.getHeaders(instance).get("X-CF-APP-INSTANCE")) .containsOnly("549e64cf-a478-423d-9d6d-02d803a028a8:0"); }
@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(); }