-
Notifications
You must be signed in to change notification settings - Fork 506
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
fix dump jsonb decimal
Showing
2 changed files
with
52 additions
and
8 deletions.
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
20 changes: 20 additions & 0 deletions
20
core/src/test/java/com/alibaba/fastjson2/issues_2900/Issue2954.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,20 @@ | ||
package com.alibaba.fastjson2.issues_2900; | ||
|
||
import com.alibaba.fastjson2.JSONB; | ||
import com.alibaba.fastjson2.JSONReader; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.math.BigDecimal; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
public class Issue2954 { | ||
@Test | ||
public void testB() { | ||
BigDecimal value = new BigDecimal("20.0"); | ||
byte[] bytes = JSONB.toBytes(value); | ||
JSONReader jsonReader = JSONReader.ofJSONB(bytes); | ||
assertEquals(value, jsonReader.readBigDecimal()); | ||
assertEquals(value.toPlainString(), JSONB.toJSONString(bytes)); | ||
} | ||
} |