|
1 | 1 | /* |
2 | | - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 | 4 | * |
5 | 5 | * This code is free software; you can redistribute it and/or modify it |
|
23 | 23 |
|
24 | 24 | /* |
25 | 25 | * @test |
26 | | - * @bug 4944439 |
| 26 | + * @bug 4944439 8372609 |
27 | 27 | * @summary Confirm that numbers where all digits after the decimal separator are 0 |
28 | 28 | * and which are between Long.MIN_VALUE and Long.MAX_VALUE are returned |
29 | 29 | * as Long(not double). |
30 | 30 | * @run junit Bug4944439 |
31 | 31 | */ |
32 | 32 |
|
33 | | -import java.text.DecimalFormat; |
| 33 | +import java.text.NumberFormat; |
34 | 34 | import java.util.ArrayList; |
35 | 35 | import java.util.Locale; |
36 | 36 | import java.util.stream.Stream; |
37 | 37 |
|
38 | | -import org.junit.jupiter.api.AfterAll; |
39 | | -import org.junit.jupiter.api.BeforeAll; |
40 | 38 | import org.junit.jupiter.params.ParameterizedTest; |
41 | | -import org.junit.jupiter.params.provider.Arguments; |
42 | 39 | import org.junit.jupiter.params.provider.MethodSource; |
43 | 40 |
|
44 | 41 | import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; |
|
47 | 44 |
|
48 | 45 | public class Bug4944439 { |
49 | 46 |
|
50 | | - // Save JVM default locale |
51 | | - private static final Locale savedLocale = Locale.getDefault(); |
52 | | - private static final DecimalFormat df = new DecimalFormat(); |
53 | | - |
54 | | - // Set JVM default locale to US for testing |
55 | | - @BeforeAll |
56 | | - static void initAll() { |
57 | | - Locale.setDefault(Locale.US); |
58 | | - } |
59 | | - |
60 | | - // Restore JVM default locale |
61 | | - @AfterAll |
62 | | - static void tearDownAll() { |
63 | | - Locale.setDefault(savedLocale); |
64 | | - } |
| 47 | + private static final NumberFormat df = NumberFormat.getInstance(Locale.US); |
65 | 48 |
|
66 | 49 | // Check return type and value returned by DecimalFormat.parse() for longs |
67 | 50 | @ParameterizedTest |
|
0 commit comments