AmazonWebServiceRequestAdapter extends RequestConfig { @Override public Map<String, String> getCustomRequestHeaders() { return (request.getCustomRequestHeaders() == null) ? Collections.<String, String>emptyMap() : request.getCustomRequestHeaders(); } AmazonWebServiceRequestAdapter(AmazonWebServiceRequest request); @Override ProgressListener getProgressListener(); @Override RequestMetricCollector getRequestMetricsCollector(); @Override AWSCredentialsProvider getCredentialsProvider(); @Override Map<String, String> getCustomRequestHeaders(); @Override Map<String, List<String>> getCustomQueryParameters(); @Override Integer getRequestTimeout(); @Override Integer getClientExecutionTimeout(); @Override RequestClientOptions getRequestClientOptions(); @Override String getRequestType(); @Override Object getOriginalRequest();  }
@Test public void customHeadersSetInBaseRequest_AreAdaptedToMap() { AmazonWebServiceRequest request = new EmptyAmazonWebServiceRequest(); request.putCustomRequestHeader("FooHeader", "FooValue"); request.putCustomRequestHeader("BarHeader", "BarValue"); AmazonWebServiceRequestAdapter adapter = new AmazonWebServiceRequestAdapter(request); assertThat(adapter.getCustomRequestHeaders(), hasEntry("FooHeader", "FooValue")); assertThat(adapter.getCustomRequestHeaders(), hasEntry("BarHeader", "BarValue")); }
@Test public void noHeadersSetInBaseRequest_AreAdaptedToEmptyMap() { AmazonWebServiceRequestAdapter adapter = adaptEmpty(); assertThat(adapter.getCustomRequestHeaders().entrySet(), empty()); }