### Question:
AsyncHttpClientEdgeGridSignatureCalculator implements SignatureCalculator { @Override public void calculateAndAddSignature(Request request, RequestBuilderBase<?> requestToUpdate) { try { binding.sign(request, requestToUpdate); } catch (RequestSigningException e) { throw new RuntimeException(e); } } AsyncHttpClientEdgeGridSignatureCalculator(ClientCredential credential);  AsyncHttpClientEdgeGridSignatureCalculator(ClientCredentialProvider credentialProvider); @Override void calculateAndAddSignature(Request request, RequestBuilderBase<?> requestToUpdate);  }### Answer:
@Test(dataProvider = "requests") public void testCalculateAndAddSignatureForGet(Request request) throws Exception { ClientCredential credential = ClientCredential.builder() .accessToken("akaa-dm5g2bfwoodqnc6k-ju7vlao2wz6oz2rp") .clientToken("akaa-k7glklzuxkkh2ycw-oadjphopvpn6yjoj") .clientSecret("SOMESECRET") .host("endpoint.net") .build(); RequestBuilder requestToUpdate = new RequestBuilder(request); new AsyncHttpClientEdgeGridSignatureCalculator(credential).calculateAndAddSignature( request, requestToUpdate); Request updatedRequest = requestToUpdate.build(); assertThat(updatedRequest.getHeaders().get("Authorization"), not(isEmptyOrNullString())); assertThat(updatedRequest.getHeaders().get("Host"), equalTo("endpoint.net")); assertThat(updatedRequest.getUri().getHost(), equalTo("endpoint.net")); }
@Test public void testPreservingQueryString() throws Exception { ClientCredential credential = ClientCredential.builder() .accessToken("akaa-dm5g2bfwoodqnc6k-ju7vlao2wz6oz2rp") .clientToken("akaa-k7glklzuxkkh2ycw-oadjphopvpn6yjoj") .clientSecret("SOMESECRET") .host("endpoint.net") .build(); Request request = new RequestBuilder().setUrl("http: RequestBuilder requestToUpdate = new RequestBuilder(request); new AsyncHttpClientEdgeGridSignatureCalculator(credential).calculateAndAddSignature( request, requestToUpdate); Request updatedRequest = requestToUpdate.build(); assertThat(updatedRequest.getUri().getQuery(), equalTo("x=y")); }
@Test public void testNotDuplicatingQueryString() throws Exception { ClientCredential credential = ClientCredential.builder() .accessToken("akaa-dm5g2bfwoodqnc6k-ju7vlao2wz6oz2rp") .clientToken("akaa-k7glklzuxkkh2ycw-oadjphopvpn6yjoj") .clientSecret("SOMESECRET") .host("endpoint.net") .build(); Request request = new RequestBuilder().setUrl("http: RequestBuilder requestToUpdate = new RequestBuilder(request); new AsyncHttpClientEdgeGridSignatureCalculator(credential).calculateAndAddSignature( request, requestToUpdate); Request updatedRequest = requestToUpdate.build(); assertThat(updatedRequest.getUri().getQuery(), equalTo("x=y")); }