File tree Expand file tree Collapse file tree 6 files changed +86
-0
lines changed
test/java/net/datafaker/providers/foods Expand file tree Collapse file tree 6 files changed +86
-0
lines changed Original file line number Diff line number Diff line change @@ -267,6 +267,7 @@ The list below is not complete and shows only a part of available providers. To
267267* Ancient
268268* Animal
269269* App
270+ * Apple
270271* Appliance
271272* Aqua Teen Hunger Force
272273* Artist
Original file line number Diff line number Diff line change 1+ package net .datafaker .providers .food ;
2+
3+ import net .datafaker .providers .base .AbstractProvider ;
4+ import net .datafaker .providers .base .BaseProviders ;
5+
6+ /**
7+ * @since 2.5.3
8+ */
9+ public class Apple extends AbstractProvider <BaseProviders > {
10+
11+ protected Apple (BaseProviders faker ) {
12+ super (faker );
13+ }
14+
15+ public String type () {
16+ return resolve ("apple.type" );
17+ }
18+
19+ public String color () {
20+ return resolve ("apple.color" );
21+ }
22+
23+ }
Original file line number Diff line number Diff line change 33import net .datafaker .providers .base .ProviderRegistration ;
44
55public interface FoodProviders extends ProviderRegistration {
6+ default Apple apple () {
7+ return getProvider (Apple .class , Apple ::new );
8+ }
9+
610 default Beer beer () {
711 return getProvider (Beer .class , Beer ::new );
812 }
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ public String getPath() {
3030 "ancient.yml" ,
3131 "animal.yml" ,
3232 "app.yml" ,
33+ "apple.yml" ,
3334 "appliance.yml" ,
3435 "aqua_teen_hunger_force.yml" ,
3536 "artist.yml" ,
Original file line number Diff line number Diff line change 1+ en :
2+ faker :
3+ apple :
4+ type :
5+ - " Red Delicious"
6+ - " Fuji"
7+ - " Gala"
8+ - " Empire"
9+ - " Jonagold"
10+ - " Cortland"
11+ - " Granny Smith"
12+ - " Pippin"
13+ - " Crispin"
14+ - " Golden Delicious"
15+ - " Opal"
16+ - " Ginger Gold"
17+ - " Honeycrisp"
18+ - " Jazz"
19+ - " Ambrosia"
20+ - " Braeburn"
21+ - " Ashmead’s Kernel"
22+ - " Roxbury Russet"
23+ - " Spitzenburg"
24+ - " Baldwin"
25+ - " Pink Lady (Cripps Pink)"
26+ - " Lady Alice"
27+ - " Sweetango"
28+ - " Bramley"
29+ - " Rhode Island Greening"
30+ color :
31+ - " Red"
32+ - " Green"
33+ - " Yellow / Golden"
34+ - " Red + Green"
35+ - " Red + Yellow / Golden"
36+ - " Pink / Rosy shades"
37+ - " Striped / Blushed patterns"
38+ - " Russeted / Brownish"
Original file line number Diff line number Diff line change 1+ package net .datafaker .providers .foods ;
2+
3+ import net .datafaker .providers .food .Apple ;
4+
5+ import java .util .Collection ;
6+ import java .util .List ;
7+
8+ public class AppleTest extends FoodFakerTest {
9+
10+ private final Apple apple = getFaker ().apple ();
11+
12+ @ Override
13+ protected Collection <TestSpec > providerListTest () {
14+ return List .of (
15+ TestSpec .of (apple ::type , "apple.type" ),
16+ TestSpec .of (apple ::color , "apple.color" )
17+ );
18+ }
19+ }
You can’t perform that action at this time.
0 commit comments