|
5 | 5 | import static org.junit.jupiter.api.Assertions.assertTrue; |
6 | 6 |
|
7 | 7 | import java.nio.file.Path; |
| 8 | +import java.util.Locale; |
8 | 9 | import java.util.Optional; |
9 | 10 | import org.junit.jupiter.api.Test; |
10 | 11 | import org.junit.jupiter.api.io.TempDir; |
@@ -60,6 +61,25 @@ void testExtractBoundsFromValidGeoParquet() { |
60 | 61 | assertTrue(minY < maxY, "Min Y should be less than Max Y"); |
61 | 62 | } |
62 | 63 |
|
| 64 | + @Test |
| 65 | + void testExtractBoundsUsesRootLocale() { |
| 66 | + // A locale with a comma decimal separator must not corrupt the comma-separated bounds string. |
| 67 | + Path testFile = Path.of("src", "test", "resources", "test-bounds.parquet"); |
| 68 | + Locale previous = Locale.getDefault(); |
| 69 | + try { |
| 70 | + Locale.setDefault(Locale.GERMANY); |
| 71 | + |
| 72 | + Optional<String> boundsOpt = Basemap.extractBoundsFromGeoParquet(testFile); |
| 73 | + |
| 74 | + assertTrue(boundsOpt.isPresent(), "Should extract bounds from valid GeoParquet file"); |
| 75 | + String boundsStr = boundsOpt.get(); |
| 76 | + assertEquals(4, boundsStr.split(",").length, "Bounds string should have 4 comma-separated values"); |
| 77 | + assertEquals(-122.4241767, Double.parseDouble(boundsStr.split(",")[0]), 0.0001, "Min X should match"); |
| 78 | + } finally { |
| 79 | + Locale.setDefault(previous); |
| 80 | + } |
| 81 | + } |
| 82 | + |
63 | 83 | @Test |
64 | 84 | void testExtractBoundsFromNonExistentFile() { |
65 | 85 | // Test that a non-existent file returns empty |
|
0 commit comments