From 9807e372b36a42c0c92624c64cf423c84eb713a9 Mon Sep 17 00:00:00 2001 From: Stephen Colebourne Date: Mon, 19 Aug 2024 23:22:50 +0100 Subject: [PATCH] Remove deprecations (#141) --- src/test/java/org/joda/money/TestCurrencyUnit.java | 2 +- .../java/org/joda/money/format/TestMoneyAmountStyle.java | 6 +++--- .../java/org/joda/money/format/TestMoneyFormatter.java | 9 ++++----- .../org/joda/money/format/TestMoneyFormatterBuilder.java | 4 ++-- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/test/java/org/joda/money/TestCurrencyUnit.java b/src/test/java/org/joda/money/TestCurrencyUnit.java index 92dcc14..13029d9 100644 --- a/src/test/java/org/joda/money/TestCurrencyUnit.java +++ b/src/test/java/org/joda/money/TestCurrencyUnit.java @@ -415,7 +415,7 @@ void test_factory_of_Locale_nullLocale() { @Test void test_factory_of_Locale_unknownCurrency() { assertThatExceptionOfType(IllegalCurrencyException.class) - .isThrownBy(() -> CurrencyUnit.of(new Locale("en", "XY"))) + .isThrownBy(() -> CurrencyUnit.of(Locale.of("en", "XY"))) .withMessage("No currency found for locale 'en_XY'"); } diff --git a/src/test/java/org/joda/money/format/TestMoneyAmountStyle.java b/src/test/java/org/joda/money/format/TestMoneyAmountStyle.java index 0bfb95b..4a62f2e 100644 --- a/src/test/java/org/joda/money/format/TestMoneyAmountStyle.java +++ b/src/test/java/org/joda/money/format/TestMoneyAmountStyle.java @@ -33,9 +33,9 @@ class TestMoneyAmountStyle { private static final Locale cCachedLocale = Locale.getDefault(); - private static final Locale TEST_GB_LOCALE = new Locale("en", "GB", "TEST"); - private static final Locale TEST_DE_LOCALE = new Locale("de", "DE", "TEST"); - private static final Locale TEST_LV_LOCALE = new Locale("lv", "LV", "TEST"); + private static final Locale TEST_GB_LOCALE = Locale.of("en", "GB", "TEST"); + private static final Locale TEST_DE_LOCALE = Locale.of("de", "DE", "TEST"); + private static final Locale TEST_LV_LOCALE = Locale.of("lv", "LV", "TEST"); private static final BigMoney MONEY = BigMoney.of(CurrencyUnit.GBP, new BigDecimal("87654321.12345678")); @BeforeEach diff --git a/src/test/java/org/joda/money/format/TestMoneyFormatter.java b/src/test/java/org/joda/money/format/TestMoneyFormatter.java index c6f134a..b188d62 100644 --- a/src/test/java/org/joda/money/format/TestMoneyFormatter.java +++ b/src/test/java/org/joda/money/format/TestMoneyFormatter.java @@ -43,8 +43,8 @@ class TestMoneyFormatter { private static final Locale cCachedLocale = Locale.getDefault(); - private static final Locale TEST_GB_LOCALE = new Locale("en", "GB", "TEST"); - private static final Locale TEST_FR_LOCALE = new Locale("fr", "FR", "TEST"); + private static final Locale TEST_GB_LOCALE = Locale.of("en", "GB", "TEST"); + private static final Locale TEST_FR_LOCALE = Locale.of("fr", "FR", "TEST"); private static final Money MONEY_GBP_12_34 = Money.parse("GBP 12.34"); private MoneyFormatter iPrintTest; private MoneyFormatter iCannotPrint; @@ -236,10 +236,9 @@ void test_parseBigMoney_CharSequence_incomplete() { @Test void test_parseBigMoney_CharSequence_incompleteLongText() { + var str = "12.34 GBP ABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAB"; assertThatExceptionOfType(MoneyFormatException.class) - .isThrownBy( - () -> iParseTest - .parseBigMoney("12.34 GBP ABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAB")); + .isThrownBy(() -> iParseTest.parseBigMoney(str)); } @Test diff --git a/src/test/java/org/joda/money/format/TestMoneyFormatterBuilder.java b/src/test/java/org/joda/money/format/TestMoneyFormatterBuilder.java index 4ab44fc..11b10df 100644 --- a/src/test/java/org/joda/money/format/TestMoneyFormatterBuilder.java +++ b/src/test/java/org/joda/money/format/TestMoneyFormatterBuilder.java @@ -51,8 +51,8 @@ class TestMoneyFormatterBuilder { private static final Money JPY_2345 = Money.parse("JPY 2345"); private static final Locale cCachedLocale = Locale.getDefault(); - private static final Locale TEST_GB_LOCALE = new Locale("en", "GB", "TEST"); - private static final Locale TEST_FR_LOCALE = new Locale("fr", "FR", "TEST"); + private static final Locale TEST_GB_LOCALE = Locale.of("en", "GB", "TEST"); + private static final Locale TEST_FR_LOCALE = Locale.of("fr", "FR", "TEST"); private static final DecimalFormatSymbols FR_SYMBOLS = new DecimalFormatSymbols(Locale.FRANCE); private static final char FR_DECIMAL = FR_SYMBOLS.getMonetaryDecimalSeparator(); private static final char FR_GROUP = FR_SYMBOLS.getGroupingSeparator();