mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix json bug
This commit is contained in:
21
hutool-json/src/test/java/Issue2365Test.java
Normal file
21
hutool-json/src/test/java/Issue2365Test.java
Normal file
@@ -0,0 +1,21 @@
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import lombok.Data;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
public class Issue2365Test {
|
||||
|
||||
@Test
|
||||
public void toBeanTest(){
|
||||
String jsonStr = "{\"fileName\":\"aaa\",\"fileBytes\":\"AQ==\"}";
|
||||
final FileInfo fileInfo = JSONUtil.toBean(jsonStr, FileInfo.class);
|
||||
Assert.assertEquals("aaa", fileInfo.getFileName());
|
||||
Assert.assertArrayEquals(new byte[]{1}, fileInfo.getFileBytes());
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class FileInfo {
|
||||
private String fileName;
|
||||
private byte[] fileBytes;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user