8000 Jqwik, SimpleJqwik 플러그인 동작에 대한 질문입니다. · Issue #1185 · naver/fixture-monkey · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Jqwik, SimpleJqwik 플러그인 동작에 대한 질문입니다. #1185

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
newkayak12 opened this issue May 25, 2025 · 2 comments
Open

Jqwik, SimpleJqwik 플러그인 동작에 대한 질문입니다. #1185

newkayak12 opened this issue May 25, 2025 · 2 comments
Labels
question Further information is requested

Comments

@newkayak12
Copy link
val fixtureMonkey =
            FixtureMonkey.builder()
                .enableLoggingFail(false)
                .defaultNotNull(true)
                .objectIntrospector(
                    FailoverIntrospector(
                        listOf(
                            ConstructorPropertiesArbitraryIntrospector.INSTANCE,
                            BuilderArbitraryIntrospector.INSTANCE
                        ),
                    ),
                )
                .plugin {
                    KotlinPlugin()
                    JqwikPlugin().javaTypeArbitraryGenerator(
                        object : JavaTypeArbitraryGenerator {
                            override fun strings(): StringArbitrary {
                                return Arbitraries.strings().ofMinLength(8).ofMaxLength(12)
                            }
                        },
                    )
                }
                .build()

위와 같이 세팅하고 string을 giveMeOne 하는데 length가 예상한 바와 다르게 동작하는 것 같습니다.
java에서는 위와 같이 세팅하고 사용하고는 했는데 위 세팅으로 kotlin에서도 예상한 바와 같이 동작하지 않는 것이 맞나요?

@newkayak12 newkayak12 added the question Further information is requested label May 25, 2025
@seongahjo
Copy link
Contributor
seongahjo commented May 28, 2025

@newkayak12 님 안녕하세요.

특별한 경우를 제외하고는 자바와 코틀린은 동작이 동일한데요, 혹시 예시가 실제 사용하고 계신 경우가 맞을까요?
만약 KotestPlugin도 추가하고 계시다면 JqwikPlugin의 동작이 적용이 안될수는 있습니다.

재현 가능한 케이스를 공유해주시면 더 자세히 확인해드릴 수 있습니다.

감사합니다.

@newkayak12
Copy link
Author
newkayak12 commented Jun 9, 2025

@seongahjo
따로 KotestPlugin을 추가하고 있지는 않습니다.
반복해서 사용해보고 있는데 특히 string의 length쪽 조절이 안되는 것 같습니다.

// monkey 선언
val monkey =  FixtureMonkey
            .builder()
            .defaultNotNull(true)
            .enableLoggingFail(false)
            .objectIntrospector(
                FailoverIntrospector(
                    listOf(
                        FieldReflectionArbitraryIntrospector.INSTANCE,
                        ConstructorPropertiesArbitraryIntrospector.INSTANCE,
                    ),
                ),
            )
            .plugin(KotlinPlugin())
            .plugin( SimpleValueJqwikPlugin().minStringLength(8))
           .build()

// dataClass
data class TestDataClass (
        val testString: String
)

// 사용 예시
 val query = monkey <TestDataClass >()

와 같이 사용합니다. plugin의 경우 SImpleValueJqwikPlugin 혹은 위에서 기술한 JqwikPlugin을 사용할 때도 있습니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants
0