Skip to content

Commit f295ec2

Browse files
kingsleylongorende
authored andcommitted
Set the locale in the tests so that they won't fail in non-US locales.
1 parent 8be1b5c commit f295ec2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/test/java/se/citerus/dddsample/interfaces/tracking/ws/CargoTrackingRestServiceIntegrationTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package se.citerus.dddsample.interfaces.tracking.ws;
22

3+
import org.junit.jupiter.api.BeforeAll;
34
import org.junit.jupiter.api.Test;
45
import org.junit.jupiter.api.extension.ExtendWith;
56
import org.springframework.boot.test.context.SpringBootTest;
@@ -16,6 +17,7 @@
1617

1718
import java.net.URI;
1819
import java.nio.charset.StandardCharsets;
20+
import java.util.Locale;
1921

2022
import static org.assertj.core.api.Assertions.assertThat;
2123
import static org.assertj.core.api.Assertions.fail;
@@ -29,6 +31,13 @@ public class CargoTrackingRestServiceIntegrationTest {
2931

3032
private final RestTemplate restTemplate = new RestTemplate();
3133

34+
@BeforeAll
35+
static void beforeClass() {
36+
// The expected date time values in the resonse are formatted in US locale.
37+
// Set the locale in the tests so that they won't fail in non-US locales such as Europe.
38+
Locale.setDefault(Locale.US);
39+
}
40+
3241
@Transactional
3342
@Test
3443
void shouldReturn200ResponseAndJsonWhenRequestingCargoWithIdABC123() throws Exception {

0 commit comments

Comments
 (0)