JsAPIs { public JsAPISignature createJsAPISignature(String url){ if(jsAPITicket == null || jsAPITicket.expired()) { getJsAPITicket(); } long timestamp = System.currentTimeMillis() / 1000; String nonce = RandomStringGenerator.getRandomStringByLength(16); String ticket = jsAPITicket.getTicket(); try { String signature = SHA1.getSHA1("jsapi_ticket=" + ticket + "&noncestr=" + nonce + "&timestamp=" + timestamp + "&url=" + url); JsAPISignature jsAPISignature = new JsAPISignature(); jsAPISignature.setAppId(wxClient.getClientId()); jsAPISignature.setNonce(nonce); jsAPISignature.setTimestamp(timestamp); jsAPISignature.setSignature(signature); jsAPISignature.setUrl(url); return jsAPISignature; } catch (AesException e) { logger.error("createJsAPISignature failed", e); throw new WxRuntimeException(999, e.getMessage()); } }  static JsAPIs defaultJsAPIs(); static JsAPIs with(AppSetting appSetting); void setWxClient(WxClient wxClient); JsAPISignature createJsAPISignature(String url); WxCardAPISignature createWxCardJsAPISignature(WxCardAPISignature wxCardAPISignature);  }
@Test public void testCreateJsAPISignature(){ JsAPISignature signature = JsAPIs.defaultJsAPIs().createJsAPISignature("http: Assert.assertNotNull(signature); }