Skip to content

Commit 535aa0f

Browse files
authored
Added Republic of Ireland locale configuration (#1524)
* Added Republic of Ireland locale configuration * Correct Irish passport number format * Added 20 Irish names 10 male 10 female and 20 surnames * Updated unit test for irish passport and phone number * Fix Eircode as Postcode for Irish address
1 parent 0a2816c commit 535aa0f

9 files changed

Lines changed: 62 additions & 3 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,7 @@ In the example above,
491491
* en-BORK
492492
* en-CA
493493
* en-GB (Great Britain)
494+
* en-IE (Republic Of Ireland)
494495
* en-IN (India)
495496
* en-MS
496497
* en-NEP

src/main/java/net/datafaker/providers/base/Address.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ public String postcode() {
4747
return faker.bothify(resolve("address.postcode"));
4848
}
4949

50+
public String eircode() {
51+
return faker.bothify(resolve("address.postcode"));
52+
}
53+
5054
/**
5155
* Returns a String representing a ZIP+4 code for greater geographic specificity.
5256
* This is a 9-digit zip code, but the String itself is 10 characters including the hyphen.

src/main/java/net/datafaker/providers/base/Locality.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ public class Locality extends AbstractProvider<BaseProviders> {
2323
"_il", "_in",
2424
"_kr",
2525
"_lv", "_no", "_md", "_mk", "_nl", "_pl", "_py", "_ru", "_se", "_tr", "_tw", "_ua", "_us", "_uz", "_vn",
26-
"_es", "_sk", "_id", "_hr", "_pt", "_it", "_de", "_am", "_mx", "_br", "_be", "_th",
26+
"_es", "_sk", "_id", "_hr", "_pt", "_ie", "_it", "_de", "_am", "_mx", "_br", "_be", "_th",
2727
"ar", "be", "bg", "by", "ca", "ca-cat", "cs", "cs-cz",
2828
"da-dk", "de", "de-at", "de-ch",
29-
"el-gr", "en", "en-au", "en-au-ocker", "en-bork", "en-ca", "en-gb", "en-in", "en-md", "en-ms", "en-nep",
29+
"el-gr", "en", "en-au", "en-au-ocker", "en-bork", "en-ca", "en-gb", "en-ie", "en-in", "en-md", "en-ms", "en-nep",
3030
"en-ng", "en-nz", "en-pak", "en-ph", "en-pk", "en-sg", "en-ug", "en-us", "en-za",
3131
"es", "es-ar", "es-mx", "es-py", "et", "fa", "fi-fi", "fr", "fr-ca", "fr-ch",
3232
"he", "hr", "hu", "hy", "id", "id-id", "it", "ja", "ka", "ko", "lv", "mk",

src/main/resources/META-INF/native-image/reachability-metadata.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2281,6 +2281,10 @@
22812281
"name": "postcode",
22822282
"parameterTypes": []
22832283
},
2284+
{
2285+
"name": "eircode",
2286+
"parameterTypes": []
2287+
},
22842288
{
22852289
"name": "secondaryAddress",
22862290
"parameterTypes": []
@@ -18708,6 +18712,9 @@
1870818712
{
1870918713
"glob": "/en/en-GB"
1871018714
},
18715+
{
18716+
"glob": "/en/en-IE"
18717+
},
1871118718
{
1871218719
"glob": "/en/en-IND"
1871318720
},
@@ -19470,6 +19477,9 @@
1947019477
{
1947119478
"glob": "en-GB.yml"
1947219479
},
19480+
{
19481+
"glob": "en-IE.yml"
19482+
},
1947319483
{
1947419484
"glob": "en-IND.yml"
1947519485
},
@@ -19758,6 +19768,9 @@
1975819768
{
1975919769
"glob": "en/en-GB"
1976019770
},
19771+
{
19772+
"glob": "en/en-IE"
19773+
},
1976119774
{
1976219775
"glob": "en/en-IND"
1976319776
},

src/main/resources/_IE.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# coding: utf-8
2+
# Republic OF Ireland
3+
_IE:
4+
faker:
5+
address:
6+
country_code: ["IE"]
7+
postcode: /([AC-FHKNPRTV-Y]{1}[0-9]{2}|D6W)[ ]?[0-9AC-FHKNPRTV-Y]{4}/
8+
9+
internet:
10+
domain_suffix: [ie, ireland, eire, irish, name]
11+
12+
passport:
13+
valid: "(P|L)[A-Z]{1}[0-9]{7}"
14+
15+
phone_number:
16+
country_code: ['353']

src/main/resources/en-IE.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
en-IE:
2+
faker:
3+
name:
4+
first_name: [Seán, Cian, Darragh, David, Eoin, Rían, Tadhg, Niall, Cathal, Padraig, Aoife, Niamh, Saoirse, Ciara, Aisling, Roisin, Siobhán, Maeve, Caoimhe, Orla]
5+
last_name: [O'Brien, O'Connor, McGlynn, O'Malley, Walsh, O'Neill, Crowley, O'Dwyer, O'Hara, McCarthy, O'Dea, O'Rourke, O'Shea, Prendergast, O'Mahony, Murphy, O'Farrell, O'Loughlin, O'Carroll, O'Toole]
6+
name_with_middle:
7+
- "#{first_name} #{last_name} #{last_name}"
8+
address:
9+
county: [Galway, Leitrim, Mayo, Roscommon, Sligo, Donegal, Cavan, Monaghan, Clare, Cork, Kerry, Limerick, Tipperary, Waterford, Carlow, Dublin, Kildare, Kilkenny, Laois, Longford, Louth, Meath, Offaly, Westmeath, Wexford, Wicklow]
10+
dublin-postcode: [D01, D02, D03, D04, DO5, D06, D07, D08, D09, D10, D11, D12, D13, D14, D15, D16, D17, D18, D19, D20, D21, D22, D23, D24, D6W]
11+
default_country: [Ireland, Republic of Ireland]

src/test/java/net/datafaker/providers/base/AddressTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,12 @@ void fullAddress_estonia() {
173173
assertThat(f.address().fullAddress()).isNotEmpty();
174174
}
175175

176+
@Test
177+
void eircode_ireland() {
178+
BaseFaker f = new BaseFaker(new Locale("en", "IE"));
179+
assertThat(f.address().eircode()).isNotEmpty();
180+
}
181+
176182
@Test
177183
void testZipCodeByState() {
178184
final BaseFaker localFaker = new BaseFaker(new Locale("en", "US"));

src/test/java/net/datafaker/providers/base/PassportTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@ void testValidUnitedKingdom() {
5353
.hasSize(9);
5454
}
5555

56+
@RepeatedTest(10)
57+
void testValidRepublicOfIreland() {
58+
assertThat(new BaseFaker(new Locale("en", "IE")).passport().valid())
59+
.hasSize(9);
60+
}
61+
62+
5663
@RepeatedTest(10)
5764
void testValidJapan() {
5865
assertThat(new BaseFaker(new Locale("ja")).passport().valid())

src/test/java/net/datafaker/providers/base/PhoneNumberTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@ private static Stream<Arguments> locales() {
187187
locale("no", "NO"),
188188
locale("da", "DK"),
189189
locale("vi", "VI"),
190-
locale("fr", "CH")
190+
locale("fr", "CH"),
191+
locale("en", "IE")
191192
);
192193
}
193194

0 commit comments

Comments
 (0)