Fix locale not being applied for StackFormatterTest (#5216)

Failed tests before the commit:

```
Failed tests: 
  StackFormatterTest.quantityToRSDecimalStackSize:49 expected:<21[.]7K> but was:<21[,]7K>
  StackFormatterTest.quantityToStackSize:84 expected:<1[,]000> but was:<1[.]000>
  StackFormatterTest.stackSizeToQuantity:107 expected:<10500> but was:<10>
```

After the commit, the tests succeeded.
This commit is contained in:
CC007
2018-09-02 09:54:15 +02:00
committed by Tomas Slusny
parent 0a3fbf2cf5
commit 9506c672a0

View File

@@ -25,8 +25,10 @@
package net.runelite.client.util;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.NumberFormat;
import java.text.ParseException;
import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -49,12 +51,15 @@ public class StackFormatter
/**
* A number formatter
*/
private static final NumberFormat NUMBER_FORMATTER = NumberFormat.getInstance();
private static final NumberFormat NUMBER_FORMATTER = NumberFormat.getInstance(Locale.ENGLISH);
/**
* A decimal number formatter
*/
private static final NumberFormat DECIMAL_FORMATTER = new DecimalFormat("#,###.#");
private static final NumberFormat DECIMAL_FORMATTER = new DecimalFormat(
"#,###.#",
DecimalFormatSymbols.getInstance(Locale.ENGLISH)
);
/**
* Convert a quantity to a nicely formatted stack size.