|
27 | 27 | public class BigDecimalByteStringEncoderTest { |
28 | 28 | @Test |
29 | 29 | public void testEncodeBigDecimalandEncodeByteString() { |
30 | | - BigDecimal testBD = BigDecimal.valueOf(0); // expected result bd |
| 30 | + BigDecimal testBD = new BigDecimal("0"); // expected result bd |
31 | 31 | ByteString testBS = |
32 | 32 | BigDecimalByteStringEncoder.encodeToNumericByteString(testBD); // convert expected to bs |
33 | 33 | BigDecimal resultBD = |
34 | | - BigDecimalByteStringEncoder.decodeToBigDecimal(testBS); // convert bs to bd |
| 34 | + BigDecimalByteStringEncoder.decodeNumericByteString(testBS); // convert bs to bd |
35 | 35 | Assert.assertEquals( |
36 | 36 | 0, resultBD.compareTo(testBD)); // ensure converted bd is equal to expected bd |
37 | 37 |
|
38 | | - testBD = BigDecimal.valueOf(1.2); |
| 38 | + testBD = new BigDecimal("1.2"); |
39 | 39 | testBS = BigDecimalByteStringEncoder.encodeToNumericByteString(testBD); |
40 | | - resultBD = BigDecimalByteStringEncoder.decodeToBigDecimal(testBS); |
| 40 | + resultBD = BigDecimalByteStringEncoder.decodeNumericByteString(testBS); |
41 | 41 | Assert.assertEquals( |
42 | 42 | 0, resultBD.compareTo(testBD)); // ensure converted bd is equal to expected bd |
43 | 43 |
|
44 | | - testBD = BigDecimal.valueOf(-1.2); |
| 44 | + testBD = new BigDecimal("-1.2"); |
45 | 45 | testBS = BigDecimalByteStringEncoder.encodeToNumericByteString(testBD); |
46 | | - resultBD = BigDecimalByteStringEncoder.decodeToBigDecimal(testBS); |
| 46 | + resultBD = BigDecimalByteStringEncoder.decodeNumericByteString(testBS); |
47 | 47 | Assert.assertEquals( |
48 | 48 | 0, resultBD.compareTo(testBD)); // ensure converted bd is equal to expected bd |
49 | 49 |
|
50 | | - testBD = |
51 | | - BigDecimal.valueOf( |
52 | | - 578960446186580977117854925043439539266.34992332820282019728792003956564819967); |
| 50 | + testBD = new BigDecimal("99999999999999999999999999999.999999999"); |
53 | 51 | testBS = BigDecimalByteStringEncoder.encodeToNumericByteString(testBD); |
54 | | - resultBD = BigDecimalByteStringEncoder.decodeToBigDecimal(testBS); |
| 52 | + resultBD = BigDecimalByteStringEncoder.decodeNumericByteString(testBS); |
55 | 53 | Assert.assertEquals( |
56 | 54 | 0, resultBD.compareTo(testBD)); // ensure converted bd is equal to expected bd |
57 | 55 |
|
58 | | - testBD = |
59 | | - BigDecimal.valueOf( |
60 | | - -578960446186580977117854925043439539266.34992332820282019728792003956564819967); |
| 56 | + testBD = new BigDecimal("-99999999999999999999999999999.999999999"); |
61 | 57 | testBS = BigDecimalByteStringEncoder.encodeToNumericByteString(testBD); |
62 | | - resultBD = BigDecimalByteStringEncoder.decodeToBigDecimal(testBS); |
| 58 | + resultBD = BigDecimalByteStringEncoder.decodeNumericByteString(testBS); |
63 | 59 | Assert.assertEquals( |
64 | 60 | 0, resultBD.compareTo(testBD)); // ensure converted bd is equal to expected bd |
65 | 61 | } |
|
0 commit comments