AccessKeyUtil { public String buildSignature(String path, String query, String timestampString, String secret) { String pathWithQuery = path; if (!Strings.isNullOrEmpty(query)) { pathWithQuery += "?" + query; } return Signature.signature(timestampString, pathWithQuery, secret); } AccessKeyUtil(AccessKeyServiceWithCache accessKeyServiceWithCache); List<String> findAvailableSecret(String appId); String extractAppIdFromRequest(HttpServletRequest request); String buildSignature(String path, String query, String timestampString, String secret);  }
@Test public void buildSignature() { String path = "/configs/someAppId/default/application"; String query = "ip=10.0.0.1"; String timestamp = "1575018989200"; String secret = "someSecret"; String actualSignature = accessKeyUtil.buildSignature(path, query, timestamp, secret); String expectedSignature = "WYjjyJFei6DYiaMlwZjew2O/Yqk="; assertThat(actualSignature).isEqualTo(expectedSignature); }