Skip to content
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

Missing setPostConditionExp without limit parameter in Kotlin extension #1138

Closed
sinsu1004 opened this issue Jan 7, 2025 · 1 comment
Closed
Labels
bug Something isn't working
Milestone

Comments

@sinsu1004
Copy link

sinsu1004 commented Jan 7, 2025

Describe the bug

ArbitraryBuilder Kotlin 확장 함수 중 문서에서 제공하는 Java 예제와 동일하게 동작하는 setPostConditionExp 함수가 누락된 것으로 보입니다. 현재는 limit 파라미터가 필수인 버전만 존재하여 Java 예제와 동일한 방식으로 사용하기 어려운 상황입니다.
KotlinTypeDefaultArbitraryBuilder 로 마이그레이션 해서 해결하려고 했지만 thenApply 부분에서 해당 이슈로 불가능한 상황입니다.

Your environment

  • version of Fixture Monkey: 1.1.8
  • version of Java/Kotlin: Kotlin 1.8.22

Steps to reproduce

image
문서의 kotlin 예제처럼 setPostConditionExp를 사용하려고 할 때:

javaCopyfixtureMonkey.giveMeBuilder(Product.class)
    .setPostConditionExp(Product::id, Long.class, it -> it > 0)

Kotlin에서 동일하게 사용하려고 하면 limit 파라미터가 필수여서 사용할 수 없음:

kotlinCopyfixtureMonkey.giveMeBuilder(Product::class.java)
    .setPostConditionExp(Product::id, Long::class.java, { it > 0 }, limit = ???)

Expected behaviour

kotlin 예제와 동일하게 limit 파라미터 없이도 setPostConditionExp를 사용할 수 있어야 합니다:

kotlinCopyfun <T, U> ArbitraryBuilder<T>.setPostConditionExp(
    property: KProperty1<T, *>,
    clazz: Class<U>,
    filter: Predicate<U>
): ArbitraryBuilder<T>

or

kotlinCopyfun <T, U> ArbitraryBuilder<T>.setPostConditionExp(
    property: KProperty1<T, *>,
    clazz: Class<U>,
    limit: Long = Constants.MAX_MANIPULATION_COUNT.toLong(),
    filter: Predicate<U>
): ArbitraryBuilder<T>

Actual behaviour

현재는 limit 파라미터가 필수인 버전만 존재합니다:

kotlinCopyfun <T, U> ArbitraryBuilder<T>.setPostConditionExp(
    property: KProperty1<T, *>,
    clazz: Class<U>,
    filter: Predicate<U>,
    limit: Long
): ArbitraryBuilder<T>
@sinsu1004 sinsu1004 added the bug Something isn't working label Jan 7, 2025
@seongahjo seongahjo added this to the 1.2.0 milestone Jan 8, 2025
@seongahjo
Copy link
Contributor

@sinsu1004 님 안녕하세요.

확장함수는 제거될 예정이므로 새로 지원은 어려울 것 같습니다. 아래 이슈가 해결되면 해결될 이슈으로 보입니다.
#1133

해결되면 공유드리겠습니다. 감사합니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants