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

ask; Setting Super Class Property Values in Kotlin #926

Closed xeromank closed 7 months ago

xeromank commented 7 months ago

Describe your question

Tell us what kind of problem you are having. Hello. I forked the code and saw it, To set the value of a property in a super class in Kotlin, and it seems that I need to use KotlinPlugin() and JacksonPlugin(). Is that correct?

I wish I don't use JacksonPlugin(). Is it possilble?

image

seongahjo commented 7 months ago

@xeromank Hello. It is possible without JacksonPlugin. All you need is the CompositeArbitraryIntrospector

FixtureMonkey.builder()
      .plugin(KotlinPlugin())
      .objectIntrospector(
          CompositeArbitraryIntrospector(
              listOf(
                  PrimaryConstructorArbitraryIntrospector.INSTANCE,
                  FieldReflectionArbitraryIntrospector.INSTANCE
              )
      )
  )
  .build()

Let me know if you have any problems.

xeromank commented 7 months ago

@seongahjo Thanks to you, it's going really well.