-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1410 from gvrettos/feature/measurement-el_GR
Add greek translations for Measurement provider & other Greek tests
- Loading branch information
Showing
6 changed files
with
187 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 35 additions & 4 deletions
39
src/test/java/net/datafaker/providers/base/AncientTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> { | ||
|
||
private static 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") | ||
); | ||
} | ||
|
||
@Override | ||
protected Collection<TestSpec> providerListTest() { | ||
Ancient ancient = faker.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")); | ||
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); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 36 additions & 5 deletions
41
src/test/java/net/datafaker/providers/base/MeasurementTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,53 @@ | ||
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 MeasurementTest extends BaseFakerTest<BaseFaker> { | ||
|
||
public static final String WORDS = "^[a-z ]+$"; | ||
|
||
@Override | ||
protected Collection<TestSpec> providerListTest() { | ||
Measurement measurement = faker.measurement(); | ||
return List.of(TestSpec.of(measurement::height, "measurement.height"), | ||
private static Collection<TestSpec> getProviderListTests(Measurement measurement) { | ||
return List.of( | ||
TestSpec.of(measurement::height, "measurement.height"), | ||
TestSpec.of(measurement::length, "measurement.length"), | ||
TestSpec.of(measurement::volume, "measurement.volume"), | ||
TestSpec.of(measurement::weight, "measurement.weight"), | ||
TestSpec.of(measurement::metricLength, "measurement.metric_length"), | ||
TestSpec.of(measurement::metricHeight, "measurement.metric_height"), | ||
TestSpec.of(measurement::metricVolume, "measurement.metric_volume"), | ||
TestSpec.of(measurement::metricWeight, "measurement.metric_weight")); | ||
TestSpec.of(measurement::metricWeight, "measurement.metric_weight") | ||
); | ||
} | ||
|
||
@Override | ||
protected Collection<TestSpec> providerListTest() { | ||
Measurement measurement = faker.measurement(); | ||
return getProviderListTests(measurement); | ||
} | ||
|
||
@Nested | ||
class MeasurementInGreekTest 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() { | ||
Measurement measurement = faker.measurement(); | ||
return getProviderListTests(measurement); | ||
} | ||
} | ||
} |