[Bug 60422] Tidy up test case

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1799722 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2017-06-24 00:15:20 +00:00
parent 66b39c70ad
commit c1cc93a2ef

View File

@ -858,18 +858,16 @@ public class TestDataFormatter {
*/ */
@Test @Test
public void testBug60422() { public void testBug60422() {
Locale defaultLocale = Locale.getDefault();
Locale.setDefault(Locale.GERMANY);
LocaleUtil.setUserLocale(Locale.ROOT); LocaleUtil.setUserLocale(Locale.ROOT);
try { try {
char euro = '\u20AC'; char euro = '\u20AC';
DataFormatter df = new DataFormatter(); DataFormatter df = new DataFormatter(Locale.GERMANY);
String formatString = String.format( String formatString = String.format(
"_-* #,##0.00\\ \"%s\"_-;\\-* #,##0.00\\ \"%s\"_-;_-* \"-\"??\\ \"%s\"_-;_-@_-", "_-* #,##0.00\\ \"%s\"_-;\\-* #,##0.00\\ \"%s\"_-;_-* \"-\"??\\ \"%s\"_-;_-@_-",
euro, euro, euro); euro, euro, euro);
assertEquals("4.33 " + euro, df.formatRawCellContents(4.33, 178, formatString)); assertEquals("4.33 " + euro, df.formatRawCellContents(4.33, 178, formatString));
} finally { } finally {
Locale.setDefault(defaultLocale); LocaleUtil.resetUserLocale();
} }
} }
} }