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))); } } }
@Override protected void doExecute(ActionRequest request, ActionListener listener) { listener.onFailure(new InternalException(actionName, request.getHeaders())); }