Browse Source

Make Spring Boot tests locale independent

Fixes gh-405
pull/408/merge
Sebastien Deleuze 12 years ago committed by Dave Syer
parent
commit
e9ead99e9c
  1. 2
      spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/grape/DetailedProgressReporterTests.java
  2. 6
      spring-boot/src/test/java/org/springframework/boot/logging/java/JavaLoggerSystemTests.java

2
spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/grape/DetailedProgressReporterTests.java

@ -69,7 +69,7 @@ public final class DetailedProgressReporterTests { @@ -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)));
}
}

6
spring-boot/src/test/java/org/springframework/boot/logging/java/JavaLoggerSystemTests.java

@ -17,6 +17,7 @@ @@ -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 { @@ -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 { @@ -57,6 +62,7 @@ public class JavaLoggerSystemTests {
System.clearProperty("LOG_FILE");
System.clearProperty("LOG_PATH");
System.clearProperty("PID");
Locale.setDefault(defaultLocale);
}
@Test

Loading…
Cancel
Save