11package net .datafaker .providers .base ;
22
3+ import org .junit .jupiter .api .AfterAll ;
4+ import org .junit .jupiter .api .BeforeAll ;
5+ import org .junit .jupiter .api .Nested ;
6+
37import java .util .List ;
48import java .util .Collection ;
9+ import java .util .Locale ;
510
611class MeasurementTest extends BaseFakerTest <BaseFaker > {
712
@@ -10,13 +15,39 @@ class MeasurementTest extends BaseFakerTest<BaseFaker> {
1015 @ Override
1116 protected Collection <TestSpec > providerListTest () {
1217 Measurement measurement = faker .measurement ();
13- return List .of (TestSpec .of (measurement ::height , "measurement.height" ),
18+ return getProviderListTests (measurement );
19+ }
20+
21+ @ Nested
22+ class MeasurementInGreekTest extends BaseFakerTest <BaseFaker > {
23+
24+ @ BeforeAll
25+ void setup () {
26+ this .setFaker (new BaseFaker (new Locale ("el" , "GR" )));
27+ }
28+
29+ @ AfterAll
30+ void reset () {
31+ this .setFaker (this .getFaker ());
32+ }
33+
34+ @ Override
35+ protected Collection <TestSpec > providerListTest () {
36+ Measurement measurement = faker .measurement ();
37+ return getProviderListTests (measurement );
38+ }
39+ }
40+
41+ private Collection <TestSpec > getProviderListTests (Measurement measurement ) {
42+ return List .of (
43+ TestSpec .of (measurement ::height , "measurement.height" ),
1444 TestSpec .of (measurement ::length , "measurement.length" ),
1545 TestSpec .of (measurement ::volume , "measurement.volume" ),
1646 TestSpec .of (measurement ::weight , "measurement.weight" ),
1747 TestSpec .of (measurement ::metricLength , "measurement.metric_length" ),
1848 TestSpec .of (measurement ::metricHeight , "measurement.metric_height" ),
1949 TestSpec .of (measurement ::metricVolume , "measurement.metric_volume" ),
20- TestSpec .of (measurement ::metricWeight , "measurement.metric_weight" ));
50+ TestSpec .of (measurement ::metricWeight , "measurement.metric_weight" )
51+ );
2152 }
2253}
0 commit comments