Repository: serpro69/kotlin-faker (kotlin)

Issue:
StarWars quotes not working
https://github.com/serpro69/kotlin-faker/blob/e49385d3240a8e0051c28d764d5723e6dbcef10f/core/src/main/kotlin/io/github/serpro69/kfaker/provider/StarWars.kt#L30

looks like oldValue and newValue are replaced.
`.starWars.quotes("admiral_ackbar")` isn't working as described. 

The key uses underscore: 
https://github.com/serpro69/kotlin-faker/blob/abe4eaa4aa1673707719332566cb52ea746672dc/core/src/main/resources/locales/en/star_wars.yml#L226

Pull request:
this fixes https://github.com/serpro69/kotlin-faker/issues/148

I also added tests, but i am not familiar with kotest, so maybe you should have a look first.

Patch:
diff --git a/core/src/main/kotlin/io/github/serpro69/kfaker/provider/StarWars.kt b/core/src/main/kotlin/io/github/serpro69/kfaker/provider/StarWars.kt
index ba98755444..b065d80968 100644
--- a/core/src/main/kotlin/io/github/serpro69/kfaker/provider/StarWars.kt
+++ b/core/src/main/kotlin/io/github/serpro69/kfaker/provider/StarWars.kt
@@ -27,7 +27,7 @@ class StarWars internal constructor(fakerService: FakerService) : YamlFakeDataPr
     fun species() = resolve("species")
     fun vehicles() = resolve("vehicles")
     fun wookieeWords() = resolve("wookiee_words")
-    fun quotes(character: String) = resolve("quotes", character.lowercase().replace("_", " "))
+    fun quotes(character: String) = resolve("quotes", character.lowercase().replace(" ", "_"))
     fun quote() = resolve("quotes", "")
     fun alternateCharacterSpellings(character: String) = resolve("alternate_character_spellings", character)
 }


Test patch:
diff --git a/core/src/test/kotlin/io/github/serpro69/kfaker/provider/CrossfitTest.kt b/core/src/test/kotlin/io/github/serpro69/kfaker/provider/CrossfitTest.kt
index 8cc6639031..ab27cef6f2 100644
--- a/core/src/test/kotlin/io/github/serpro69/kfaker/provider/CrossfitTest.kt
+++ b/core/src/test/kotlin/io/github/serpro69/kfaker/provider/CrossfitTest.kt
@@ -7,7 +7,7 @@ import io.kotest.matchers.shouldNotBe
 
 class CrossfitTest : DescribeSpec({
     describe("Crossfit provider") {
-        val crossfit = Crossfit( FakerService(faker = Faker()))
+        val crossfit = Crossfit(FakerService(faker = Faker()))
 
         context("competition fun") {
             it("should returns a Crossfit® competition name") {
diff --git a/core/src/test/kotlin/io/github/serpro69/kfaker/provider/StarWarsTest.kt b/core/src/test/kotlin/io/github/serpro69/kfaker/provider/StarWarsTest.kt
new file mode 100644
index 0000000000..0b10f99e16
--- /dev/null
+++ b/core/src/test/kotlin/io/github/serpro69/kfaker/provider/StarWarsTest.kt
@@ -0,0 +1,24 @@
+package io.github.serpro69.kfaker.provider
+
+import io.github.serpro69.kfaker.Faker
+import io.github.serpro69.kfaker.FakerService
+import io.kotest.core.spec.style.DescribeSpec
+import io.kotest.matchers.shouldNotBe
+
+class StarWarsTest : DescribeSpec({
+    describe("StarWars provider") {
+        val starWars = StarWars(FakerService(faker = Faker()))
+
+        context("any quote") {
+            it("should return any quote") {
+                starWars.quote() shouldNotBe null
+            }
+        }
+
+        context("quotes filter") {
+            it("should return a Admiral Ackbar quote") {
+                starWars.quotes("admiral_ackbar") shouldNotBe null
+            }
+        }
+    }
+})