Skip to content

Commit

Permalink
Set the locale in the tests so that they won't fail in non-US locales.
Browse files Browse the repository at this point in the history
  • Loading branch information
kingsleylong authored and orende committed Apr 2, 2024
1 parent 8be1b5c commit f295ec2
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package se.citerus.dddsample.interfaces.tracking.ws;

import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.boot.test.context.SpringBootTest;
Expand All @@ -16,6 +17,7 @@

import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.util.Locale;

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

private final RestTemplate restTemplate = new RestTemplate();

@BeforeAll
static void beforeClass() {
// The expected date time values in the resonse are formatted in US locale.
// Set the locale in the tests so that they won't fail in non-US locales such as Europe.
Locale.setDefault(Locale.US);
}

@Transactional
@Test
void shouldReturn200ResponseAndJsonWhenRequestingCargoWithIdABC123() throws Exception {
Expand Down

0 comments on commit f295ec2

Please sign in to comment.