Signatures { public Signature createJsSignature(String prepayId) { String pack = "prepay_id=" + prepayId; long timestamp = System.currentTimeMillis() / 1000; String nonce = RandomStringGenerator.getRandomStringByLength(16); String appId = paySetting.getAppId(); String key = paySetting.getKey(); String sortString = String.format("appId=%s&nonceStr=%s&package=%s&signType=MD5&timeStamp=%s", appId, nonce, pack, timestamp); return createSignature(pack, timestamp, nonce, appId, key, sortString); }  void setPaySetting(PaySetting paySetting); static Signatures defaultSignatures(); static Signatures with(PaySetting paySetting); Signature createAppSignature(String prepayId); Signature createJsSignature(String prepayId);  }
@Test public void testCreateJsSignature(){ Signature signature = Signatures.defaultSignatures().createJsSignature("1234567890"); Assert.assertNotNull(signature); }