naver / fixture-monkey

Let Fixture Monkey generate test instances including edge cases automatically
https://naver.github.io/fixture-monkey
Apache License 2.0
560 stars 89 forks source link

When attempting to create an instance of a Kotlin class containing a Java reference type class property, the creation fails #946

Closed jinia91 closed 3 months ago

jinia91 commented 6 months ago

Describe the bug

When attempting to create an instance of a Kotlin class containing a Java reference type class property using giveMeOne(), the creation fails because fixture monkey attempts to handle the Java class as Kotlin class.

Your environment

Steps to reproduce

        val sut: FixtureMonkey = FixtureMonkey.builder()
        .plugin(KotlinPlugin())
            .build()

        // when
        class KotlinObjectWithJavaObject(val javaObject: JavaObject)
        val actual = sut.giveMeOne<KotlinObjectWithJavaObject>()

        then(actual).isNotNull
        then(actual.javaObject).isNotNull
        then(actual.javaObject.value).isNotNull

Expected behaviour

Properties of a Kotlin class, regardless of whether they are Java or Kotlin classes, should be instantiated and initialized correctly.

Actual behaviour

image
seongahjo commented 3 months ago

It is fixed in 1.0.15.