### Question:
QueryStringSigner extends AbstractAWSSigner implements Signer { @Override public void sign(Request<?> request, AWSCredentials credentials) { sign(request, SignatureVersion.V2, SigningAlgorithm.HmacSHA256, credentials); }  @Override void sign(Request<?> request, AWSCredentials credentials); void sign(Request<?> request, SignatureVersion version, SigningAlgorithm algorithm,
            AWSCredentials credentials);  }### Answer:
@Test public void testRequestResourcePath() throws Exception { Request<?> request = new DefaultRequest<Void>(null, "foo"); request.setEndpoint(URI.create("http: request.addParameter("foo", "bar"); request.setResourcePath("foo/bar"); signer.sign(request, credentials); assertNotNull(request.getParameters().get("Signature")); assertEquals(EXPECTED_SIGNATURE, request.getParameters().get("Signature")); }
@Test public void testRequestAndEndpointResourcePath() throws Exception { Request<?> request = new DefaultRequest<Void>(null, "foo"); request.setEndpoint(URI.create("http: request.addParameter("foo", "bar"); request.setResourcePath("/bar"); signer.sign(request, credentials); assertNotNull(request.getParameters().get("Signature")); assertEquals(EXPECTED_SIGNATURE, request.getParameters().get("Signature")); }
@Test public void testRequestAndEndpointResourcePathNoSlash() throws Exception { Request<?> request = new DefaultRequest<Void>(null, "foo"); request.setEndpoint(URI.create("http: request.addParameter("foo", "bar"); request.setResourcePath("bar"); signer.sign(request, credentials); assertNotNull(request.getParameters().get("Signature")); assertEquals(EXPECTED_SIGNATURE, request.getParameters().get("Signature")); }
@Test public void testAnonymous() throws Exception { Request<?> request = new DefaultRequest<Void>(null, "foo"); request.setEndpoint(URI.create("http: request.addParameter("foo", "bar"); request.setResourcePath("bar"); signer.sign(request, new AnonymousAWSCredentials()); assertNull(request.getParameters().get("Signature")); }