Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
113 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,6 +66,7 @@ Fakers | |
* Back To The Future | ||
* Aviation | ||
* Beer | ||
* Bojack Horseman | ||
* Book | ||
* Bool | ||
* Business | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.github.javafaker; | ||
|
||
/** | ||
* Generate random parts in BojackHorseman. | ||
* @author unknown and irakatz | ||
*/ | ||
public class BojackHorseman { | ||
private final Faker faker; | ||
|
||
/** | ||
* Create a constructor for BojackHorseman. | ||
* @param faker The Faker instance for generating random parts in BojackHorseman. | ||
*/ | ||
protected BojackHorseman(Faker faker) { | ||
this.faker = faker; | ||
} | ||
|
||
/** | ||
* Generate random character's name in BojackHorseman. | ||
* @return Characters in BojackHorseman | ||
*/ | ||
public String characters() { | ||
return faker.fakeValuesService().resolve("bojack_horseman.characters", this, faker); | ||
} | ||
|
||
/** | ||
* Generate random quotes in BojackHorseman. | ||
* @return Quotes in BojackHorseman | ||
*/ | ||
public String quotes() { | ||
return faker.fakeValuesService().resolve("bojack_horseman.quotes", this, faker); | ||
} | ||
|
||
/** | ||
* Generate random tongue twisters in BojackHorseman. | ||
* @return Tongue twisters in BojackHorseman | ||
*/ | ||
public String tongueTwisters() { | ||
return faker.fakeValuesService().resolve("bojack_horseman.tongue_twisters", this, faker); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
src/test/java/com/github/javafaker/BojackHorsemanTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package com.github.javafaker; | ||
|
||
import com.github.javafaker.AbstractFakerTest; | ||
import com.github.javafaker.Faker; | ||
import org.junit.Test; | ||
|
||
import static com.github.javafaker.matchers.MatchesRegularExpression.matchesRegularExpression; | ||
import static org.junit.Assert.*; | ||
|
||
public class BojackHorsemanTest extends AbstractFakerTest { | ||
|
||
@Test | ||
public void testCharacters1(){ | ||
Faker faker=new Faker(); | ||
assertThat(faker.bojackHorseman().characters(),matchesRegularExpression("[\\p{L}'()\\., 0-9-’’]+")); } | ||
|
||
@Test | ||
public void testQuotes1(){ | ||
Faker faker=new Faker(); | ||
assertFalse(faker.bojackHorseman().quotes().isEmpty()); } | ||
|
||
@Test | ||
public void testTongueTwisters1(){ | ||
Faker faker=new Faker(); | ||
assertFalse(faker.bojackHorseman().tongueTwisters().isEmpty());} | ||
|
||
@Test | ||
public void testCharactersWith10000Times(){ | ||
Faker faker=new Faker(); | ||
boolean isExist=false; | ||
for(int i=0;i<10000;i++){ | ||
String generateString=faker.bojackHorseman().characters(); | ||
if(generateString.equals("Joseph Sugarman")){isExist=true;} | ||
} | ||
assertTrue(isExist); | ||
} | ||
|
||
@Test | ||
public void testQuotesWith10000Times(){ | ||
Faker faker=new Faker(); | ||
boolean isExist=false; | ||
for(int i=0;i<10000;i++){ | ||
String generateString=faker.bojackHorseman().quotes(); | ||
if(generateString.equals("It gets easier. But you have to do it every day, that's the hard part. But it does get easier")) | ||
{isExist=true;} | ||
} | ||
assertTrue(isExist); | ||
} | ||
|
||
@Test | ||
public void testTongueTwistersWith10000Times(){ | ||
Faker faker=new Faker(); | ||
boolean isExist=false; | ||
for(int i=0;i<10000;i++){ | ||
String generateString=faker.bojackHorseman().tongueTwisters(); | ||
if(generateString.equals("Courtly roles like the formerly portly consort are Courtney Portnoy's forté")) | ||
{isExist=true;} | ||
} | ||
assertTrue(isExist); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters