AmazonWebServiceRequestAdapter extends RequestConfig { @Override public Map<String, List<String>> getCustomQueryParameters() { return (request.getCustomQueryParameters() == null) ? Collections.<String, List<String>>emptyMap() : request.getCustomQueryParameters(); } 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 customQueryParamsSetInBaseRequest_AreAdaptedToMap() { AmazonWebServiceRequest request = new EmptyAmazonWebServiceRequest(); request.putCustomQueryParameter("FooParam", "FooValue"); request.putCustomQueryParameter("BarParam", "BarValue"); AmazonWebServiceRequestAdapter adapter = new AmazonWebServiceRequestAdapter(request); final Map<String, List<String>> params = adapter.getCustomQueryParameters(); assertThat(params, hasEntry("FooParam", Arrays.asList("FooValue"))); assertThat(params, hasEntry("BarParam", Arrays.asList("BarValue"))); }
@Test public void multipleValuesForSameQueryParamSet_IsAdaptedToMap() { AmazonWebServiceRequest request = new EmptyAmazonWebServiceRequest(); request.putCustomQueryParameter("FooParam", "valOne"); request.putCustomQueryParameter("FooParam", "valTwo"); AmazonWebServiceRequestAdapter adapter = new AmazonWebServiceRequestAdapter(request); final Map<String, List<String>> params = adapter.getCustomQueryParameters(); assertThat(params, hasEntry("FooParam", Arrays.asList("valOne", "valTwo"))); }
@Test public void noParamsSetInBaseRequest_AreAdaptedToEmptyMap() { AmazonWebServiceRequestAdapter adapter = adaptEmpty(); assertThat(adapter.getCustomQueryParameters().entrySet(), empty()); }