Skip to content

Commit 35537f2

Browse files
authored
Merge pull request #203 from panilya/master
Add Simpsons Faker
2 parents 07a0df7 + 72b3c96 commit 35537f2

File tree

7 files changed

+52
-1
lines changed

7 files changed

+52
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ Providers
277277
* Shakespeare
278278
* Sip
279279
* Size
280+
* Simpsons
280281
* SlackEmoji
281282
* SoulKnight
282283
* Space

src/main/java/net/datafaker/Faker.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -802,6 +802,10 @@ public Size size() {
802802
return getProvider(Size.class, () -> new Size(this));
803803
}
804804

805+
public Simpsons simpsons() {
806+
return getProvider(Simpsons.class, () -> new Simpsons(this));
807+
}
808+
805809
public SoulKnight soulKnight() {
806810
return getProvider(SoulKnight.class, () -> new SoulKnight(this));
807811
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package net.datafaker;
2+
3+
public class Simpsons {
4+
5+
private final Faker faker;
6+
7+
public Simpsons(Faker faker) {
8+
this.faker = faker;
9+
}
10+
11+
public String character() {
12+
return faker.resolve("simpsons.characters");
13+
}
14+
15+
public String location() {
16+
return faker.resolve("simpsons.locations");
17+
}
18+
19+
public String quote() {
20+
return faker.resolve("simpsons.quotes");
21+
}
22+
}

src/main/java/net/datafaker/service/files/EnFile.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ public String getPath() {
172172
"seinfeld.yml",
173173
"shakespeare.yml",
174174
// "silicon_valley.yml",
175-
// "simpsons.yml",
175+
"simpsons.yml",
176176
// "singular_siegler.yml",
177177
"sip.yml",
178178
"size.yml",
File renamed without changes.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package net.datafaker;
2+
3+
import org.junit.jupiter.api.Test;
4+
5+
import static org.assertj.core.api.Assertions.assertThat;
6+
7+
public class SimpsonsTest extends AbstractFakerTest {
8+
9+
@Test
10+
void character() {
11+
assertThat(faker.simpsons().character()).isNotEmpty();
12+
}
13+
14+
@Test
15+
void location() {
16+
assertThat(faker.simpsons().location()).isNotEmpty();
17+
}
18+
19+
@Test
20+
void quote() {
21+
assertThat(faker.simpsons().quote()).isNotEmpty();
22+
}
23+
}

src/test/java/net/datafaker/integration/FakerIT.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ void testAllFakerMethodsThatReturnStrings(Locale locale, Random random) throws E
175175
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.seinfeld());
176176
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.shakespeare());
177177
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.slackEmoji());
178+
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.simpsons());
178179
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.space());
179180
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.starCraft());
180181
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.starTrek());

0 commit comments

Comments
 (0)