|
1 | 1 | package net.datafaker.providers.base; |
2 | 2 |
|
| 3 | +import org.junit.jupiter.api.AfterAll; |
| 4 | +import org.junit.jupiter.api.BeforeAll; |
| 5 | +import org.junit.jupiter.api.Nested; |
| 6 | + |
3 | 7 | import java.util.List; |
4 | 8 | import java.util.Collection; |
| 9 | +import java.util.Locale; |
5 | 10 |
|
6 | 11 | class AncientTest extends BaseFakerTest<BaseFaker> { |
7 | 12 |
|
8 | 13 | @Override |
9 | 14 | protected Collection<TestSpec> providerListTest() { |
10 | 15 | Ancient ancient = faker.ancient(); |
11 | | - return List.of(TestSpec.of(ancient::god, "ancient.god"), |
| 16 | + return getProviderListTests(ancient); |
| 17 | + } |
| 18 | + |
| 19 | + @Nested |
| 20 | + class AncientInGreekTest extends BaseFakerTest<BaseFaker> { |
| 21 | + |
| 22 | + @BeforeAll |
| 23 | + void setup() { |
| 24 | + this.setFaker(new BaseFaker(new Locale("el", "GR"))); |
| 25 | + } |
| 26 | + |
| 27 | + @AfterAll |
| 28 | + void reset() { |
| 29 | + this.setFaker(this.getFaker()); |
| 30 | + } |
| 31 | + |
| 32 | + @Override |
| 33 | + protected Collection<TestSpec> providerListTest() { |
| 34 | + Ancient ancient = faker.ancient(); |
| 35 | + return getProviderListTests(ancient); |
| 36 | + } |
| 37 | + } |
| 38 | + |
| 39 | + private Collection<TestSpec> getProviderListTests(Ancient ancient) { |
| 40 | + return List.of( |
| 41 | + TestSpec.of(ancient::god, "ancient.god"), |
12 | 42 | TestSpec.of(ancient::primordial, "ancient.primordial"), |
13 | 43 | TestSpec.of(ancient::titan, "ancient.titan"), |
14 | | - TestSpec.of(ancient::hero, "ancient.hero")); |
| 44 | + TestSpec.of(ancient::hero, "ancient.hero") |
| 45 | + ); |
15 | 46 | } |
16 | 47 | } |
0 commit comments