mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
add test
This commit is contained in:
parent
999c1d80d4
commit
ddd173a17c
@ -1,6 +1,7 @@
|
||||
package cn.hutool.crypto.test.asymmetric;
|
||||
|
||||
import cn.hutool.core.codec.Base64;
|
||||
import cn.hutool.core.lang.Console;
|
||||
import cn.hutool.core.util.CharsetUtil;
|
||||
import cn.hutool.core.util.HexUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
@ -220,9 +221,12 @@ public class SM2Test {
|
||||
final ECPrivateKeyParameters ecPrivateKeyParameters = ECKeyUtil.toSm2PrivateParams(d);
|
||||
|
||||
final SM2 sm2 = new SM2(ecPrivateKeyParameters, ecPublicKeyParameters);
|
||||
sm2.setMode(SM2Engine.Mode.C1C2C3);
|
||||
final String encryptHex = sm2.encryptHex(data, KeyType.PublicKey);
|
||||
Console.log(encryptHex);
|
||||
final String decryptStr = sm2.decryptStr(encryptHex, KeyType.PrivateKey);
|
||||
|
||||
Assert.assertEquals(data, decryptStr);
|
||||
}
|
||||
|
||||
}
|
||||
|
22
hutool-json/src/test/java/cn/hutool/json/Issue1075Test.java
Normal file
22
hutool-json/src/test/java/cn/hutool/json/Issue1075Test.java
Normal file
@ -0,0 +1,22 @@
|
||||
package cn.hutool.json;
|
||||
|
||||
import lombok.Data;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
public class Issue1075Test {
|
||||
@Test
|
||||
public void test() {
|
||||
String s = "{\"f1\":\"f1\",\"F2\":\"f2\",\"fac\":\"fac\"}";
|
||||
|
||||
ObjA o2 = JSONUtil.parseObj(s, JSONConfig.create().setIgnoreCase(true)).toBean(ObjA.class);
|
||||
Assert.assertEquals("fac", o2.getFAC());
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class ObjA {
|
||||
private String f1;
|
||||
private String F2;
|
||||
private String FAC;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user