Skip to content

Commit

Permalink
✨ (JUnit5): Handle enums fields and parameters annotated with @forgery
Browse files Browse the repository at this point in the history
  • Loading branch information
xgouchet committed Dec 9, 2019
1 parent 7aebe7a commit b91edfe
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -33,6 +34,9 @@ open class KotlinAnnotationTest {
@Forgery
lateinit var fakeFooMap: Map<Foo, Bar>

@Forgery
lateinit var fakeMonth: Month

// region Forge

@Test
Expand Down Expand Up @@ -141,6 +145,14 @@ open class KotlinAnnotationTest {

// endregion

// region Enum

@Test
fun injectEnumForgery(@Forgery month: Month) {
assertThat(month)
.isNotNull()
}

// region Object from Factory

@Test
Expand Down Expand Up @@ -235,6 +247,8 @@ open class KotlinAnnotationTest {
assertThat(fakeFooList).isNotNull.isNotEmpty
assertThat(fakeFooSet).isNotNull.isNotEmpty
assertThat(fakeFooMap).isNotNull.isNotEmpty

assertThat(fakeMonth).isNotNull()
}

// endregion
Expand Down

0 comments on commit b91edfe

Please sign in to comment.