-
Notifications
You must be signed in to change notification settings - Fork 495
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix : none-public nested class fieldBased not work, for issue #751
- Loading branch information
Showing
2 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
core/src/test/java/com/alibaba/fastjson2/issues/Issue751.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.alibaba.fastjson2.issues; | ||
|
||
import com.alibaba.fastjson2.JSONB; | ||
import com.alibaba.fastjson2.JSONReader; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.io.Serializable; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
public class Issue751 { | ||
@Test | ||
public void test() { | ||
byte[] bytes = JSONB.toBytes(new Data()); | ||
Object o = JSONB.parseObject(bytes, Data.class, JSONReader.Feature.FieldBased); | ||
assertEquals(Data.class, o.getClass()); | ||
} | ||
|
||
static class Data | ||
implements Serializable { | ||
private String mData = ""; | ||
|
||
public Data() { | ||
} | ||
|
||
public String getData() { | ||
return mData; | ||
} | ||
|
||
public void setData(String data) { | ||
mData = data; | ||
} | ||
} | ||
} |