Skip to content

Commit

Permalink
Merge branch 'master' into fb_Photography_faker
Browse files Browse the repository at this point in the history
  • Loading branch information
L-Evg authored Nov 9, 2020
2 parents 3884678 + b60f23a commit 1b00a21
Show file tree
Hide file tree
Showing 39 changed files with 1,511 additions and 40 deletions.
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
language: java
dist: trusty
dist: xenial
jdk:
- oraclejdk8
- openjdk7
- openjdk10
- oraclejdk11
sudo: true
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ Fakers
* Aviation
* Basketball
* Beer
* Bojack Horseman
* Book
* Bool
* Business
Expand All @@ -80,6 +81,7 @@ Fakers
* Crypto
* DateAndTime
* Demographic
* Disease
* Dog
* DragonBall
* Dune
Expand All @@ -91,6 +93,7 @@ Fakers
* Friends
* FunnyName
* GameOfThrones
* Gender
* Hacker
* HarryPotter
* Hipster
Expand Down Expand Up @@ -121,8 +124,10 @@ Fakers
* Robin
* RockBand
* Shakespeare
* Sip
* SlackEmoji
* Space
* StarCraft
* StarTrek
* Stock
* Superhero
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.23</version>
<version>1.26</version>
<classifier>android</classifier>
</dependency>
<dependency>
Expand Down
22 changes: 22 additions & 0 deletions src/main/java/com/github/javafaker/Barcode.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.github.javafaker;

public class Barcode {

private Faker faker;

public Barcode(Faker faker) {
this.faker = faker;
}

public String type() {
return faker.resolve("barcode.types");
}

public String data(){
return faker.resolve("barcode.datas");
}

public String typeAndData(){
return faker.resolve("barcode.typeAndData");
}
}
43 changes: 43 additions & 0 deletions src/main/java/com/github/javafaker/BojackHorseman.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
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);
}

}
73 changes: 73 additions & 0 deletions src/main/java/com/github/javafaker/Disease.java
Original file line number Diff line number Diff line change
@@ -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);
}

}
42 changes: 38 additions & 4 deletions src/main/java/com/github/javafaker/Faker.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public class Faker {
private final Finance finance;
private final Food food;
private final GameOfThrones gameOfThrones;
private final Gender gender;
private final DateAndTime dateAndTime;
private final Demographic demographic;
private final Dog dog;
Expand Down Expand Up @@ -98,7 +99,12 @@ public class Faker {
private final ProgrammingLanguage programmingLanguage;
private final Kaamelott kaamelott;
private final Photography photography;
private final StarCraft starCraft;
private final BojackHorseman bojackHorseman;
private final Disease disease;
private final Basketball basketball;
private final Barcode barcode;
private final Sip sip;

public Faker() {
this(Locale.ENGLISH);
Expand Down Expand Up @@ -154,6 +160,7 @@ public Faker(FakeValuesService fakeValuesService, RandomService random) {
this.finance = new Finance(this);
this.food = new Food(this);
this.gameOfThrones = new GameOfThrones(this);
this.gender = new Gender(this);
this.dateAndTime = new DateAndTime(this);
this.demographic = new Demographic(this);
this.dog = new Dog(this);
Expand Down Expand Up @@ -206,7 +213,12 @@ public Faker(FakeValuesService fakeValuesService, RandomService random) {
this.programmingLanguage = new ProgrammingLanguage(this);
this.kaamelott = new Kaamelott(this);
this.photography = new Photography(this);
this.starCraft = new StarCraft(this);
this.bojackHorseman = new BojackHorseman(this);
this.disease = new Disease(this);
this.basketball = new Basketball(this);
this.barcode = new Barcode(this);
this.sip = new Sip(this);
}

/**
Expand Down Expand Up @@ -455,6 +467,10 @@ public GameOfThrones gameOfThrones() {
return gameOfThrones;
}

public Gender gender() {
return gender;
}

public DateAndTime date() {
return dateAndTime;
}
Expand Down Expand Up @@ -605,14 +621,20 @@ public Lebowski lebowski() {
return lebowski;
}

public Medical medical(){return medical;}
public Medical medical() {
return medical;
}

public Country country(){ return country;}
public Country country() {
return country;
}

public Animal animal(){ return animal; }
public Animal animal() {
return animal;
}

public BackToTheFuture backToTheFuture() {
return backToTheFuture;
return backToTheFuture;
}

public PrincessBride princessBride() {
Expand Down Expand Up @@ -647,8 +669,20 @@ public Photography photography() {
return photography;
}

public StarCraft starCraft() {
return starCraft;
}

public BojackHorseman bojackHorseman() { return bojackHorseman; }

public Disease disease() {return disease; }

public Basketball basketball() { return basketball; }

public Barcode barcode() { return barcode; }

public Sip sip() { return sip; }

public String resolve(String key) {
return this.fakeValuesService.resolve(key, this, this);
}
Expand Down
41 changes: 41 additions & 0 deletions src/main/java/com/github/javafaker/Gender.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.github.javafaker;

/**
* This class is used to generate gender randomly.
*
*/

public class Gender {
private final Faker faker;

protected Gender(Faker faker) {
this.faker = faker;
}

/**
* This method returns a gender type
*
* @return a string of gender type
*/
public String types() {
return faker.fakeValuesService().fetchString("gender.types");
}

/**
* This method returns a binary gender type
*
* @return a string of binary gender type
*/
public String binaryTypes() {
return faker.fakeValuesService().fetchString("gender.binary_types");
}

/**
* This method returns a short binary gender type
*
* @return a string of short binary gender type
*/
public String shortBinaryTypes() {
return faker.fakeValuesService().fetchString("gender.short_binary_types");
}
}
Loading

0 comments on commit 1b00a21

Please sign in to comment.