AddTimestampQuery implements HttpRequestFilter { @Override public HttpRequest filter(HttpRequest request) throws HttpException { return request.toBuilder().replaceQueryParam("now", dateProvider.get().getTime() + "").build(); } @Inject  AddTimestampQuery(@TimeStamp Supplier<Date> dateProvider); @Override HttpRequest filter(HttpRequest request);  }
@Test public void testApplySetsKey() { final Date date = new Date(); Supplier<Date> dateSupplier = new Supplier<Date>() { @Override public Date get() { return date; } }; HttpRequest request = HttpRequest.builder().method("GET").endpoint("http: AddTimestampQuery filter = new AddTimestampQuery(dateSupplier); request = filter.filter(request); assertEquals(request.getRequestLine(), String.format("GET http: }