added disease
This commit is contained in:
@@ -81,6 +81,7 @@ Fakers
|
||||
* Crypto
|
||||
* DateAndTime
|
||||
* Demographic
|
||||
* Disease
|
||||
* Dog
|
||||
* DragonBall
|
||||
* Dune
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.github.javafaker;
|
||||
|
||||
/**
|
||||
* Generate random, different kinds of disease.
|
||||
*/
|
||||
public class Disease {
|
||||
private final Faker faker;
|
||||
|
||||
/**
|
||||
* Create a constructor for Disease
|
||||
* @param faker The Faker instance for generating random, different kinds of disease, e.g. the internal disease.
|
||||
*/
|
||||
protected Disease(Faker faker) {
|
||||
this.faker = faker;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate random internal disease
|
||||
* @return An internal disease
|
||||
*/
|
||||
public String internalDisease() {
|
||||
return faker.fakeValuesService().resolve("disease.internal_disease", this, faker);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate random neurology disease
|
||||
* @return A neurology disease
|
||||
*/
|
||||
public String neurology() {
|
||||
return faker.fakeValuesService().resolve("disease.neurology", this, faker);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate random surgery disease
|
||||
* @return A surgery disease
|
||||
*/
|
||||
public String surgery() {
|
||||
return faker.fakeValuesService().resolve("disease.surgery", this, faker);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate random paediattics disease
|
||||
* @return A paediatrics disease
|
||||
*/
|
||||
public String paediatrics() {
|
||||
return faker.fakeValuesService().resolve("disease.paediatrics", this, faker);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate random gynecology and obstetrics disease
|
||||
* @return A gynecology and obstetrics disease
|
||||
*/
|
||||
public String gynecologyAndObstetrics() {
|
||||
return faker.fakeValuesService().resolve("disease.gynecology_and_obstetrics", this, faker);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate random ophthalmology and otorhinolaryngology disease
|
||||
* @return A ophthalmology and otorhinolaryngology disease
|
||||
*/
|
||||
public String ophthalmologyAndOtorhinolaryngology() {
|
||||
return faker.fakeValuesService().resolve("disease.ophthalmology_and_otorhinolaryngology", this, faker);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate random dermatolory disease
|
||||
* @return A dermatolory disease
|
||||
*/
|
||||
public String dermatolory() {
|
||||
return faker.fakeValuesService().resolve("disease.dermatolory", this, faker);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -98,6 +98,7 @@ public class Faker {
|
||||
private final ProgrammingLanguage programmingLanguage;
|
||||
private final Kaamelott kaamelott;
|
||||
private final BojackHorseman bojackHorseman;
|
||||
private final Disease disease;
|
||||
private final Basketball basketball;
|
||||
|
||||
public Faker() {
|
||||
@@ -206,6 +207,7 @@ public class Faker {
|
||||
this.programmingLanguage = new ProgrammingLanguage(this);
|
||||
this.kaamelott = new Kaamelott(this);
|
||||
this.bojackHorseman = new BojackHorseman(this);
|
||||
this.disease = new Disease(this);
|
||||
this.basketball = new Basketball(this);
|
||||
}
|
||||
|
||||
@@ -645,6 +647,8 @@ public class Faker {
|
||||
|
||||
public BojackHorseman bojackHorseman() { return bojackHorseman; }
|
||||
|
||||
public Disease disease() {return disease; }
|
||||
|
||||
public Basketball basketball() { return basketball; }
|
||||
|
||||
public String resolve(String key) {
|
||||
|
||||
@@ -63,6 +63,7 @@ public class EnFile {
|
||||
"demographic.yml",
|
||||
"dessert.yml",
|
||||
"device.yml",
|
||||
"disease.yml",
|
||||
"dota.yml",
|
||||
"dr_who.yml",
|
||||
"dragon_ball.yml",
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
en:
|
||||
faker:
|
||||
disease:
|
||||
internal_disease: ['Acidosis', 'Adams-Stokes syndrome', 'alcoholism', 'alkalosis', 'anaphylaxis', 'anemia', 'iron deficiency anemia', 'megaloblastic anemia', 'aplastic anemia', 'angiitis', 'angina pectoris', 'arteriosclerosis', 'apoplexy', 'auricular fibrillation', 'auriculo-ventricular block', 'bronchial asthma', 'bronchitis', 'bronchiectasis', 'bronchopneumonia', 'carcinoma', 'cardiac arrhythmia', 'cardiac failure', 'cardiomyopathy', 'cirrhosis', 'coronary arteriosclerotic heart disease', 'Crohn disease', "Cushing's syndrome", 'diabetes', 'diffuse intravascular coagulation', 'dysentery', 'enteritis', 'gastric ulcer', 'gastritis', 'gout', 'hepatitis', "Hodgkin's disease", 'hyperlipemia', 'hyperparathyroidism', 'hypersplenism', 'hypertension', 'hyperthyroidism', 'hypoglycemia', 'hypothyroidism', 'infective endocarditis', 'influenza', 'leukemia', 'lobar pneumonia', 'lymphadenitis', 'lymphoma', 'malaria', 'malnutrition', 'measles', 'myeloma', 'myocardial infarction', 'myocarditis', 'nephritis', 'nephritic syndrome', 'obstructive pulmonary emphysema', 'pancreatitis', 'peptic ulcer', 'peritonitis', 'pleuritis', 'pneumonia', 'pneumothorax', 'purpura', 'allergic purpura', 'thrombocytolytic purpura', 'pyelonephritis', 'renal failure', 'rheumatic fever', 'rheumatoid arthritis', 'scarlet fever', 'septicemia', 'syphilis', 'tachycardia', 'tumour', 'typhoid', 'ulcerative colitis']
|
||||
neurology: ['brain abscess', 'cerebral embolism', 'cerebral infarction', 'cerebral thrombosis', 'cerebral hemorrhage', 'concussion of brain', 'craniocerebral injury', 'epilepsy', 'intracranial tumour', 'intracranial hematoma', 'meningitis', 'migraine', 'neurasthenia', 'neurosis', 'paranoid psychosis', "Parkinson's disease", 'psychosis']
|
||||
surgery: ['abdominal external hernia', 'acute diffuse peritonitis', 'acute mastitis', 'acute pancreatitis', 'acute perforation of gastro-duodenal', 'acute pyelonephritis', 'anal fissure', 'anal fistula', 'anesthesia', 'angioma', 'appendicitis', 'bleeding of gastro-duodenal ulcer', 'bone tumour', 'breast adenoma', 'burn', 'cancer of breast', 'carbuncle', 'carcinoma of colon', 'carcinoma of esophagus', 'carcinoma of gallbladder', 'carcinoma of rectum', 'carcinoma of stomach', 'cholecystitis', 'cervical spondylosis', 'choledochitis', 'cholelithiasis', 'chondroma', 'dislocation of joint', 'erysipelas', 'fracture', 'furuncle', 'hemorrhoid', 'hemothorax', 'hypertrophy of prostate', 'intestinal obstruction', 'intestinal tuberculosis', 'lipoma', 'lithangiuria', 'liver abscess', 'melanoma', 'osseous tuberculosis', 'osteoclastoma', 'osteoporosis', 'osteosarcoma', 'osteosarcoma', "Paget's disease", 'perianorecrtal abscess', 'phlegmon', 'portal hypertension', 'prostatitis', 'protrusion of intervertebral disc', 'purulent arthritis', 'pyogenic ostcomyclitis', 'pyothorax', 'rectal polyp', 'rheumatoid arthritis', 'rupture of spleen', 'scapulohumeral periarthritis', 'tenosynovitis', 'tetanus', 'thromboangiitis', 'thyroid adenocarcinoma', 'thyroid adenoma', 'trauma', 'urinary infection', 'varicose vein of lower limb']
|
||||
paediatrics: ['acute military tuberculosis of the lung', 'acute necrotic enteritis', 'anaphylactic purpura', 'ancylostomiasis', 'ascariasis', 'asphyxia of the newborn', 'atrial septal defect', 'birth injury', 'cephalhematoma', 'cerebral palsy', 'congenital torticollis', 'convulsion', "Down's syndrome", 'glomerulonephritis', 'hemophilia', 'infantile diarrhea', 'intracranial hemorrhage of the newborn', 'intussusception', 'necrotic enterocolitis of newborn', 'neonatal jaundice', 'nutritional iron deficiency anemia', 'nutritional megaloblastic anemia', 'patent ductus arteriosis', 'poliomyelitis', 'premature infant', 'primary tuberculosis', 'progressive muscular dystrophy', 'pulmonary stenosis', 'purulent meningitis', 'rickets', 'sepsis of the newborn', 'tetanus of the newborn', 'tetralogy of Fallot', 'thrush', 'varicella', 'ventricular septal defect', 'viral encephalitis', 'viral myocarditis']
|
||||
gynecology_and_obstetrics: ['abortion', 'adenomyosis', 'amniotic fluid embolism', 'Bartholins cyst', 'carcinoma of cervix', 'carcinoma of endometrium', 'carcinoma of ovary', 'cervicitis', 'chorio-epithelioma', 'corpora luteum cyst', 'dystocia', 'eclampsia', 'edema-proteinuria-hypertension', 'endometriosis', 'extrauterine pregnancy', 'hydatidiform mole', 'hyperemesis gravidarum', 'infertility', 'irregular menstruation', 'lochia', 'monilial vaginitis', 'multiple pregnancy', 'myoma of uterus', 'oligohydramnios', 'ovarian tumour', 'pelvic inflammatory disease', 'placenta previa', 'placental abruption', 'pregnancy-hypertension syndrome', 'premature birth', 'premature rupture of membrane', 'postpartum hemorrhage', 'puerperal infection', 'rupture of uterus', 'trichomonas vaginitis', 'uteroplacental apoplexy', 'vulvitis']
|
||||
ophthalmology_and_otorhinolaryngology: ['amblyopia', 'tonsillitis', 'astigmatism', 'carcinoma of nasphyarynx', 'carcinoma of larynx', 'cataract', 'tinnitus', 'chalazion', 'colour blindness', 'deflection of nasal septum', 'deafness', 'furuncle of nasalvestibule', 'glaucoma', 'heterotropia', 'hyperopia', 'injury of cornea', 'ceruminal impaction', 'iritis', 'keratitis', 'labyrinthitis', 'laryngitis', 'mastoiditis', 'myopia', 'nasal sinusitis', 'otitis media', 'obstruction of larynx', 'peritonsillar abscess', 'pharyngitis', 'rhinitis']
|
||||
dermatolory: ['acne', 'carcinoma of skin', 'bed sore', 'decubitus ulcer', 'drug eruption', 'eczema', 'herpes simplex', 'herpes zoster', 'lupus erythematosis', 'psoriasis', 'urticaria']
|
||||
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
package com.github.javafaker;
|
||||
|
||||
import com.github.javafaker.repeating.Repeat;
|
||||
import org.junit.Test;
|
||||
|
||||
import static com.github.javafaker.matchers.IsStringWithContents.isStringWithContents;
|
||||
import static com.github.javafaker.matchers.MatchesRegularExpression.matchesRegularExpression;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class DiseaseTest extends AbstractFakerTest {
|
||||
@Test
|
||||
public void testInternalDisease() {
|
||||
Faker faker = new Faker();
|
||||
assertThat(faker.disease().internalDisease(), matchesRegularExpression("[\\p{L}'()\\., 0-9-’’]+"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNeurology() {
|
||||
Faker faker = new Faker();
|
||||
assertThat(faker.disease().neurology(), matchesRegularExpression("[\\p{L}'()\\., 0-9-’’]+"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSurgery() {
|
||||
Faker faker = new Faker();
|
||||
assertThat(faker.disease().surgery(), matchesRegularExpression("[\\p{L}'()\\., 0-9-’’]+"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPaediatrics() {
|
||||
Faker faker = new Faker();
|
||||
assertThat(faker.disease().paediatrics(), matchesRegularExpression("[\\p{L}'()\\., 0-9-’’]+"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGynecologyAndObstetrics() {
|
||||
Faker faker = new Faker();
|
||||
assertThat(faker.disease().gynecologyAndObstetrics(), matchesRegularExpression("[\\p{L}'()\\., 0-9-’’]+"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOphthalmologyAndOtorhinolaryngology() {
|
||||
Faker faker = new Faker();
|
||||
assertThat(faker.disease().ophthalmologyAndOtorhinolaryngology(), matchesRegularExpression("[\\p{L}'()\\., 0-9-’’]+"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDermatolory() {
|
||||
Faker faker = new Faker();
|
||||
assertThat(faker.disease().dermatolory(), matchesRegularExpression("[\\p{L}'()\\., 0-9-’’]+"));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testInternalDiseaseWith10000Times() {
|
||||
Faker faker = new Faker();
|
||||
boolean isExist = false;
|
||||
for (int i = 0; i < 10000; i++) {
|
||||
String generateString = faker.disease().internalDisease();
|
||||
if (generateString.equals("anaphylaxis")) {
|
||||
isExist = true;
|
||||
}
|
||||
}
|
||||
assertTrue(isExist);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Repeat(times = 10000)
|
||||
public void testNeurologyWith10000Times() {
|
||||
Faker faker = new Faker();
|
||||
assertThat(faker.disease().neurology(), isStringWithContents());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Repeat(times = 10000)
|
||||
public void testSurgeryWith10000Times() {
|
||||
Faker faker = new Faker();
|
||||
assertThat(faker.disease().surgery(), isStringWithContents());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Repeat(times = 10000)
|
||||
public void testPaediatricsWith10000Times() {
|
||||
Faker faker = new Faker();
|
||||
assertThat(faker.disease().paediatrics(), isStringWithContents());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Repeat(times = 10000)
|
||||
public void testGynecologyAndObstetricsWith10000Times() {
|
||||
Faker faker = new Faker();
|
||||
assertThat(faker.disease().gynecologyAndObstetrics(), isStringWithContents());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Repeat(times = 10000)
|
||||
public void testOphthalmologyAndOtorhinolaryngologyWith10000Times() {
|
||||
Faker faker = new Faker();
|
||||
assertThat(faker.disease().ophthalmologyAndOtorhinolaryngology(), isStringWithContents());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Repeat(times = 10000)
|
||||
public void testDermatoloryWith10000Times() {
|
||||
Faker faker = new Faker();
|
||||
assertThat(faker.disease().dermatolory(), isStringWithContents());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -164,6 +164,7 @@ public class FakerIT {
|
||||
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.programmingLanguage());
|
||||
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.kaamelott());
|
||||
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.bojackHorseman());
|
||||
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.disease());
|
||||
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.basketball());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user