Skip to content

Commit

Permalink
en_AU instances, using StringGenBuilder in State classes (#32)
Browse files Browse the repository at this point in the history
* en_AU instances, using StringGenBuilder in State classes

* Better parallel test execution

* remove coverage for ResourceLoader and Faker instances

* more coverage updates
  • Loading branch information
etspaceman authored Jul 9, 2020
1 parent 80f47f1 commit cdc4e71
Show file tree
Hide file tree
Showing 19 changed files with 649 additions and 543 deletions.
3 changes: 3 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ scalacOptions in (Compile, console) ~= {
_.filterNot(Set("-Ywarn-unused-import", "-Ywarn-unused:imports"))
}

fork in Test := true
testForkedParallel in Test := true

addCommandAlias("cpl", ";+test:compile")
addCommandAlias(
"fixCheck",
Expand Down
5 changes: 5 additions & 0 deletions src/main/resources/en_AU.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
include "en_AU/address.conf"
include "en_AU/company.conf"
include "en_AU/internet.conf"
include "en_AU/name.conf"
include "en_AU/phone.conf"
36 changes: 36 additions & 0 deletions src/main/resources/en_AU/address.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
address {
postal-codes = ["0###", "2###", "3###", "4###", "5###", "6###", "7###"]
postal-code-builder = {options = [{parts = [{type = "seq-string-part", value = ${address.postal-codes}}]}]}
default-countries = [{code = "AU", name = "Australia"}]
states = [
{type = "state", name = New South Wales, abbr = NSW, postal-code-builder = ${address.postal-code-builder}},
{type = "state", name = Queensland, abbr = QLD, postal-code-builder = ${address.postal-code-builder}},
{type = "state", name = Northern Territory, abbr = NT, postal-code-builder = ${address.postal-code-builder}},
{type = "state", name = South Australia, abbr = SA, postal-code-builder = ${address.postal-code-builder}},
{type = "state", name = Western Australia, abbr = WA, postal-code-builder = ${address.postal-code-builder}},
{type = "state", name = Tasmania, abbr = TAS, postal-code-builder = ${address.postal-code-builder}},
{type = "state", name = Australian Capital Territory, abbr = ACT, postal-code-builder = ${address.postal-code-builder}},
{type = "state", name = Victoria, abbr = VIC, postal-code-builder = ${address.postal-code-builder}},
]
building-numbers = ["####", "###", "##"]
street-suffixes = [Avenue, Boulevard, Circle, Circuit, Court, Crescent, Crest, Drive, Estate Dr, Grove, Hill, Island, Junction, Knoll, Lane, Loop, Mall, Manor, Meadow, Mews, Parade, Parkway, Pass, Place, Plaza, Ridge, Road, Run, Square, Station St, Street, Summit, Terrace, Track, Trail, View Rd, Way]
full-address-builder = {
options = [
{
parts = [
{type = "string-builder-part", value = ${address.street-address-builder}, suffix = ", "},
{type = "string-builder-part", value = ${address.city-builder}, suffix = ", "},
{type = "seq-state-abbr-and-zip-part", value = ${address.states}}
]
},
{
parts = [
{type = "string-builder-part", value = ${address.street-address-builder}, suffix = " "},
{type = "seq-string-part", value = ${address.secondary-addresses}, suffix = ", "},
{type = "string-builder-part", value = ${address.city-builder}, suffix = ", "},
{type = "seq-state-abbr-and-zip-part", value = ${address.states}}
]
}
]
}
}
3 changes: 3 additions & 0 deletions src/main/resources/en_AU/company.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
company {
suffixes = [Pty Ltd, and Sons, Corp, Group, Brothers, Partners]
}
3 changes: 3 additions & 0 deletions src/main/resources/en_AU/internet.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
internet {
domain-suffixes = [com.au, com, net.au, net, org.au, org]
}
14 changes: 14 additions & 0 deletions src/main/resources/en_AU/name.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name {
first.names = [William, Jack, Oliver, Joshua, Thomas, Lachlan, Cooper, Noah, Ethan, Lucas, James, Samuel, Jacob, Liam, Alexander, Benjamin, Max, Isaac, Daniel, Riley, Ryan, Charlie, Tyler, Jake, Matthew, Xavier, Harry, Jayden, Nicholas, Harrison, Levi, Luke, Adam, Henry, Aiden, Dylan, Oscar, Michael, Jackson, Logan, Joseph, Blake, Nathan, Connor, Elijah, Nate, Archie, Bailey, Marcus, Cameron, Jordan, Zachary, Caleb, Hunter, Ashton, Toby, Aidan, Hayden, Mason, Hamish, Edward, Angus, Eli, Sebastian, Christian, Patrick, Andrew, Anthony, Luca, Kai, Beau, Alex, George, Callum, Finn, Zac, Mitchell, Jett, Jesse, Gabriel, Leo, Declan, Charles, Jasper, Jonathan, Aaron, Hugo, David, Christopher, Chase, Owen, Justin, Ali, Darcy, Lincoln, Cody, Phoenix, Sam, John, Joel, Isabella, Ruby, Chloe, Olivia, Charlotte, Mia, Lily, Emily, Ella, Sienna, Sophie, Amelia, Grace, Ava, Zoe, Emma, Sophia, Matilda, Hannah, Jessica, Lucy, Georgia, Sarah, Abigail, Zara, Eva, Scarlett, Jasmine, Chelsea, Lilly, Ivy, Isla, Evie, Isabelle, Maddison, Layla, Summer, Annabelle, Alexis, Elizabeth, Bella, Holly, Lara, Madison, Alyssa, Maya, Tahlia, Claire, Hayley, Imogen, Jade, Ellie, Sofia, Addison, Molly, Phoebe, Alice, Savannah, Gabriella, Kayla, Mikayla, Abbey, Eliza, Willow, Alexandra, Poppy, Samantha, Stella, Amy, Amelie, Anna, Piper, Gemma, Isabel, Victoria, Stephanie, Caitlin, Heidi, Paige, Rose, Amber, Audrey, Claudia, Taylor, Madeline, Angelina, Natalie, Charli, Lauren, Ashley, Violet, Mackenzie, Abby, Skye, Lillian, Alana, Lola, Leah, Eve, Kiara]
last.names = [Smith, Jones, Williams, Brown, Wilson, Taylor, Johnson, White, Martin, Anderson, Thompson, Nguyen, Thomas, Walker, Harris, Lee, Ryan, Robinson, Kelly, King, Davis, Wright, Evans, Roberts, Green, Hall, Wood, Jackson, Clarke, Patel, Khan, Lewis, James, Phillips, Mason, Mitchell, Rose, Davies, Rodriguez, Cox, Alexander, Garden, Campbell, Johnston, Moore, Smyth, O'neill, Doherty, Stewart, Quinn, Murphy, Graham, Mclaughlin, Hamilton, Murray, Hughes, Robertson, Thomson, Scott, Macdonald, Reid, Clark, Ross, Young, Watson, Paterson, Morrison, Morgan, Griffiths, Edwards, Rees, Jenkins, Owen, Price, Moss, Richards, Abbott, Adams, Armstrong, Bahringer, Bailey, Barrows, Bartell, Bartoletti, Barton, Bauch, Baumbach, Bayer, Beahan, Beatty, Becker, Beier, Berge, Bergstrom, Bode, Bogan, Borer, Bosco, Botsford, Boyer, Boyle, Braun, Bruen, Carroll, Carter, Cartwright, Casper, Cassin, Champlin, Christiansen, Cole, Collier, Collins, Connelly, Conroy, Corkery, Cormier, Corwin, Cronin, Crooks, Cruickshank, Cummings, D'amore, Daniel, Dare, Daugherty, Dickens, Dickinson, Dietrich, Donnelly, Dooley, Douglas, Doyle, Durgan, Ebert, Emard, Emmerich, Erdman, Ernser, Fadel, Fahey, Farrell, Fay, Feeney, Feil, Ferry, Fisher, Flatley, Gibson, Gleason, Glover, Goldner, Goodwin, Grady, Grant, Greenfelder, Greenholt, Grimes, Gutmann, Hackett, Hahn, Haley, Hammes, Hand, Hane, Hansen, Harber, Hartmann, Harvey, Hayes, Heaney, Heathcote, Heller, Hermann, Hermiston, Hessel, Hettinger, Hickle, Hill, Hills, Hoppe, Howe, Howell, Hudson, Huel, Hyatt, Jacobi, Jacobs, Jacobson, Jerde, Johns, Keeling, Kemmer, Kessler, Kiehn, Kirlin, Klein, Koch, Koelpin, Kohler, Koss, Kovacek, Kreiger, Kris, Kuhlman, Kuhn, Kulas, Kunde, Kutch, Lakin, Lang, Langworth, Larkin, Larson, Leannon, Leffler, Little, Lockman, Lowe, Lynch, Mann, Marks, Marvin, Mayer, Mccullough, Mcdermott, Mckenzie, Miller, Mills, Monahan, Morissette, Mueller, Muller, Nader, Nicolas, Nolan, O'connell, O'conner, O'hara, O'keefe, Olson, O'reilly, Parisian, Parker, Quigley, Reilly, Reynolds, Rice, Ritchie, Rohan, Rolfson, Rowe, Russel, Rutherford, Sanford, Sauer, Schmidt, Schmitt, Schneider, Schroeder, Schultz, Shields, Smitham, Spencer, Stanton, Stark, Stokes, Swift, Tillman, Towne, Tremblay, Tromp, Turcotte, Turner, Walsh, Walter, Ward, Waters, Weber, Welch, West, Wilderman, Wilkinson, Williamson, Windler, Wolf]
full-name-with-middle-builder = {
options = [
{parts = [{type = "seq-string-part", value = ${name.first.names}, suffix = " "}, {type = "seq-string-part", value = ${name.last.names}, suffix = " "}, {type = "seq-string-part", value = ${name.last.names}}]}
]
}
full-name-builder = {
options = [
{parts = [{type = "seq-string-part", value = ${name.first.names}, suffix = " "}, {type = "seq-string-part", value = ${name.last.names}}]}
]
}
}
4 changes: 4 additions & 0 deletions src/main/resources/en_AU/phone.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
phone {
phone-number-builder = {options = [{parts = [{type = "seq-string-part", value = ["0# #### ####", "+61 # #### ####", "+61 4## ### ###"]}]}]}
cell-number-builder = {options = [{parts = [{type = "seq-string-part", value = ["04##-###-###", "(0) 4##-###-###", "04## ### ###", "04########", "04## ## ## ##"]}]}]}
}
27 changes: 13 additions & 14 deletions src/main/resources/en_CA/address.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@ address {
postal-string = "[A-CEJ-NPR-TVXY][0-9][A-CEJ-NPR-TV-Z] ?[0-9][A-CEJ-NPR-TV-Z][0-9]"
postal-code-builder = {options = [{parts = [{type = "string-regex-part", value = ${address.postal-string}}]}]}
states = [
{type = "province", abbr = "AB", name = "Alberta", postal-code-string = ${address.postal-string}},
{type = "province", abbr = "BC", name = "British Columbia", postal-code-string = ${address.postal-string}},
{type = "province", abbr = "MB", name = "Manitoba", postal-code-string = ${address.postal-string}},
{type = "province", abbr = "NB", name = "New Brunswick", postal-code-string = ${address.postal-string}},
{type = "province", abbr = "NL", name = "Newfoundland and Labrador", postal-code-string = ${address.postal-string}},
{type = "province", abbr = "NS", name = "Nova Scotia", postal-code-string = ${address.postal-string}},
{type = "province", abbr = "NT", name = "Northwest Territories", postal-code-string = ${address.postal-string}},
{type = "province", abbr = "NU", name = "Nunavut", postal-code-string = ${address.postal-string}},
{type = "province", abbr = "ON", name = "Ontario", postal-code-string = ${address.postal-string}},
{type = "province", abbr = "PE", name = "Prince Edward Island", postal-code-string = ${address.postal-string}},
{type = "province", abbr = "QC", name = "Quebec", postal-code-string = ${address.postal-string}},
{type = "province", abbr = "SK", name = "Saskatchewan", postal-code-string = ${address.postal-string}},
{type = "province", abbr = "YT", name = "Yukon", postal-code-string = ${address.postal-string}},

{type = "province", abbr = "AB", name = "Alberta", postal-code-builder = ${address.postal-code-builder}},
{type = "province", abbr = "BC", name = "British Columbia", postal-code-builder = ${address.postal-code-builder}},
{type = "province", abbr = "MB", name = "Manitoba", postal-code-builder = ${address.postal-code-builder}},
{type = "province", abbr = "NB", name = "New Brunswick", postal-code-builder = ${address.postal-code-builder}},
{type = "province", abbr = "NL", name = "Newfoundland and Labrador", postal-code-builder = ${address.postal-code-builder}},
{type = "province", abbr = "NS", name = "Nova Scotia", postal-code-builder = ${address.postal-code-builder}},
{type = "province", abbr = "NT", name = "Northwest Territories", postal-code-builder = ${address.postal-code-builder}},
{type = "province", abbr = "NU", name = "Nunavut", postal-code-builder = ${address.postal-code-builder}},
{type = "province", abbr = "ON", name = "Ontario", postal-code-builder = ${address.postal-code-builder}},
{type = "province", abbr = "PE", name = "Prince Edward Island", postal-code-builder = ${address.postal-code-builder}},
{type = "province", abbr = "QC", name = "Quebec", postal-code-builder = ${address.postal-code-builder}},
{type = "province", abbr = "SK", name = "Saskatchewan", postal-code-builder = ${address.postal-code-builder}},
{type = "province", abbr = "YT", name = "Yukon", postal-code-builder = ${address.postal-code-builder}}
]
full-address-builder = {
options = [
Expand Down
70 changes: 35 additions & 35 deletions src/main/resources/en_IND/address.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,41 @@ address {
city-builder = {options = [{parts = [{type = "seq-string-part", value = ${address.cities}}]}]}
default-countries = [{code = "IN", name = "India"}, {code = "IN", name = "Indian Republic"}, {code = "IN", name = "Bharat"}, {code = "IN", name = "Hindustan"}]
states = [
{type = "state", name = Andhra Pradesh, abbr = AP, postal-code-string = ${address.postal-code-string}},
{type = "state", name = Arunachal Pradesh, abbr = AR, postal-code-string = ${address.postal-code-string}},
{type = "state", name = Assam, abbr = AS, postal-code-string = ${address.postal-code-string}},
{type = "state", name = Bihar, abbr = BR, postal-code-string = ${address.postal-code-string}},
{type = "state", name = Chhattisgarh, abbr = CG, postal-code-string = ${address.postal-code-string}},
{type = "state", name = Goa, abbr = GA, postal-code-string = ${address.postal-code-string}},
{type = "state", name = Gujarat, abbr = GJ, postal-code-string = ${address.postal-code-string}},
{type = "state", name = Haryana, abbr = HR, postal-code-string = ${address.postal-code-string}},
{type = "state", name = Himachal Pradesh, abbr = HP, postal-code-string = ${address.postal-code-string}},
{type = "state", name = Jammu and Kashmir, abbr = JK, postal-code-string = ${address.postal-code-string}},
{type = "state", name = Jharkhand, abbr = JH, postal-code-string = ${address.postal-code-string}},
{type = "state", name = Karnataka, abbr = KA, postal-code-string = ${address.postal-code-string}},
{type = "state", name = Kerala, abbr = KL, postal-code-string = ${address.postal-code-string}},
{type = "state", name = Madya Pradesh, abbr = MP, postal-code-string = ${address.postal-code-string}},
{type = "state", name = Maharashtra, abbr = MH, postal-code-string = ${address.postal-code-string}},
{type = "state", name = Manipur, abbr = MN, postal-code-string = ${address.postal-code-string}},
{type = "state", name = Meghalaya, abbr = ML, postal-code-string = ${address.postal-code-string}},
{type = "state", name = Mizoram, abbr = MZ, postal-code-string = ${address.postal-code-string}},
{type = "state", name = Nagaland, abbr = NL, postal-code-string = ${address.postal-code-string}},
{type = "state", name = Orissa, abbr = OR, postal-code-string = ${address.postal-code-string}},
{type = "state", name = Punjab, abbr = PB, postal-code-string = ${address.postal-code-string}},
{type = "state", name = Rajasthan, abbr = RJ, postal-code-string = ${address.postal-code-string}},
{type = "state", name = Sikkim, abbr = SK, postal-code-string = ${address.postal-code-string}},
{type = "state", name = Tamil Nadu, abbr = TN, postal-code-string = ${address.postal-code-string}},
{type = "state", name = Tripura, abbr = TR, postal-code-string = ${address.postal-code-string}},
{type = "state", name = Uttaranchal, abbr = UK, postal-code-string = ${address.postal-code-string}},
{type = "state", name = Uttar Pradesh, abbr = UP, postal-code-string = ${address.postal-code-string}},
{type = "state", name = West Bengal, abbr = WB, postal-code-string = ${address.postal-code-string}},
{type = "state", name = Andaman and Nicobar Islands, abbr = AN, postal-code-string = ${address.postal-code-string}},
{type = "state", name = Chandigarh, abbr = CG, postal-code-string = ${address.postal-code-string}},
{type = "state", name = Dadar and Nagar Haveli, abbr = DH, postal-code-string = ${address.postal-code-string}},
{type = "state", name = Daman and Diu, abbr = DD, postal-code-string = ${address.postal-code-string}},
{type = "state", name = Delhi, abbr = DL, postal-code-string = ${address.postal-code-string}},
{type = "state", name = Lakshadweep, abbr = LD, postal-code-string = ${address.postal-code-string}},
{type = "state", name = Pondicherry, abbr = PY, postal-code-string = ${address.postal-code-string}},
{type = "state", name = Andhra Pradesh, abbr = AP, postal-code-builder = ${address.postal-code-builder}},
{type = "state", name = Arunachal Pradesh, abbr = AR, postal-code-builder = ${address.postal-code-builder}},
{type = "state", name = Assam, abbr = AS, postal-code-builder = ${address.postal-code-builder}},
{type = "state", name = Bihar, abbr = BR, postal-code-builder = ${address.postal-code-builder}},
{type = "state", name = Chhattisgarh, abbr = CG, postal-code-builder = ${address.postal-code-builder}},
{type = "state", name = Goa, abbr = GA, postal-code-builder = ${address.postal-code-builder}},
{type = "state", name = Gujarat, abbr = GJ, postal-code-builder = ${address.postal-code-builder}},
{type = "state", name = Haryana, abbr = HR, postal-code-builder = ${address.postal-code-builder}},
{type = "state", name = Himachal Pradesh, abbr = HP, postal-code-builder = ${address.postal-code-builder}},
{type = "state", name = Jammu and Kashmir, abbr = JK, postal-code-builder = ${address.postal-code-builder}},
{type = "state", name = Jharkhand, abbr = JH, postal-code-builder = ${address.postal-code-builder}},
{type = "state", name = Karnataka, abbr = KA, postal-code-builder = ${address.postal-code-builder}},
{type = "state", name = Kerala, abbr = KL, postal-code-builder = ${address.postal-code-builder}},
{type = "state", name = Madya Pradesh, abbr = MP, postal-code-builder = ${address.postal-code-builder}},
{type = "state", name = Maharashtra, abbr = MH, postal-code-builder = ${address.postal-code-builder}},
{type = "state", name = Manipur, abbr = MN, postal-code-builder = ${address.postal-code-builder}},
{type = "state", name = Meghalaya, abbr = ML, postal-code-builder = ${address.postal-code-builder}},
{type = "state", name = Mizoram, abbr = MZ, postal-code-builder = ${address.postal-code-builder}},
{type = "state", name = Nagaland, abbr = NL, postal-code-builder = ${address.postal-code-builder}},
{type = "state", name = Orissa, abbr = OR, postal-code-builder = ${address.postal-code-builder}},
{type = "state", name = Punjab, abbr = PB, postal-code-builder = ${address.postal-code-builder}},
{type = "state", name = Rajasthan, abbr = RJ, postal-code-builder = ${address.postal-code-builder}},
{type = "state", name = Sikkim, abbr = SK, postal-code-builder = ${address.postal-code-builder}},
{type = "state", name = Tamil Nadu, abbr = TN, postal-code-builder = ${address.postal-code-builder}},
{type = "state", name = Tripura, abbr = TR, postal-code-builder = ${address.postal-code-builder}},
{type = "state", name = Uttaranchal, abbr = UK, postal-code-builder = ${address.postal-code-builder}},
{type = "state", name = Uttar Pradesh, abbr = UP, postal-code-builder = ${address.postal-code-builder}},
{type = "state", name = West Bengal, abbr = WB, postal-code-builder = ${address.postal-code-builder}},
{type = "state", name = Andaman and Nicobar Islands, abbr = AN, postal-code-builder = ${address.postal-code-builder}},
{type = "state", name = Chandigarh, abbr = CG, postal-code-builder = ${address.postal-code-builder}},
{type = "state", name = Dadar and Nagar Haveli, abbr = DH, postal-code-builder = ${address.postal-code-builder}},
{type = "state", name = Daman and Diu, abbr = DD, postal-code-builder = ${address.postal-code-builder}},
{type = "state", name = Delhi, abbr = DL, postal-code-builder = ${address.postal-code-builder}},
{type = "state", name = Lakshadweep, abbr = LD, postal-code-builder = ${address.postal-code-builder}},
{type = "state", name = Pondicherry, abbr = PY, postal-code-builder = ${address.postal-code-builder}},
]
full-address-builder = {
options = [
Expand Down
15 changes: 9 additions & 6 deletions src/main/scala/faker/Faker.scala
Original file line number Diff line number Diff line change
Expand Up @@ -324,10 +324,13 @@ final class Faker(private[faker] val locale: Locale) {
}

object Faker {
val default = new Faker(SupportedLocales.default)
val en = new Faker(SupportedLocales.en)
val en_US = new Faker(SupportedLocales.en_US)
val en_CA = new Faker(SupportedLocales.en_CA)
val en_GB = new Faker(SupportedLocales.en_GB)
val en_IND = new Faker(SupportedLocales.en_IND)
// $COVERAGE-OFF$
val default: Faker = new Faker(SupportedLocales.default)
val en: Faker = new Faker(SupportedLocales.en)
val en_US: Faker = new Faker(SupportedLocales.en_US)
val en_CA: Faker = new Faker(SupportedLocales.en_CA)
val en_GB: Faker = new Faker(SupportedLocales.en_GB)
val en_IND: Faker = new Faker(SupportedLocales.en_IND)
val en_AU: Faker = new Faker(SupportedLocales.en_AU)
// $COVERAGE-ON$
}
Loading

0 comments on commit cdc4e71

Please sign in to comment.