Skip to content

Commit

Permalink
[MNG-8454] Force the FileSizeFormat UT to US Locale (#2003)
Browse files Browse the repository at this point in the history
As it uses now String.format that produces different
decimal separator based on local, most notable DE

---

https://issues.apache.org/jira/browse/MNG-8454
  • Loading branch information
cstamas authored Dec 20, 2024
1 parent 5f19dae commit 575ad37
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,33 @@
*/
package org.apache.maven.cling.transfer;

import java.util.Locale;

import org.apache.maven.api.services.MessageBuilder;
import org.apache.maven.cling.transfer.FileSizeFormat.ScaleUnit;
import org.apache.maven.internal.impl.DefaultMessageBuilder;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;

class FileSizeFormatTest {
// Locale like DE uses "," and not "."
// For simplicity’s sake let test in US
static Locale original;

@BeforeAll
static void beforeAll() {
original = Locale.getDefault();
Locale.setDefault(Locale.US);
}

@AfterAll
static void afterAll() {
Locale.setDefault(original);
}

@Test
void testNegativeSize() {
Expand Down

0 comments on commit 575ad37

Please sign in to comment.