Skip to content

Commit ae72627

Browse files
committed
Added Big Bang Theory Faker
1 parent 1302fa3 commit ae72627

File tree

7 files changed

+53
-0
lines changed

7 files changed

+53
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ Providers
168168
* Basketball
169169
* Battlefield1
170170
* Beer
171+
* Big Bang Theory
171172
* Blood Type
172173
* Bojack Horseman
173174
* Book
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package net.datafaker;
2+
3+
public class BigBangTheory {
4+
5+
private final Faker faker;
6+
7+
protected BigBangTheory(Faker faker) {
8+
this.faker = faker;
9+
}
10+
11+
/**
12+
* This method generates a random Big Bang Theory's character's name.
13+
*
14+
* @return a string of Big Bang Theory's character's name.
15+
*/
16+
public String character() {
17+
return faker.fakeValuesService().resolve("big_bang_theory.characters", this, faker);
18+
}
19+
20+
/**
21+
* This method generates a random Big Bang Theory's character's quote.
22+
*
23+
* @return a string of Big Bang Theory's character's quote.
24+
*/
25+
public String quote() {
26+
return faker.fakeValuesService().resolve("big_bang_theory.quotes", this, faker);
27+
}
28+
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,10 @@ public Beer beer() {
352352
return getProvider(Beer.class, () -> new Beer(this));
353353
}
354354

355+
public BigBangTheory bigBangTheory() {
356+
return getProvider(BigBangTheory.class, () -> new BigBangTheory(this));
357+
}
358+
355359
public BloodType bloodtype(){return getProvider(BloodType.class, () -> new BloodType(this));}
356360

357361
public BojackHorseman bojackHorseman() {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public String getPath() {
4646
"basketball.yml",
4747
"battlefield1.yml",
4848
"beer.yml",
49+
"big_bang_theory.yml",
4950
"blood_type.yml",
5051
"bojack_horseman.yml",
5152
"book.yml",
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package net.datafaker;
2+
3+
import org.junit.jupiter.api.RepeatedTest;
4+
5+
import static org.assertj.core.api.Assertions.assertThat;
6+
7+
class BigBangTheoryTest extends AbstractFakerTest {
8+
9+
@RepeatedTest(50)
10+
void testCharacter() {
11+
assertThat(faker.bigBangTheory().character()).matches("^[A-Z][a-zA-Z .]+$");
12+
}
13+
14+
@RepeatedTest(50)
15+
void testQuote() {
16+
assertThat(faker.bigBangTheory().quote()).matches("^[A-Z][a-zA-Z .’'!,?]+$");
17+
}
18+
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ void testAllFakerMethodsThatReturnStrings(Locale locale, Random random) throws E
9191
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.basketball());
9292
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.battlefield1());
9393
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.beer());
94+
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.bigBangTheory());
9495
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.bloodtype());
9596
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.bojackHorseman());
9697
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.book());

0 commit comments

Comments
 (0)