File tree Expand file tree Collapse file tree 1 file changed +17
-4
lines changed
extensions/finances/sources/api/src/test/java/tools/dynamia/modules/finances/api Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change 44import org .junit .jupiter .api .Test ;
55
66import java .math .BigDecimal ;
7+ import java .util .Locale ;
78
89import static org .junit .jupiter .api .Assertions .*;
910
@@ -236,10 +237,22 @@ void testGetCurrencyForLocale() {
236237 @ Test
237238 @ DisplayName ("Should get current currency" )
238239 void testGetCurrentCurrency () {
239- String currency = Money .getCurrentCurrency ();
240-
241- assertNotNull (currency );
242- assertFalse (currency .isEmpty ());
240+ // Save the current default locale
241+ Locale originalLocale = java .util .Locale .getDefault ();
242+
243+ try {
244+ // Set a locale with a valid country code for testing
245+ java .util .Locale .setDefault (java .util .Locale .US );
246+
247+ String currency = Money .getCurrentCurrency ();
248+
249+ assertNotNull (currency );
250+ assertFalse (currency .isEmpty ());
251+ assertEquals ("USD" , currency );
252+ } finally {
253+ // Restore the original locale
254+ java .util .Locale .setDefault (originalLocale );
255+ }
243256 }
244257
245258 @ Test
You can’t perform that action at this time.
0 commit comments