Make Spring Boot tests locale independent

Fixes gh-405
This commit is contained in:
Sebastien Deleuze
2014-02-26 16:23:48 +01:00
committed by Dave Syer
parent 42f363dc12
commit e9ead99e9c
2 changed files with 7 additions and 1 deletions

View File

@@ -69,7 +69,7 @@ public final class DetailedProgressReporterTests {
this.session.getTransferListener().transferSucceeded(completedEvent);
assertTrue(new String(this.baos.toByteArray()).matches(String.format(
"Downloaded: %s%s \\(4KB at [0-9]+\\.[0-9]KB/sec\\)\\n", REPOSITORY,
"Downloaded: %s%s \\(4KB at [0-9]+(\\.|,)[0-9]KB/sec\\)\\n", REPOSITORY,
ARTIFACT)));
}
}

View File

@@ -17,6 +17,7 @@
package org.springframework.boot.logging.java;
import java.io.IOException;
import java.util.Locale;
import org.apache.commons.logging.impl.Jdk14Logger;
import org.junit.After;
@@ -47,8 +48,12 @@ public class JavaLoggerSystemTests {
private Jdk14Logger logger;
private Locale defaultLocale;
@Before
public void init() throws SecurityException, IOException {
defaultLocale = Locale.getDefault();
Locale.setDefault(Locale.ENGLISH);
this.logger = new Jdk14Logger(getClass().getName());
}
@@ -57,6 +62,7 @@ public class JavaLoggerSystemTests {
System.clearProperty("LOG_FILE");
System.clearProperty("LOG_PATH");
System.clearProperty("PID");
Locale.setDefault(defaultLocale);
}
@Test