RequestKey { public static RequestKey create(Request request) { return new RequestKey(request); } private  RequestKey(Builder builder); private  RequestKey(Request request); static Builder builder(HttpMethod method, String url); static RequestKey create(Request request); HttpMethod getMethod(); String getUrl(); RequestHeaders getHeaders(); Charset getCharset(); byte[] getBody(); @Override int hashCode(); @Override boolean equals(Object obj); boolean equalsExtended(Object obj); @Override String toString();  }
@SuppressWarnings("deprecation") @Test public void create() throws Exception { Map<String, Collection<String>> map = new HashMap<String, Collection<String>>(); map.put("my-header", Arrays.asList("val")); Request request = Request.create(Request.HttpMethod.GET, "a", map, "content".getBytes(StandardCharsets.UTF_8), StandardCharsets.UTF_16); requestKey = RequestKey.create(request); assertThat(requestKey.getMethod(), equalTo(HttpMethod.GET)); assertThat(requestKey.getUrl(), equalTo("a")); assertThat(requestKey.getHeaders().size(), is(1)); assertThat(requestKey.getHeaders().fetch("my-header"), equalTo((Collection<String>) Arrays.asList("val"))); assertThat(requestKey.getCharset(), equalTo(StandardCharsets.UTF_16)); assertThat(requestKey.getBody(), equalTo("content".getBytes(StandardCharsets.UTF_8))); }