-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #170 from Tahanima/feature/add-verb-faker
Added Verb Faker
- Loading branch information
Showing
7 changed files
with
95 additions
and
1 deletion.
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 |
---|---|---|
|
@@ -260,6 260,7 @@ Providers | |
* University | ||
* Vehicle | ||
* Verb | ||
* Weather | ||
* Witcher | ||
* Yoda | ||
|
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
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,55 @@ | ||
package net.datafaker; | ||
|
||
public class Verb { | ||
|
||
private final Faker faker; | ||
|
||
protected Verb(Faker faker) { | ||
this.faker = faker; | ||
} | ||
|
||
/** | ||
* This method generates the base form of a random verb. | ||
* | ||
* @return a string of base form of a verb. | ||
*/ | ||
public String base() { | ||
return faker.fakeValuesService().resolve("verbs.base", this, faker); | ||
} | ||
|
||
/** | ||
* This method generates a random verb in past tense. | ||
* | ||
* @return a string of verb in past tense. | ||
*/ | ||
public String past() { | ||
return faker.fakeValuesService().resolve("verbs.past", this, faker); | ||
} | ||
|
||
/** | ||
* This method generates a random verb in past participle tense. | ||
* | ||
* @return a string of verb in past participle tense. | ||
*/ | ||
public String pastParticiple() { | ||
return faker.fakeValuesService().resolve("verbs.past_participle", this, faker); | ||
} | ||
|
||
/** | ||
* This method generates a random verb in simple present tense. | ||
* | ||
* @return a string of verb in simple present tense. | ||
*/ | ||
public String simplePresent() { | ||
return faker.fakeValuesService().resolve("verbs.simple_present", this, faker); | ||
} | ||
|
||
/** | ||
* This method generates a random verb in -ing form. | ||
* | ||
* @return a string of verb in -ing form. | ||
*/ | ||
public String ingForm() { | ||
return faker.fakeValuesService().resolve("verbs.ing_form", 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
File renamed without changes.
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,33 @@ | ||
package net.datafaker; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
class VerbTest extends AbstractFakerTest { | ||
|
||
@Test | ||
void testBase() { | ||
assertThat(faker.verb().base()).matches("\\w "); | ||
} | ||
|
||
@Test | ||
void testPast() { | ||
assertThat(faker.verb().past()).matches("\\w "); | ||
} | ||
|
||
@Test | ||
void testPastParticiple() { | ||
assertThat(faker.verb().pastParticiple()).matches("\\w "); | ||
} | ||
|
||
@Test | ||
void testSimplePresent() { | ||
assertThat(faker.verb().simplePresent()).matches("\\w "); | ||
} | ||
|
||
@Test | ||
void testIngForm() { | ||
assertThat(faker.verb().ingForm()).matches("\\w "); | ||
} | ||
} |
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