@Test public void testCreateSignedRequestConfig() throws ParseException { Date now = DateUtil.now(); String method = "POST"; URI uri = URI.create("http://api.tuppari.com/test?a=v1&b=v2"); String operation = "CreateApplication"; Map<String, Object> body = new LinkedHashMap<String, Object>(); body.put("applicationName", "example1"); String accessKeyId = "accessKeyId"; String accessSecretKey = "accessSecretKey"; Map<String, Object> config = SignUtil.createSignedRequestConfig( method, uri, operation, body, accessKeyId, accessSecretKey); assertThat((URI) config.get("uri"), is(uri)); assertThat((String) config.get("body"), is(JSON.encode(body))); Map<String, String> headers = (Map<String, String>) config.get("headers"); assertThat(headers.get("Host"), is("api.tuppari.com")); assertThat(headers.get("Content-Type"), is("application/json")); assertThat(headers.get("X-Tuppari-Date"), is("Thu, 01 Jan 1970 00:00:00 GMT")); assertThat(headers.get("X-Tuppari-Operation"), is("CreateApplication")); assertThat( headers.get("Authorization"), is( "HMAC-SHA256 Credential=accessKeyId,SignedHeaders=content-type;host;x-tuppari-date;x-tuppari-operation,Signature=f35767c9fdba4ba5d5bbbf1c622fceed0dbaeb210303bb56b419c6a51bcf1e5d")); }