Compare commits

..

2 Commits

Author SHA1 Message Date
Ricky Yim 0147cc7925 Merge pull request #442 from mindworks-software/updated_resource_files
Fix postcode property name
2020-07-06 18:18:14 +10:00
Dario Matonicki 84359c41c8 Fix postcode property name 2019-09-26 12:28:20 +02:00
19 changed files with 5 additions and 371 deletions
-2
View File
@@ -6,5 +6,3 @@ target
*.iml
.java-version
/dependency-reduced-pom.xml
META-INF/
bin/
+2 -8
View File
@@ -17,7 +17,7 @@ In pom.xml, add the following xml stanza between `<dependencies> ... </dependenc
<dependency>
<groupId>com.github.javafaker</groupId>
<artifactId>javafaker</artifactId>
<version>1.0.0</version>
<version>0.18</version>
</dependency>
```
@@ -25,7 +25,7 @@ For gradle users, add the following to your build.gradle file.
```groovy
dependencies {
implementation 'com.github.javafaker:javafaker:1.0.0'
implementation 'com.github.javafaker:javafaker:0.18'
}
```
@@ -42,8 +42,6 @@ String lastName = faker.name().lastName(); // Barton
String streetAddress = faker.address().streetAddress(); // 60018 Sawayn Brooks Suite 449
```
This is a [demo web application](https://java-faker.herokuapp.com/) that uses the library.
Javadoc
-----
http://dius.github.io/java-faker/apidocs/index.html
@@ -57,12 +55,10 @@ See [CONTRIBUTING.md](https://github.com/DiUS/java-faker/blob/master/CONTRIBUTIN
Fakers
-----
* Ancient
* Animal
* Address
* App
* Artist
* Avatar
* Back To The Future
* Aviation
* Beer
* Book
@@ -108,8 +104,6 @@ Fakers
* Overwatch
* PhoneNumber
* Pokemon
* Princess Bride
* Relationship Terms
* RickAndMorty
* Robin
* RockBand
@@ -1,13 +0,0 @@
package com.github.javafaker;
public class Animal {
private final Faker faker;
protected Animal(Faker faker) {
this.faker = faker;
}
public String name() {
return faker.fakeValuesService().resolve("creature.animal.name", this, faker);
}
}
@@ -1,30 +0,0 @@
package com.github.javafaker;
public class Buffy {
private final Faker faker;
protected Buffy(Faker faker) {
this.faker = faker;
}
public String characters() {
return faker.fakeValuesService().resolve("buffy.characters", this, faker);
}
public String quotes() {
return faker.fakeValuesService().resolve("buffy.quotes", this, faker);
}
public String celebrities() {
return faker.fakeValuesService().resolve("buffy.celebrities", this, faker);
}
public String bigBads() {
return faker.fakeValuesService().resolve("buffy.big_bads", this, faker);
}
public String episodes() {
return faker.fakeValuesService().resolve("buffy.episodes", this, faker);
}
}
@@ -1,38 +0,0 @@
package com.github.javafaker;
public class ElderScrolls {
private final Faker faker;
protected ElderScrolls(Faker faker) {
this.faker = faker;
}
public String race() {
return faker.fakeValuesService().resolve("games.elder_scrolls.race", this, faker);
}
public String creature() {
return faker.fakeValuesService().resolve("games.elder_scrolls.creature", this, faker);
}
public String region() {
return faker.fakeValuesService().resolve("games.elder_scrolls.region", this, faker);
}
public String dragon() {
return faker.fakeValuesService().resolve("games.elder_scrolls.dragon", this, faker);
}
public String city() {
return faker.fakeValuesService().resolve("games.elder_scrolls.city", this, faker);
}
public String firstName() {
return faker.fakeValuesService().resolve("games.elder_scrolls.first_name", this, faker);
}
public String lastName() {
return faker.fakeValuesService().resolve("games.elder_scrolls.last_name", this, faker);
}
}
@@ -49,7 +49,6 @@ public class Faker {
private final Demographic demographic;
private final Dog dog;
private final Educator educator;
private final ElderScrolls elderScrolls;
private final Shakespeare shakespeare;
private final SlackEmoji slackEmoji;
private final Space space;
@@ -86,11 +85,7 @@ public class Faker {
private final Weather weather;
private final Lebowski lebowski;
private final Medical medical;
private final Animal animal;
private final BackToTheFuture backToTheFuture;
private final PrincessBride princessBride;
private final Buffy buffy;
private final Relationships relationships;
public Faker() {
this(Locale.ENGLISH);
@@ -129,7 +124,6 @@ public class Faker {
this.hacker = new Hacker(this);
this.company = new Company(this);
this.crypto = new Crypto(this);
this.elderScrolls = new ElderScrolls(this);
this.commerce = new Commerce(this);
this.currency = new Currency(this);
this.options = new Options(this);
@@ -178,11 +172,7 @@ public class Faker {
this.lebowski = new Lebowski(this);
this.medical = new Medical(this);
this.country = new Country(this);
this.animal = new Animal(this);
this.backToTheFuture = new BackToTheFuture(this);
this.princessBride = new PrincessBride(this);
this.buffy = new Buffy(this);
this.relationships = new Relationships(this);
}
/**
@@ -363,10 +353,6 @@ public class Faker {
return book;
}
public Buffy buffy() {
return buffy;
}
public Business business() {
return business;
}
@@ -419,10 +405,6 @@ public class Faker {
return food;
}
public ElderScrolls elderScrolls() {
return elderScrolls;
}
public GameOfThrones gameOfThrones() {
return gameOfThrones;
}
@@ -583,20 +565,10 @@ public class Faker {
public Country country(){ return country;}
public Animal animal(){ return animal; }
public BackToTheFuture backToTheFuture() {
return backToTheFuture;
}
public PrincessBride princessBride() {
return princessBride;
}
public Relationships relationships() {
return relationships;
}
public String resolve(String key) {
return this.fakeValuesService.resolve(key, this, this);
}
@@ -1,17 +0,0 @@
package com.github.javafaker;
public class PrincessBride {
private final Faker faker;
protected PrincessBride(Faker faker) {
this.faker = faker;
}
public String character() {
return faker.resolve("princess_bride.characters");
}
public String quote() {
return faker.resolve("princess_bride.quotes");
}
}
@@ -1,60 +0,0 @@
package com.github.javafaker;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import org.apache.commons.lang3.ArrayUtils;
public class Relationships {
private final Faker faker;
protected Relationships(final Faker faker) {
this.faker = faker;
}
public String direct() {
return faker.resolve("relationship.familial.direct");
}
public String extended() {
return faker.resolve("relationship.familial.extended");
}
public String inLaw() {
return faker.resolve("relationship.in_law");
}
public String spouse() {
return faker.resolve("relationship.spouse");
}
public String parent() {
return faker.resolve("relationship.parent");
}
public String sibling() {
return faker.resolve("relationship.sibling");
}
public String any() {
Method currentMethod = Relationships.class.getClass().getEnclosingMethod();
try {
Method[] methods = Relationships.class.getDeclaredMethods();
methods = ArrayUtils.removeElement(methods, currentMethod);
int indx = faker.random().nextInt(methods.length);
Method runMethod = methods[indx];
Relationships relationships = new Relationships(faker);
return (String)runMethod.invoke(relationships);
} catch (SecurityException e) {
throw new RuntimeException("SecurityException: " + e.getMessage());
} catch (IllegalArgumentException e) {
throw new RuntimeException("IllegalArgumentException: " + e.getMessage());
} catch (IllegalAccessException e) {
throw new RuntimeException("IllegalAccessException: " + e.getMessage());
} catch (InvocationTargetException e) {
throw new RuntimeException("InvocationTargetException: " + e.getMessage());
}
}
}
@@ -177,7 +177,6 @@ public class EnFile {
// files where the search path can't be derived from the filename
private static List<EnFile> FILES_WITH_A_DIFFERENT_PATH = Arrays.asList(
new EnFile("animal.yml", "creature"),
new EnFile("cat.yml", "creature"),
new EnFile("dog.yml", "creature"),
new EnFile("league_of_legends.yml", "games"),
@@ -185,7 +184,6 @@ public class EnFile {
new EnFile("pokemon.yml", "games"),
new EnFile("witcher.yml", "games"),
new EnFile("zelda.yml", "games"),
new EnFile("elder_scrolls.yml", "games"),
new EnFile("phone_number.yml", "cell_phone")); // load phone number again with a differen path
-4
View File
@@ -65,10 +65,6 @@ de:
- "#{half_wind_azimuth}"
- "#{quarter_wind_azimuth}"
creature:
animal:
name: ["Aal", "Adler", "Affe", "Affe", "Alligator", "Alpaka", "Ameise", "Antilope", "Ara", "Auster", "Biber", "Biene", "Bisamratte", "Bär", "Büffel", "Chinchilla", "Dachs", "Delphin", "Dinosaurier", "Eichhörnchen", "Eidechse", "Elch", "Elch", "Elch", "Elefant", "Ente", "Esel", "Fisch", "Fledermaus", "Fliege", "Forelle", "Frettchen", "Frosch", "Fuchs", "Gans", "Gepard", "Giraffe", "Gnu", "Goldfisch", "Gorilla", "Grille", "Gürteltier", "Hai", "Hamster", "Hase", "Hering", "Heuschrecke", "Heuschrecke", "Hirsch", "Hornisse", "Hund", "Hyäne", "Igel", "Impala", "Jagdhund", "Kabeljau", "Kakerlake", "Kamel", "Kaninchen", "Karibu", "Katze", "Koala", "Kojote", "Krabbe", "Krokodil", "Krähe", "Kröte", "Käfer", "Känguru", "Lachs", "Lama", "Landschildkröte", "Laus", "Leopard", "Löwe", "Mammut", "Marder", "Maultier", "Maulwurf", "Maus", "Meerschweinchen", "Mops", "Muschel", "Mücke", "Mücke", "Nashorn", "Nerz", "Nilpferd", "Otter", "Panda", "Pavian", "Pferd", "Präriehund", "Qualle", "Rabe", "Ratte", "Rennmaus", "Rentier", "Rind", "Rind", "Robbe", "Sardine", "Schaf", "Schakal", "Schildkröte", "Schimpanse", "Schlange", "Schmetterling", "Schnabeltier", "Schnecke", "Schwan", "Schwein", "Schweinswal", "Seekuh", "Seelöwe", "Serval", "Skorpion", "Spinne", "Stachelschwein", "Stinktier", "Stockente", "Termite", "Tiger", "Wal", "Waldmurmeltier", "Wallaby", "Walross", "Waschbär", "Wasserbüffel", "Wespe", "Wespe", "Wiesel", "Wolf", "Wombat", "Wurm", "Yak", "Zebra", "Ziege", "Zikade"]
internet:
free_email: [gmail.com, yahoo.com, hotmail.com, gmx.de, web.de, mail.de, freenet.de]
domain_suffix: [com, info, name, net, org, de, ch]
+1 -1
View File
@@ -4,7 +4,7 @@ en-ZA:
domain_suffix: [org.za, co.za, com]
address:
default_country: [South Africa, The Replublic of South Africa, SA]
post_code: '####'
postcode: '####'
provinces: [Limpopo, Gauteng, Free State,
North West, Northern Cape, Western Cape,
KwaZulu-Natal, Mpumalanga, Eastern Cape]
Regular → Executable
View File
@@ -110,6 +110,6 @@ public class AddressTest extends AbstractFakerTest {
@Test
public void testCountyByZipCode() {
faker = new Faker(new Locale("en-US"));
assertThat(faker.address().countyByZipCode("47732"), not(isEmptyOrNullString()));
assertThat(faker.address().countyByZipCode(faker.address().zipCodeByState(faker.address().stateAbbr())), not(isEmptyOrNullString()));
}
}
@@ -1,15 +0,0 @@
package com.github.javafaker;
import org.junit.Test;
import static com.github.javafaker.matchers.MatchesRegularExpression.matchesRegularExpression;
import static org.junit.Assert.assertThat;
public class AnimalTest extends AbstractFakerTest {
@Test
public void name() {
assertThat(faker.animal().name(), matchesRegularExpression("[A-Za-z ]+"));
}
}
@@ -1,33 +0,0 @@
package com.github.javafaker;
import org.junit.Test;
import static com.github.javafaker.matchers.IsStringWithContents.isStringWithContents;
import static org.junit.Assert.assertThat;
public class BuffyTest extends AbstractFakerTest {
@Test
public void testCharacters() {
assertThat(faker.buffy().characters(), isStringWithContents());
}
@Test
public void testQuotes() {
assertThat(faker.buffy().quotes(), isStringWithContents());
}
@Test
public void testCelebrities() {
assertThat(faker.buffy().celebrities(), isStringWithContents());
}
@Test
public void testBigBads() {
assertThat(faker.buffy().bigBads(), isStringWithContents());
}
@Test
public void testEpisodes() {
assertThat(faker.buffy().episodes(), isStringWithContents());
}
}
@@ -1,47 +0,0 @@
package com.github.javafaker;
import org.junit.Test;
import static org.hamcrest.Matchers.isEmptyOrNullString;
import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertThat;
public class ElderScrollsTest extends AbstractFakerTest {
@Test
public void testCity() {
assertThat(faker.elderScrolls().city(), not(isEmptyOrNullString()));
}
@Test
public void testCreature() {
assertThat(faker.elderScrolls().creature(), not(isEmptyOrNullString()));
}
@Test
public void testDragon() {
assertThat(faker.elderScrolls().dragon(), not(isEmptyOrNullString()));
}
@Test
public void testFirstName() {
assertThat(faker.elderScrolls().firstName(), not(isEmptyOrNullString()));
}
@Test
public void testLastName() {
assertThat(faker.elderScrolls().lastName(), not(isEmptyOrNullString()));
}
@Test
public void testRace() {
assertThat(faker.elderScrolls().race(), not(isEmptyOrNullString()));
}
@Test
public void testRegion() {
assertThat(faker.elderScrolls().region(), not(isEmptyOrNullString()));
}
}
@@ -1,20 +0,0 @@
package com.github.javafaker;
import org.junit.Test;
import static com.github.javafaker.matchers.MatchesRegularExpression.matchesRegularExpression;
import static org.hamcrest.Matchers.isEmptyOrNullString;
import static org.hamcrest.core.IsNot.not;
import static org.junit.Assert.assertThat;
public class PrincessBrideTest extends AbstractFakerTest {
@Test
public void character() {
assertThat(faker.princessBride().character(), matchesRegularExpression("[A-Za-z .-]+"));
}
@Test
public void quote() {
assertThat(faker.princessBride().quote(), not(isEmptyOrNullString()));
}
}
@@ -1,46 +0,0 @@
package com.github.javafaker;
import static org.hamcrest.Matchers.isEmptyOrNullString;
import static org.hamcrest.core.IsNot.not;
import static org.junit.Assert.assertThat;
import org.junit.Test;
public class RelationshipTest extends AbstractFakerTest {
@Test
public void anyTest() {
assertThat(faker.relationships().any(), not(isEmptyOrNullString()));
}
@Test
public void directTest() {
assertThat(faker.relationships().direct(), not(isEmptyOrNullString()));
}
@Test
public void extendedTest() {
assertThat(faker.relationships().extended(), not(isEmptyOrNullString()));
}
@Test
public void inLawTest() {
assertThat(faker.relationships().inLaw(), not(isEmptyOrNullString()));
}
@Test
public void spouseTest() {
assertThat(faker.relationships().spouse(), not(isEmptyOrNullString()));
}
@Test
public void parentTest() {
assertThat(faker.relationships().parent(), not(isEmptyOrNullString()));
}
@Test
public void siblingTest() {
assertThat(faker.relationships().sibling(), not(isEmptyOrNullString()));
}
}
@@ -36,7 +36,7 @@ public class FakerIT {
/**
* a collection of Locales -> Exceptions.
* In the case of 'pt', city_prefix is '' by design. This test fails because it's testing that all string returning
* methods return a non blank string. But pt city_prefix is blank ,but the test shouldn't fail. So we add put
* methods return a non blank string. But pt city_prefix is blank ,but the test shouldn't fail. So we add put
* exceptions like this into this collection.
*/
private static final Map<Locale, List<String>> exceptions = Maps.newHashMap();
@@ -152,11 +152,6 @@ public class FakerIT {
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.witcher());
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.weather());
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.lebowski());
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.animal());
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.princessBride());
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.elderScrolls());
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.buffy());
testAllMethodsThatReturnStringsActuallyReturnStrings(faker.relationships());
}
private void testAllMethodsThatReturnStringsActuallyReturnStrings(Object object) throws Exception {