Skip to content

Commit

Permalink
feat: add unit test for alibaba#2558
Browse files Browse the repository at this point in the history
  • Loading branch information
ocean23 committed May 11, 2024
1 parent 1f3112e commit 9c883c5
Showing 1 changed file with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.alibaba.fastjson2.issues_2500;

import com.alibaba.fastjson2.util.TypeUtils;
import org.bson.types.Decimal128;
import org.junit.jupiter.api.Test;

import java.math.BigDecimal;

import static org.junit.jupiter.api.Assertions.assertEquals;

public class Issue2558 {
@Test
public void test() {
BigDecimal decimal = new BigDecimal("123.45");
Decimal128 decimal128 = new Decimal128(decimal);
Double doubleValue = decimal.doubleValue();

assertEquals(
doubleValue,
TypeUtils.cast(decimal128, Double.class)
);
}
}

0 comments on commit 9c883c5

Please # to comment.