postgresql-jdbc.git / summary / log / commit / refs
commit 54885950dd478d5f76326cd8faaffac6270de321
Author: Vladimir Sitnikov <sitnikov.vladimir@gmail.com>
Date: Sun Jan 15 17:31:15 2023 +0000
test: move BigDecimal.TEN.pow(131072) to a separate test to avoid test with too long name
.../util/BigDecimalByteConverter2Test.java | 23 ++++++++++++++++++++++
.../util/BigDecimalByteConverterTest.java | 5 ++++-
2 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/pgjdbc/src/test/java/org/postgresql/util/BigDecimalByteConverter2Test.java b/pgjdbc/src/test/java/org/postgresql/util/BigDecimalByteConverter2Test.java
new file mode 100644
index 00000000..5861446d
--- /dev/null
+++ b/pgjdbc/src/test/java/org/postgresql/util/BigDecimalByteConverter2Test.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2023, PostgreSQL Global Development Group
+ * See the LICENSE file in the project root for more information.
+ */
+
+package org.postgresql.util;
+
+import org.junit.Test;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+
+/**
+ * This test is moved from {@link BigDecimalByteConverterTest} to prevent test with very long name.
+ */
+public class BigDecimalByteConverter2Test {
+ @Test
+ public void testBigDecimal10_pow_131072_minus_1() {
+ BigDecimalByteConverterTest.testBinary(
+ new BigDecimal(BigInteger.TEN.pow(131072).subtract(BigInteger.ONE))
+ );
+ }
+}
diff --git a/pgjdbc/src/test/java/org/postgresql/util/BigDecimalByteConverterTest.java b/pgjdbc/src/test/java/org/postgresql/util/BigDecimalByteConverterTest.java
index a1381ab2..decdb507 100644
--- a/pgjdbc/src/test/java/org/postgresql/util/BigDecimalByteConverterTest.java
+++ b/pgjdbc/src/test/java/org/postgresql/util/BigDecimalByteConverterTest.java
@@ -75,12 +75,15 @@ public class BigDecimalByteConverterTest {
numbers.add(new Object[] {new BigDecimal("1000000").setScale(31)});
numbers.add(new Object[] {new BigDecimal("10000000000000000000000000000000000000").setScale(14)});
numbers.add(new Object[] {new BigDecimal("90000000000000000000000000000000000000")});
- numbers.add(new Object[] {new BigDecimal(BigInteger.TEN.pow(131072).subtract(BigInteger.ONE))});
return numbers;
}
@Test
public void testBinary() {
+ testBinary(number);
+ }
+
+ static void testBinary(BigDecimal number) {
final byte[] bytes = ByteConverter.numeric(number);
final BigDecimal actual = (BigDecimal) ByteConverter.numeric(bytes);
if (number.scale() >= 0) {
[parent: 59cbcb35dd6a]