Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ Providers
* Music
* Name
* Nation
* Nigeria
* Number
* Options
* Overwatch
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/net/datafaker/Faker.java
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,10 @@ public NatoPhoneticAlphabet natoPhoneticAlphabet() {
return getProvider(NatoPhoneticAlphabet.class, () -> new NatoPhoneticAlphabet(this));
}

public Nigeria nigeria() {
return getProvider(Nigeria.class, () -> new Nigeria(this));
}

public Number number() {
return getProvider(Number.class, () -> new Number(this));
}
Expand Down
37 changes: 37 additions & 0 deletions src/main/java/net/datafaker/Nigeria.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package net.datafaker;

import java.nio.file.Paths;
import java.util.Locale;

public class Nigeria {
private static final String KEY = "nigeria";
private final Faker faker;

protected Nigeria(Faker faker) {
this.faker = faker;
faker.fakeValuesService().addPath(Locale.ENGLISH, Paths.get("src/main/resources/en/nigeria.yml"));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bodiam @The-True-Hooha I know this PR has already been merged, but this location is still wrong. I guess we need to come up with a test that actually prevents building a JAR whenever this shows up, because the test will succeed but the actual JAR will not.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, thanks for letting me know, I even added an extra test to Faker It for this. No worries, I'll fix it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fixed, I removed this code, I already registered the yml file in the central spot.

}

public String places() {
return faker.fakeValuesService().resolve("nigeria.places", this, faker);
}

public String name() {
return faker.fakeValuesService().resolve("nigeria.name", this, faker);
}

public String food() {
return faker.fakeValuesService().resolve("nigeria.food", this, faker);
}

public String schools() {
return faker.fakeValuesService().resolve("nigeria.schools", this, faker);
}

public String celebrities(){
return faker.fakeValuesService().resolve("nigeria.celebrities", this, faker);
}
}



8 changes: 8 additions & 0 deletions src/main/resources/en/nigeria.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
en:
faker:
nigeria:
places: ["Lagos", "Warri", "Enugu", "Abuja", "Calabar", "Ogoja", "Ogun", "Uyo", "Abia", "Illorin", "Ediba", "Ikot-ekpene", "Abak", "Itu", "Yala", "Sokoto", "Kaduna", "Kano", "kastina"]
name: ["Bayo", "Akpan", "Itunu", "Kevwe", "Oteri", "Ogun", "Imaobong", "Okon", "Uwem", "Eze", "Lovina", "Rekpene", "Uduak", "Ada", "Abasifreke", "Odachi", "Bello", "Dangote", "Buhari"]
food: ["Rice", "Bean", "Edikan-Ikong", "Banga-soup", "Ewedu and Amala", "Afang", "Oha-soup", "Atama", "Bitter-leaf soup", "Garri", "Kuli-Kuli"]
schools: ["FUPRE", "UNI-UYO", "UNICAL", "UNIPORT", "UNIABUJA", "DELSU", "MADONNA", "CRUTECH", "UNILAG", "UNIBEN", "AKSU", "UNN", "EBSU", "COVENANT", "LANDMARK"]
celebrities: ["Davido", "Wizkid", "Burnaboy", "Skibii", "Adekunle Gold", "Nse-Ikpe Etim", "The Lady Motara", "HackSultan", "David Hundeyi", "Tunde", "El-rufai", "Goodluck Jonathan", "Buhari", "Obasanjo"]
9 changes: 3 additions & 6 deletions src/test/java/net/datafaker/AustraliaTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,15 @@
public class AustraliaTest extends AbstractFakerTest {

@Test
public void locations() {
assertThat(faker.australia().locations(), not(is(emptyOrNullString())));
public void locations() { assertThat(faker.australia().locations(), not(is(emptyOrNullString())));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Misformatted

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made the corresponding format changes locally, please check my last commit to see if it's corrected.

Apologies.

}

@Test
public void animals() {
assertThat(faker.australia().animals(), not(is(emptyOrNullString())));
public void animals() { assertThat(faker.australia().animals(), not(is(emptyOrNullString())));
}

@Test
public void states() {
assertThat(faker.australia().states(), not(is(emptyOrNullString())));
public void states() { assertThat(faker.australia().states(), not(is(emptyOrNullString())));
}

}
36 changes: 36 additions & 0 deletions src/test/java/net/datafaker/NigeriaTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package net.datafaker;

import org.junit.jupiter.api.Test;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*;


class NigeriaTest extends AbstractFakerTest{

@Test
public void places() {
assertThat(faker.nigeria().places(), not(is(emptyOrNullString())));
}


@Test
void food() {
assertThat(faker.nigeria().food(), not(is(emptyOrNullString())));
}

@Test
void names() {
assertThat(faker.nigeria().name(), not(is(emptyOrNullString())));
}

@Test
void schools() {
assertThat(faker.nigeria().celebrities(), not(is(emptyOrNullString())));
}

@Test
void celebrities() {
assertThat(faker.nigeria().celebrities(), not(is(emptyOrNullString())));
}
}