### Question:
EthereumSign { public static String sign(String data, byte[] prvKeyBytes) { return signMessage(dataToBytes(data), prvKeyBytes).toString(); }  static String personalSign(String data, byte[] prvKeyBytes); static String sign(String data, byte[] prvKeyBytes); static BigInteger ecRecover(String data, String signature); static String recoverAddress(String data, String signature); static SignatureData signAsRecoverable(byte[] value, ECKey ecKey);  }### Answer:
@Test public void testECSign() { String signature = EthereumSign.sign("imToken", privateKey); Assert.assertEquals(signature, expectedSignature); }
@Test public void testLongTextECSignShouldReturnNormalSignature() { StringBuilder longTextBuilder = new StringBuilder(); for (int i = 0; i < 100; i++) { longTextBuilder.append("imToken "); } String expectedSignature = "c72572b15a69e00ce8aa7193d74c2aab4ef926aded55ac3dda975cc43e114b645e3e9b36cc9316ca5a77854d5ee69de5ce5f978158f511d2fced57e000aba1771b"; String signature = EthereumSign.sign(longTextBuilder.toString(), privateKey); Assert.assertEquals(signature, expectedSignature); }
@Test public void testShortTextECSignShouldReturnNormalSignature() { String shortText = "i"; String signature = EthereumSign.sign(shortText, privateKey); String expectedSignature = "b650888994cf54feafe3d8c26e235631fc4d300f0da79db822c1a6158d64393f1dd2c9ac2d62f41019204354357fd87bf68d614911c39d0d3dd6d05c0196ecb51b"; Assert.assertEquals(signature, expectedSignature); }