コード例 #1
0
 private static void assertHeaders(ActionRequest<?> request, Map<String, String> headers) {
   if (headers.size() == 0) {
     assertThat(request.getHeaders() == null || request.getHeaders().size() == 0, equalTo(true));
   } else {
     assertThat(request.getHeaders(), notNullValue());
     assertThat(request.getHeaders().size(), equalTo(headers.size()));
     for (String key : request.getHeaders()) {
       assertThat(headers.get(key), equalTo(request.getHeader(key)));
     }
   }
 }
コード例 #2
0
 private static void assertContext(ActionRequest<?> request, Map<String, String> context) {
   if (context.size() == 0) {
     assertThat(request.isContextEmpty(), is(true));
   } else {
     ImmutableOpenMap map = request.getContext();
     assertThat(map, notNullValue());
     assertThat(map.size(), equalTo(context.size()));
     for (Object key : map.keys()) {
       assertThat(context.get(key), equalTo(request.getFromContext(key)));
     }
   }
 }
コード例 #3
0
 private static void putContext(ActionRequest<?> request, Map<String, String> context) {
   for (Map.Entry<String, String> header : context.entrySet()) {
     request.putInContext(header.getKey(), header.getValue());
   }
 }
コード例 #4
0
 private static void putHeaders(ActionRequest<?> request, Map<String, String> headers) {
   for (Map.Entry<String, String> header : headers.entrySet()) {
     request.putHeader(header.getKey(), header.getValue());
   }
 }