From b91edfe64c9393b4920af28c9c4fbf5c61900556 Mon Sep 17 00:00:00 2001 From: Xavier Gouchet Date: Mon, 9 Dec 2019 15:19:31 +0100 Subject: [PATCH] :sparkles: (JUnit5): Handle enums fields and parameters annotated with @Forgery --- .../xgouchet/elmyr/junit5/KotlinAnnotationTest.kt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/junit5/src/test/kotlin/fr/xgouchet/elmyr/junit5/KotlinAnnotationTest.kt b/junit5/src/test/kotlin/fr/xgouchet/elmyr/junit5/KotlinAnnotationTest.kt index 98bddb6..34ecc50 100644 --- a/junit5/src/test/kotlin/fr/xgouchet/elmyr/junit5/KotlinAnnotationTest.kt +++ b/junit5/src/test/kotlin/fr/xgouchet/elmyr/junit5/KotlinAnnotationTest.kt @@ -12,6 +12,7 @@ import fr.xgouchet.elmyr.junit5.dummy.Bar import fr.xgouchet.elmyr.junit5.dummy.BarFactory import fr.xgouchet.elmyr.junit5.dummy.Foo import fr.xgouchet.elmyr.junit5.dummy.FooFactory +import java.time.Month import org.assertj.core.api.Assertions import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -33,6 +34,9 @@ open class KotlinAnnotationTest { @Forgery lateinit var fakeFooMap: Map + @Forgery + lateinit var fakeMonth: Month + // region Forge @Test @@ -141,6 +145,14 @@ open class KotlinAnnotationTest { // endregion + // region Enum + + @Test + fun injectEnumForgery(@Forgery month: Month) { + assertThat(month) + .isNotNull() + } + // region Object from Factory @Test @@ -235,6 +247,8 @@ open class KotlinAnnotationTest { assertThat(fakeFooList).isNotNull.isNotEmpty assertThat(fakeFooSet).isNotNull.isNotEmpty assertThat(fakeFooMap).isNotNull.isNotEmpty + + assertThat(fakeMonth).isNotNull() } // endregion