|
4 | 4 | import io.cucumber.core.runtime.TimeServiceEventBus;
|
5 | 5 | import io.cucumber.plugin.event.SnippetsSuggestedEvent;
|
6 | 6 | import io.cucumber.plugin.event.TestRunFinished;
|
| 7 | +import org.junit.jupiter.api.AfterEach; |
7 | 8 | import org.junit.jupiter.api.BeforeEach;
|
8 | 9 | import org.junit.jupiter.api.Test;
|
9 | 10 |
|
10 | 11 | import java.io.ByteArrayOutputStream;
|
11 | 12 | import java.net.URI;
|
12 | 13 | import java.time.Clock;
|
13 | 14 | import java.time.ZoneId;
|
| 15 | +import java.util.Locale; |
14 | 16 | import java.util.UUID;
|
15 | 17 |
|
16 | 18 | import static java.nio.charset.StandardCharsets.UTF_8;
|
|
22 | 24 | class DefaultSummaryPrinterTest {
|
23 | 25 |
|
24 | 26 | private final ByteArrayOutputStream out = new ByteArrayOutputStream();
|
25 |
| - private final DefaultSummaryPrinter summaryPrinter = new DefaultSummaryPrinter(out); |
| 27 | + private DefaultSummaryPrinter summaryPrinter; |
26 | 28 | private final EventBus bus = new TimeServiceEventBus(
|
27 |
| - Clock.fixed(ofEpochSecond(0), ZoneId.of("UTC")), |
28 |
| - UUID::randomUUID); |
| 29 | + Clock.fixed(ofEpochSecond(0), ZoneId.of("UTC")), |
| 30 | + UUID::randomUUID); |
| 31 | + private Locale originalLocale; |
29 | 32 |
|
30 | 33 | @BeforeEach
|
31 | 34 | void setup() {
|
| 35 | + originalLocale = Locale.getDefault(); |
| 36 | + Locale.setDefault(Locale.ENGLISH); |
| 37 | + summaryPrinter = new DefaultSummaryPrinter(out); |
32 | 38 | summaryPrinter.setEventPublisher(bus);
|
33 | 39 | }
|
34 | 40 |
|
| 41 | + @AfterEach |
| 42 | + void teardown() { |
| 43 | + Locale.setDefault(originalLocale); |
| 44 | + } |
| 45 | + |
35 | 46 | @Test
|
36 | 47 | void does_not_print_duplicate_snippets() {
|
37 | 48 | bus.send(new SnippetsSuggestedEvent(
|
|
0 commit comments