mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
add method and test
This commit is contained in:
26
hutool-json/src/test/java/cn/hutool/json/Issue867Test.java
Normal file
26
hutool-json/src/test/java/cn/hutool/json/Issue867Test.java
Normal file
@@ -0,0 +1,26 @@
|
||||
package cn.hutool.json;
|
||||
|
||||
import cn.hutool.core.annotation.Alias;
|
||||
import lombok.Data;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
public class Issue867Test {
|
||||
|
||||
@Test
|
||||
public void toBeanTest(){
|
||||
String json = "{\"abc_1d\":\"123\",\"abc_d\":\"456\",\"abc_de\":\"789\"}";
|
||||
Test02 bean = JSONUtil.toBean(JSONUtil.parseObj(json),Test02.class);
|
||||
Assert.assertEquals("123", bean.getAbc1d());
|
||||
Assert.assertEquals("456", bean.getAbcD());
|
||||
Assert.assertEquals("789", bean.getAbcDe());
|
||||
}
|
||||
|
||||
@Data
|
||||
static class Test02 {
|
||||
@Alias("abc_1d")
|
||||
private String abc1d;
|
||||
private String abcD;
|
||||
private String abcDe;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user