diff --git a/opengraphkt/src/main/kotlin/fr/lengrand/opengraphkt/Models.kt b/opengraphkt/src/main/kotlin/fr/lengrand/opengraphkt/Models.kt index e6ffecc..d8ff45e 100644 --- a/opengraphkt/src/main/kotlin/fr/lengrand/opengraphkt/Models.kt +++ b/opengraphkt/src/main/kotlin/fr/lengrand/opengraphkt/Models.kt @@ -60,7 +60,7 @@ enum class Gender { } override fun toString(): String { - return this.toString().lowercase() + return this.name.lowercase() } } diff --git a/opengraphkt/src/test/kotlin/fr/lengrand/opengraphkt/ParserTest.kt b/opengraphkt/src/test/kotlin/fr/lengrand/opengraphkt/ParserTest.kt index 559fefc..7ec2fd9 100644 --- a/opengraphkt/src/test/kotlin/fr/lengrand/opengraphkt/ParserTest.kt +++ b/opengraphkt/src/test/kotlin/fr/lengrand/opengraphkt/ParserTest.kt @@ -697,4 +697,15 @@ class ParserTest { assertTrue(openGraphData.videoEpisode.tags.contains("comedy")) assertEquals("Awesome Series", openGraphData.videoEpisode.series) } + + @Test + fun `test Gender enum toString method`() { + // Test that the toString method returns the lowercase name of the enum value + assertEquals("male", Gender.MALE.toString()) + assertEquals("female", Gender.FEMALE.toString()) + + // Test that the fromString method correctly converts a string to the enum value + assertEquals(Gender.MALE, Gender.fromString("MALE")) + assertEquals(Gender.FEMALE, Gender.fromString("FEMALE")) + } }