Skip to content

Commit

Permalink
Merge pull request #1026 from hardikSinghBehl/feature/joke
Browse files Browse the repository at this point in the history
  • Loading branch information
kingthorin authored Nov 24, 2023
2 parents f8d403d + 363fea0 commit fa227e0
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ The list below is not complete and shows only a part of available providers. To
* Industry Segments
* Internet
* Job
* Joke
* K-pop (Korean popular music)
* Kaamelott
* Language Code
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ default HowIMetYourMother howIMetYourMother() {
default HowToTrainYourDragon howToTrainYourDragon() {
return getProvider(HowToTrainYourDragon.class, HowToTrainYourDragon::new);
}

default Joke joke() {
return getProvider(Joke.class, Joke::new);
}

default Kaamelott kaamelott() {
return getProvider(Kaamelott.class, Kaamelott::new);
Expand Down
19 changes: 19 additions & 0 deletions src/main/java/net/datafaker/providers/entertainment/Joke.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package net.datafaker.providers.entertainment;

import net.datafaker.providers.base.AbstractProvider;

public class Joke extends AbstractProvider<EntertainmentProviders> {

protected Joke(final EntertainmentProviders faker) {
super(faker);
}

public String pun() {
return resolve("joke.puns");
}

public String knockKnock() {
return resolve("joke.knock_knocks");
}

}
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 @@ -147,6 +147,7 @@ public String getPath() {
"industry_segments.yml",
"internet.yml",
"job.yml",
"joke.yml",
"kpop.yml",
"lebowski.yml",
"lord_of_the_rings.yml",
Expand Down
40 changes: 40 additions & 0 deletions src/main/resources/en/joke.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
en:
faker:
joke:
puns:
- "I'm reading a book on anti-gravity. It's impossible to put down!"
- "I told my friend 10 jokes to make him laugh. Sadly, no pun in ten did."
- "I used to be a baker because I kneaded dough."
- "I told my wife she was drawing her eyebrows too high. She looked surprised."
- "I told my computer I needed a break, and now it won't stop sending me vacation ads."
- "The scarecrow won an award because he was outstanding in his field."
- "The magician got so mad, he pulled his hare out."
- "Apparently you cannot use ‘beefstew’ as password, because It’s not stroganoff"
- "I told my mom she should embrace her mistakes. She gave me a hug."
- "My wife asked me to put ketchup on the shopping list that I was making and now, I can’t read anything."
- "I don't appreciate people who take drugs, like those airport security folks."
- "With great power comes a huge electric bill."
- "My three favorite things are eating my family and not using commas."
- "Justice is a dish best served cold, if it were served warm, it would be justwater."
- "My wife has a weird habit of starting conversations by saying 'Are you even listening to me?'"
- "If you take the 'P' out of a Pirate, he becomes very angry."
- "I was shocked when I found out my toaster wasn’t waterproof."
- "I once had a psychic girlfriend, she left me before we met."
- "I'm always frank on dates. I don't want them knowing my real name."
- "When you tickle a man to death by accident, it is manslaughter."
- "Talking to people about the benefits of dried grapes is all about raisin awareness."
- "Say what you want about waitresses but they bring a lot to the table."
- "Mike Tyson is such a religious guy, he punches people in the faith."
- "Mike Tyson is such a moral philosopher. To stay in shape, he spends a lot of time ethicizing."
- "My email password was hacked again and that's the third time I had to rename the dog."
- "Shout out to the people wondering what the opposite of in is."
knock_knocks:
- "Knock, knock. Who's there? Alpaca. Alpaca who? Alpaca the suitcase, you load up the car!"
- "Knock, knock. Who's there? Atch. Atch who? Bless you!"
- "Knock, knock. Who's there? Boo. Boo who? Aw, don't cry, it's just a joke!"
- "Knock, knock. Who's there? Lettuce. Lettuce who? Lettuce in, it's freezing out here!"
- "Knock, knock. Who's there? Cow says. Cow says who? No silly, cow says moo!"
- "Knock, knock. Who's there? Alzheimer. Alzheimer who? Knock knock"
- "Knock, knock. Who's there? A week. A week who? Yeah, we cool"
- "Knock, knock. Race Condition. Who's there?"
- "Who’s there? Dejav. Dejav who? Knock, knock."
18 changes: 18 additions & 0 deletions src/test/java/net/datafaker/providers/entertainment/JokeTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package net.datafaker.providers.entertainment;

import java.util.Collection;
import java.util.List;

class JokeTest extends EntertainmentFakerTest {

private final Joke joke = getFaker().joke();

@Override
protected Collection<TestSpec> providerListTest() {
return List.of(
TestSpec.of(joke::pun, "joke.puns"),
TestSpec.of(joke::knockKnock, "joke.knock_knocks")
);
}

}

0 comments on commit fa227e0

Please sign in to comment.