Skip to content

Added Big Bang Theory Faker #197

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ Providers
* Basketball
* Battlefield1
* Beer
* Big Bang Theory
* Blood Type
* Bojack Horseman
* Book
Expand Down
28 changes: 28 additions & 0 deletions src/main/java/net/datafaker/BigBangTheory.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package net.datafaker;

public class BigBangTheory {

private final Faker faker;

protected BigBangTheory(Faker faker) {
this.faker = faker;
}

/**
* This method generates a random Big Bang Theory's character's name.
*
* @return a string of Big Bang Theory's character's name.
*/
public String character() {
return faker.fakeValuesService().resolve("big_bang_theory.characters", this, faker);
}

/**
* This method generates a random Big Bang Theory's character's quote.
*
* @return a string of Big Bang Theory's character's quote.
*/
public String quote() {
return faker.fakeValuesService().resolve("big_bang_theory.quotes", this, faker);
}
}
4 changes: 4 additions & 0 deletions src/main/java/net/datafaker/Faker.java
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,10 @@ public Beer beer() {
return getProvider(Beer.class, () -> new Beer(this));
}

public BigBangTheory bigBangTheory() {
return getProvider(BigBangTheory.class, () -> new BigBangTheory(this));
}

public BloodType bloodtype(){return getProvider(BloodType.class, () -> new BloodType(this));}

public BojackHorseman bojackHorseman() {
Expand Down
1 change: 1 addition & 0 deletions src/main/java/net/datafaker/service/files/EnFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public String getPath() {
"basketball.yml",
"battlefield1.yml",
"beer.yml",
"big_bang_theory.yml",
"blood_type.yml",
"bojack_horseman.yml",
"book.yml",
Expand Down
18 changes: 18 additions & 0 deletions src/test/java/net/datafaker/BigBangTheoryTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package net.datafaker;

import org.junit.jupiter.api.RepeatedTest;

import static org.assertj.core.api.Assertions.assertThat;

class BigBangTheoryTest extends AbstractFakerTest {

@RepeatedTest(50)
void testCharacter() {
assertThat(faker.bigBangTheory().character()).matches("^[A-Z][a-zA-Z .]+$");
}

@RepeatedTest(50)
void testQuote() {
assertThat(faker.bigBangTheory().quote()).matches("^[A-Z][a-zA-Z .’'!,?]+$");
}
}
1 change: 1 addition & 0 deletions src/test/java/net/datafaker/integration/FakerIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ void testAllFakerMethodsThatReturnStrings(Locale locale, Random random) throws E
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.basketball());
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.battlefield1());
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.beer());
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.bigBangTheory());
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.bloodtype());
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.bojackHorseman());
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.book());
Expand Down