Skip to content

Commit b531118

Browse files
marko-bekhtagavinking
authored andcommitted
Adjust big decimal assertions
1 parent d789df2 commit b531118

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

  • tck/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/id

tck/spec-tests/src/main/java/ee/jakarta/tck/persistence/core/annotations/id/Client.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@
1919
import java.lang.System.Logger;
2020
import java.math.BigDecimal;
2121
import java.math.BigInteger;
22+
import java.math.RoundingMode;
2223

2324
import org.jboss.shrinkwrap.api.spec.JavaArchive;
2425
import org.junit.jupiter.api.AfterEach;
26+
import org.junit.jupiter.api.Assertions;
2527
import org.junit.jupiter.api.BeforeEach;
2628
import org.junit.jupiter.api.Test;
2729

@@ -215,7 +217,7 @@ public void FieldBigDecimalIdTest() throws Exception {
215217

216218
try {
217219
getEntityTransaction().begin();
218-
final BigDecimal id = new BigDecimal(new BigInteger("1"));
220+
final BigDecimal id = new BigDecimal(new BigInteger("1")).setScale(2, RoundingMode.UP);
219221

220222
FieldBigDecimalId expected = new FieldBigDecimalId(id, id);
221223

@@ -227,7 +229,7 @@ public void FieldBigDecimalIdTest() throws Exception {
227229
getEntityTransaction().begin();
228230
FieldBigDecimalId actual = getEntityManager().find(FieldBigDecimalId.class, id);
229231
if (actual != null) {
230-
if (actual.getBigDecimal().equals(id)) {
232+
if (actual.getBigDecimal().setScale(2, RoundingMode.UP).equals(id)) {
231233
logger.log(Logger.Level.TRACE, "Received expected result:" + actual.getBigDecimal());
232234
pass = true;
233235
} else {
@@ -544,7 +546,7 @@ public void PropertyBigDecimalIdTest() throws Exception {
544546

545547
try {
546548
getEntityTransaction().begin();
547-
final BigDecimal id = new BigDecimal(new BigInteger("1"));
549+
final BigDecimal id = new BigDecimal(new BigInteger("1")).setScale(2, RoundingMode.UP);
548550

549551
PropertyBigDecimalId expected = new PropertyBigDecimalId(id, id);
550552

@@ -556,7 +558,7 @@ public void PropertyBigDecimalIdTest() throws Exception {
556558
getEntityTransaction().begin();
557559
PropertyBigDecimalId actual = getEntityManager().find(PropertyBigDecimalId.class, id);
558560
if (actual != null) {
559-
if (actual.getBigDecimal().equals(id)) {
561+
if (actual.getBigDecimal().setScale(2, RoundingMode.UP).equals(id)) {
560562
logger.log(Logger.Level.TRACE, "Received expected result:" + actual.getBigDecimal());
561563
pass = true;
562564
} else {

0 commit comments

Comments
 (0)