SetVCloudTokenCookie implements HttpRequestFilter { @Override public HttpRequest filter(HttpRequest request) throws HttpException { return request.toBuilder().replaceHeader(HttpHeaders.COOKIE, "vcloud-token=" + vcloudTokenProvider.get()).build(); } @Inject  SetVCloudTokenCookie(@VCloudToken Provider<String> authTokenProvider); @Override HttpRequest filter(HttpRequest request);  }
@Test public void testApply() { HttpRequest request = HttpRequest.builder().method("GET").endpoint("http: request = filter.filter(request); assertEquals(request.getHeaders().size(), 1); assertEquals(request.getFirstHeaderOrNull(HttpHeaders.COOKIE), "vcloud-token=token"); }