Skip to content

Commit

Permalink
Add tests for Ancient provider for el_GR locale
Browse files Browse the repository at this point in the history
  • Loading branch information
gvrettos committed Oct 27, 2024
1 parent d97f15c commit 8171a5f
Showing 1 changed file with 33 additions and 2 deletions.
35 changes: 33 additions & 2 deletions src/test/java/net/datafaker/providers/base/AncientTest.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,47 @@
package net.datafaker.providers.base;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Nested;

import java.util.List;
import java.util.Collection;
import java.util.Locale;

class AncientTest extends BaseFakerTest<BaseFaker> {

@Override
protected Collection<TestSpec> providerListTest() {
Ancient ancient = faker.ancient();
return List.of(TestSpec.of(ancient::god, "ancient.god"),
return getProviderListTests(ancient);
}

@Nested
class AncientInGreekTest extends BaseFakerTest<BaseFaker> {

@BeforeAll
void setup() {
this.setFaker(new BaseFaker(new Locale("el", "GR")));
}

@AfterAll
void reset() {
this.setFaker(this.getFaker());
}

@Override
protected Collection<TestSpec> providerListTest() {
Ancient ancient = faker.ancient();
return getProviderListTests(ancient);
}
}

private Collection<TestSpec> getProviderListTests(Ancient ancient) {
return List.of(
TestSpec.of(ancient::god, "ancient.god"),
TestSpec.of(ancient::primordial, "ancient.primordial"),
TestSpec.of(ancient::titan, "ancient.titan"),
TestSpec.of(ancient::hero, "ancient.hero"));
TestSpec.of(ancient::hero, "ancient.hero")
);
}
}

0 comments on commit 8171a5f

Please sign in to comment.