From d12ceefac5d632b57f1672e068f2b093631d6d9b Mon Sep 17 00:00:00 2001 From: YuCheng Hu Date: Mon, 6 Jun 2022 11:45:45 -0400 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=A1=B9=E7=9B=AE=E7=9A=84?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../foramt/NumberFormatExceptionTest.java | 23 ++++++++++++++----- pom.xml | 4 ++-- testing-modules/pom.xml | 2 +- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/core-java-modules/core-java-numbers/src/test/java/com/ossez/number/foramt/NumberFormatExceptionTest.java b/core-java-modules/core-java-numbers/src/test/java/com/ossez/number/foramt/NumberFormatExceptionTest.java index 9f9207647a..8c50e792df 100644 --- a/core-java-modules/core-java-numbers/src/test/java/com/ossez/number/foramt/NumberFormatExceptionTest.java +++ b/core-java-modules/core-java-numbers/src/test/java/com/ossez/number/foramt/NumberFormatExceptionTest.java @@ -8,9 +8,14 @@ import org.junit.jupiter.api.TestInstance; import java.util.Arrays; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +/** + * String format to number with NumberFormatException + * + * @author YuCheng + */ @TestInstance(TestInstance.Lifecycle.PER_METHOD) public class NumberFormatExceptionTest { @@ -20,16 +25,22 @@ public class NumberFormatExceptionTest { @Test public void ConstructorNumberFormatException() { - Exception exception = assertThrows(NumberFormatException.class, () -> { + +// Exception exception = assertThrows(NumberFormatException.class, () -> { +// new Integer("one"); +// }); + + assertThatThrownBy(() -> { new Integer("one"); - }); + }).isInstanceOf(NumberFormatException.class).hasMessageStartingWith("For input string"); - System.out.println(exception); +// System.out.println(exception); - Integer aIntegerObj = new Integer("one"); + Integer aIntegerObj = new Integer("1"); + +// Integer aIntegerObj = new Integer("one"); Double doubleDecimalObj = new Double("two.2"); } - } diff --git a/pom.xml b/pom.xml index f0e6683677..8513b38609 100644 --- a/pom.xml +++ b/pom.xml @@ -43,7 +43,7 @@ - + testing-modules toolkits @@ -97,7 +97,7 @@ 3.12.4 2.2 1.3 - 3.17.2 + 3.23.1 1.33 1.33 diff --git a/testing-modules/pom.xml b/testing-modules/pom.xml index 46ca3394fe..469be80d97 100644 --- a/testing-modules/pom.xml +++ b/testing-modules/pom.xml @@ -15,7 +15,7 @@ - + assertion-libraries