-
Notifications
You must be signed in to change notification settings - Fork 838
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
7 changed files
with
53 additions
and
0 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 |
---|---|---|
|
@@ -79,6 +79,7 @@ Fakers | |
* Crypto | ||
* DateAndTime | ||
* Demographic | ||
* Disease | ||
* Dog | ||
* DragonBall | ||
* Dune | ||
|
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,22 @@ | ||
package com.github.javafaker; | ||
|
||
|
||
/** | ||
* @author LinZhiyuan bianzheng | ||
* */ | ||
public class Disease{ | ||
private final Faker faker; | ||
|
||
protected Disease(final Faker faker) { | ||
this.faker = faker; | ||
} | ||
/** | ||
* Generate a random type of disease | ||
* @return random type of disease | ||
* */ | ||
public String type(){ | ||
return faker.fakeValuesService().resolve("disease.type",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
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,4 @@ | ||
en: | ||
faker: | ||
disease: | ||
type: ["Acquired disease", "Acute disease", "Chronic condition or chronic disease", "Congenital disorder or congenital disease","Genetic disease", "Hereditary or inherited disease", "Iatrogenic disease", "Idiopathic disease", "Incurable disease", "Primary disease", "Secondary disease", "Terminal disease", "Illness", "Disorder", "Predisease"] |
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,18 @@ | ||
package com.github.javafaker; | ||
|
||
import org.junit.Test; | ||
import static com.github.javafaker.matchers.MatchesRegularExpression.matchesRegularExpression; | ||
import static org.junit.Assert.assertThat; | ||
|
||
/** | ||
* @author LinZhiyuan bianzheng | ||
* the test that generate valid disease types | ||
* */ | ||
public class DiseaseTest extends AbstractFakerTest { | ||
@Test | ||
public void testTypes(){ | ||
assertThat(faker.disease().type(),matchesRegularExpression("[A-Za-z ]+")); | ||
assertThat(faker.disease().type(),matchesRegularExpression("[A-Za-z'() 0-9-]+")); | ||
} | ||
|
||
} |
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