Skip to content

Commit 1199fd5

Browse files
authored
Add new data providers
Also adds 'ja' dicts for 'sport' and 'touhou' Close #200
1 parent 811a249 commit 1199fd5

File tree

20 files changed

+2201
-9
lines changed

20 files changed

+2201
-9
lines changed

CHANGELOG.adoc

+15-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.[1.15.0] - UNRELEASED
1+
.[1.15.0] - 2023-10-06
22
[%collapsible]
33
====
44
[discrete]
@@ -11,8 +11,21 @@
1111
*** `Faker().internet.safeDomainSuffix()`
1212
*** `Faker().southPark.episodes()`
1313
** Updates to existing localized dictionaries
14-
1514
* https://github.com/serpro69/kotlin-faker/pull/197[#197] [cli] Render sub-providers functions in cli output
15+
* https://github.com/serpro69/kotlin-faker/pull/200[#200] [core] Add new data providers
16+
17+
++++
18+
<details><summary><h3>New Data Providers</h3></summary>
19+
<p>
20+
++++
21+
* `archer`
22+
* `final_fantasy_xiv`
23+
* `mitch_hedberg`
24+
* `train_station`
25+
++++
26+
</p>
27+
</details>
28+
++++
1629

1730
[discrete]
1831
=== Changed
@@ -25,11 +38,6 @@
2538
* https://github.com/serpro69/kotlin-faker/pull/188[#188] [core] Fix postcode for en-GB locale
2639
* https://github.com/serpro69/kotlin-faker/pull/193[#193] [core] Fix localized postcodes with regex patterns
2740

28-
[discrete]
29-
=== Other
30-
31-
* ...
32-
3341
====
3442
3543
.[1.14.0] - 2023-03-19

cli-bot/src/main/resources/META-INF/native-image/io.github.serpro69/cli-bot/reflect-config.json

