|
|
|
@ -2239,6 +2239,7 @@ class MappingMongoConverterUnitTests { |
|
|
|
static Stream<Arguments> representations() { |
|
|
|
static Stream<Arguments> representations() { |
|
|
|
|
|
|
|
|
|
|
|
return Stream.of(Arguments.argumentSet("None (default)", new Object[] { null }), //
|
|
|
|
return Stream.of(Arguments.argumentSet("None (default)", new Object[] { null }), //
|
|
|
|
|
|
|
|
Arguments.argumentSet("UNSPECIFIED", BigDecimalRepresentation.UNSPECIFIED), //
|
|
|
|
Arguments.argumentSet("STRING", BigDecimalRepresentation.STRING), //
|
|
|
|
Arguments.argumentSet("STRING", BigDecimalRepresentation.STRING), //
|
|
|
|
Arguments.argumentSet("DECIMAL128", BigDecimalRepresentation.DECIMAL128)); |
|
|
|
Arguments.argumentSet("DECIMAL128", BigDecimalRepresentation.DECIMAL128)); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -2260,6 +2261,23 @@ class MappingMongoConverterUnitTests { |
|
|
|
assertThat(target.get("bigDecimal")).isEqualTo(source.bigDecimal); |
|
|
|
assertThat(target.get("bigDecimal")).isEqualTo(source.bigDecimal); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test // GH-5037, GH-5054
|
|
|
|
|
|
|
|
void shouldWriteBigNumbersAsIsWhenUsingUnspecified() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
converter = createConverter(BigDecimalRepresentation.UNSPECIFIED); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WithoutExplicitTargetTypes source = new WithoutExplicitTargetTypes(); |
|
|
|
|
|
|
|
source.bigInteger = BigInteger.TWO; |
|
|
|
|
|
|
|
source.bigDecimal = new BigDecimal("123.456"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
org.bson.Document target = new org.bson.Document(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
converter.write(source, target); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assertThat(target.get("bigInteger")).isEqualTo(source.bigInteger); |
|
|
|
|
|
|
|
assertThat(target.get("bigDecimal")).isEqualTo(source.bigDecimal); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test // GH-5037
|
|
|
|
@Test // GH-5037
|
|
|
|
void shouldReadTypedBigNumbersFromDecimal128() { |
|
|
|
void shouldReadTypedBigNumbersFromDecimal128() { |
|
|
|
|
|
|
|
|
|
|
|
|