+140
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@
4646
"name": "getAquaTeenHungerForce",
4747
"parameterTypes": []
4848
},
49+
{
50+
"name": "getArcher",
51+
"parameterTypes": []
52+
},
4953
{
5054
"name": "getArtist",
5155
"parameterTypes": []
@@ -318,6 +322,10 @@
318322
"name": "getFile",
319323
"parameterTypes": []
320324
},
325+
{
326+
"name": "getFinalFantasyXIV",
327+
"parameterTypes": []
328+
},
321329
{
322330
"name": "getFinalSpace",
323331
"parameterTypes": []
@@ -510,6 +518,10 @@
510518
"name": "getMinecraft",
511519
"parameterTypes": []
512520
},
521+
{
522+
"name": "getMitchHedberg",
523+
"parameterTypes": []
524+
},
513525
{
514526
"name": "getMoney",
515527
"parameterTypes": []
@@ -782,6 +794,10 @@
782794
"name": "getTouhou",
783795
"parameterTypes": []
784796
},
797+
{
798+
"name": "getTrainStation",
799+
"parameterTypes": []
800+
},
785801
{
786802
"name": "getTron",
787803
"parameterTypes": []
@@ -1002,6 +1018,23 @@
10021018
}
10031019
]
10041020
},
1021+
{
1022+
"name": "io.github.serpro69.kfaker.provider.Archer",
1023+
"methods": [
1024+
{
1025+
"name": "characters",
1026+
"parameterTypes": []
1027+
},
1028+
{
1029+
"name": "locations",
1030+
"parameterTypes": []
1031+
},
1032+
{
1033+
"name": "quotes",
1034+
"parameterTypes": []
1035+
}
1036+
]
1037+
},
10051038
{
10061039
"name": "io.github.serpro69.kfaker.provider.Artist",
10071040
"methods": [
@@ -2713,6 +2746,31 @@
27132746
}
27142747
]
27152748
},
2749+
{
2750+
"name": "io.github.serpro69.kfaker.provider.FinalFantasyXIV",
2751+
"methods": [
2752+
{
2753+
"name": "characters",
2754+
"parameterTypes": []
2755+
},
2756+
{
2757+
"name": "dataCenters",
2758+
"parameterTypes": []
2759+
},
2760+
{
2761+
"name": "jobs",
2762+
"parameterTypes": []
2763+
},
2764+
{
2765+
"name": "races",
2766+
"parameterTypes": []
2767+
},
2768+
{
2769+
"name": "zones",
2770+
"parameterTypes": []
2771+
}
2772+
]
2773+
},
27162774
{
27172775
"name": "io.github.serpro69.kfaker.provider.FinalSpace",
27182776
"methods": [
@@ -3837,6 +3895,15 @@
38373895
}
38383896
]
38393897
},
3898+
{
3899+
"name": "io.github.serpro69.kfaker.provider.MitchHedberg",
3900+
"methods": [
3901+
{
3902+
"name": "quote",
3903+
"parameterTypes": []
3904+
}
3905+
]
3906+
},
38403907
{
38413908
"name": "io.github.serpro69.kfaker.provider.Money",
38423909
"allDeclaredFields": true,
@@ -5316,6 +5383,79 @@
53165383
}
53175384
]
53185385
},
5386+
{
5387+
"name": "io.github.serpro69.kfaker.provider.TrainStation",
5388+
"methods": [
5389+
{
5390+
"name": "getGermany",
5391+
"parameterTypes": []
5392+
},
5393+
{
5394+
"name": "getSpain",
5395+
"parameterTypes": []
5396+
},
5397+
{
5398+
"name": "getUnitedKingdom",
5399+
"parameterTypes": []
5400+
},
5401+
{
5402+
"name": "getUnitedStates",
5403+
"parameterTypes": []
5404+
}
5405+
]
5406+
},
5407+
{
5408+
"name": "io.github.serpro69.kfaker.provider.TrainStationGermany",
5409+
"methods": [
5410+
{
5411+
"name": "metro",
5412+
"parameterTypes": []
5413+
},
5414+
{
5415+
"name": "railway",
5416+
"parameterTypes": []
5417+
}
5418+
]
5419+
},
5420+
{
5421+
"name": "io.github.serpro69.kfaker.provider.TrainStationSpain",
5422+
"methods": [
5423+
{
5424+
"name": "metro",
5425+
"parameterTypes": []
5426+
},
5427+
{
5428+
"name": "railway",
5429+
"parameterTypes": []
5430+
}
5431+
]
5432+
},
5433+
{
5434+
"name": "io.github.serpro69.kfaker.provider.TrainStationUnitedKingdom",
5435+
"methods": [
5436+
{
5437+
"name": "metro",
5438+
"parameterTypes": []
5439+
},
5440+
{
5441+
"name": "railway",
5442+
"parameterTypes": []
5443+
}
5444+
]
5445+
},
5446+
{
5447+
"name": "io.github.serpro69.kfaker.provider.TrainStationUnitedStates",
5448+
"methods": [
5449+
{
5450+
"name": "metro",
5451+
"parameterTypes": []
5452+
},
5453+
{
5454+
"name": "railway",
5455+
"parameterTypes": []
5456+
}
5457+
]
5458+
},
53195459
{
53205460
"name": "io.github.serpro69.kfaker.provider.Tron",
53215461
"methods": [

cli-bot/src/test/kotlin/io/github/serpro69/kfaker/app/cli/IntrospectorTest.kt

+8-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import io.github.serpro69.kfaker.provider.Airport
66
import io.github.serpro69.kfaker.provider.Dota
77
import io.kotest.core.spec.style.DescribeSpec
88
import io.kotest.matchers.collections.shouldContainExactly
9-
import io.kotest.matchers.sequences.shouldContainExactly
109
import kotlin.reflect.KClass
1110

1211
class IntrospectorTest : DescribeSpec() {
@@ -31,6 +30,7 @@ class IntrospectorTest : DescribeSpec() {
3130
"App",
3231
"Appliance",
3332
"AquaTeenHungerForce",
33+
"Archer",
3434
"Artist",
3535
"Australia",
3636
"Avatar",
@@ -99,6 +99,7 @@ class IntrospectorTest : DescribeSpec() {
9999
"Fallout",
100100
"FamilyGuy",
101101
"File",
102+
"FinalFantasyXIV",
102103
"FinalSpace",
103104
"Finance",
104105
"FmaBrotherhood",
@@ -147,6 +148,7 @@ class IntrospectorTest : DescribeSpec() {
147148
"MichaelScott",
148149
"Military",
149150
"Minecraft",
151+
"MitchHedberg",
150152
"Money",
151153
"Mountain",
152154
"Mountaineering",
@@ -215,6 +217,7 @@ class IntrospectorTest : DescribeSpec() {
215217
"TheThickOfIt",
216218
"Tolkien",
217219
"Touhou",
220+
"TrainStation",
218221
"Tron",
219222
"TwinPeaks",
220223
"UmphreysMcgee",
@@ -249,6 +252,7 @@ class IntrospectorTest : DescribeSpec() {
249252
"app",
250253
"appliance",
251254
"aquaTeenHungerForce",
255+
"archer",
252256
"artist",
253257
"australia",
254258
"avatar",
@@ -317,6 +321,7 @@ class IntrospectorTest : DescribeSpec() {
317321
"fallout",
318322
"familyGuy",
319323
"file",
324+
"finalFantasyXIV",
320325
"finalSpace",
321326
"finance",
322327
"fmaBrotherhood",
@@ -365,6 +370,7 @@ class IntrospectorTest : DescribeSpec() {
365370
"michaelScott",
366371
"military",
367372
"minecraft",
373+
"mitchHedberg",
368374
"money",
369375
"mountain",
370376
"mountaineering",
@@ -433,6 +439,7 @@ class IntrospectorTest : DescribeSpec() {
433439
"theThickOfIt",
434440
"tolkien",
435441
"touhou",
442+
"trainStation",
436443
"tron",
437444
"twinPeaks",
438445
"umphreysMcgee",

core/src/integration/kotlin/io/github/serpro69/kfaker/FakerIT.kt

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import kotlin.reflect.full.declaredMemberProperties
1616
import kotlin.reflect.full.isSubtypeOf
1717
import kotlin.reflect.full.starProjectedType
1818

19-
@Suppress("UNCHECKED_CAST")
2019
class FakerIT : DescribeSpec({
2120
describe("every public function in each provider is invoked without exceptions") {
2221
val faker = Faker()

core/src/main/kotlin/io/github/serpro69/kfaker/Faker.kt

+4
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class Faker @JvmOverloads constructor(internal val config: FakerConfig = fakerCo
4343
val app: App by lazy { App(fakerService) }
4444
val appliance: Appliance by lazy { Appliance(fakerService) }
4545
val aquaTeenHungerForce: AquaTeenHungerForce by lazy { AquaTeenHungerForce(fakerService) }
46+
val archer: Archer by lazy { Archer(fakerService) }
4647
val artist: Artist by lazy { Artist(fakerService) }
4748
val australia: Australia by lazy { Australia(fakerService) }
4849
val avatar: Avatar by lazy { Avatar(fakerService) }
@@ -111,6 +112,7 @@ class Faker @JvmOverloads constructor(internal val config: FakerConfig = fakerCo
111112
val fallout: Fallout by lazy { Fallout(fakerService) }
112113
val familyGuy: FamilyGuy by lazy { FamilyGuy(fakerService) }
113114
val file: File by lazy { File(fakerService) }
115+
val finalFantasyXIV: FinalFantasyXIV by lazy { FinalFantasyXIV(fakerService) }
114116
val finalSpace: FinalSpace by lazy { FinalSpace(fakerService) }
115117
val finance: Finance by lazy { Finance(fakerService) }
116118
val fmaBrotherhood: FmaBrotherhood by lazy { FmaBrotherhood(fakerService) }
@@ -161,6 +163,7 @@ class Faker @JvmOverloads constructor(internal val config: FakerConfig = fakerCo
161163
val michaelScott: MichaelScott by lazy { MichaelScott(fakerService) }
162164
val military: Military by lazy { Military(fakerService) }
163165
val minecraft: Minecraft by lazy { Minecraft(fakerService) }
166+
val mitchHedberg: MitchHedberg by lazy { MitchHedberg(fakerService) }
164167
val money: Money by lazy { Money(fakerService) }
165168
val mountain: Mountain by lazy { Mountain(fakerService) }
166169
val mountaineering: Mountaineering by lazy { Mountaineering(fakerService) }
@@ -231,6 +234,7 @@ class Faker @JvmOverloads constructor(internal val config: FakerConfig = fakerCo
231234
val theThickOfIt: TheThickOfIt by lazy { TheThickOfIt(fakerService) }
232235
val tolkien: Tolkien by lazy { Tolkien(fakerService) }
233236
val touhou: Touhou by lazy { Touhou(fakerService) }
237+
val trainStation: TrainStation by lazy { TrainStation(fakerService) }
234238
val tron: Tron by lazy { Tron(fakerService) }
235239
val twinPeaks: TwinPeaks by lazy { TwinPeaks(fakerService) }
236240
val umphreysMcgee: UmphreysMcgee by lazy { UmphreysMcgee(fakerService) }

core/src/main/kotlin/io/github/serpro69/kfaker/dictionary/YamlCategory.kt

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ internal enum class YamlCategory : Category {
1919
APP,
2020
APPLIANCE,
2121
AQUA_TEEN_HUNGER_FORCE,
22+
ARCHER,
2223
ARTIST,
2324
AUSTRALIA,
2425
AVATAR,
@@ -186,6 +187,7 @@ internal enum class YamlCategory : Category {
186187
THE_OFFICE,
187188
THE_THICK_OF_IT,
188189
TOLKIEN,
190+
TRAIN_STATION,
189191
TRON,
190192
TWIN_PEAKS,
191193
UMPHREYS_MCGEE,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package io.github.serpro69.kfaker.provider
2+
3+
import io.github.serpro69.kfaker.*
4+
import io.github.serpro69.kfaker.dictionary.*
5+
import io.github.serpro69.kfaker.provider.unique.LocalUniqueDataProvider
6+
import io.github.serpro69.kfaker.provider.unique.UniqueProviderDelegate
7+
8+
/**
9+
* [FakeDataProvider] implementation for [YamlCategory.ARCHER] category.
10+
*/
11+
@Suppress("unused")
12+
class Archer internal constructor(fakerService: FakerService) : YamlFakeDataProvider<Archer>(fakerService) {
13+
override val yamlCategory = YamlCategory.ARCHER
14+
override val localUniqueDataProvider = LocalUniqueDataProvider<Archer>()
15+
override val unique by UniqueProviderDelegate(localUniqueDataProvider)
16+
17+
init {
18+
fakerService.load(yamlCategory)
19+
}
20+
21+
fun characters() = resolve("characters")
22+
fun locations() = resolve("locations")
23+
fun quotes() = resolve("quotes")
24+
}

0 commit comments

Comments
 (0)