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

Add onManipulated #70

Closed
seongahjo opened this issue Oct 13, 2021 · 2 comments
Closed

Add onManipulated #70

seongahjo opened this issue Oct 13, 2021 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@seongahjo
Copy link
Contributor

void onManipulated(BuilderManipulator manipulator)
ArbitraryBuilder에 연산을 적용하면 onManipulated 메소드가 실행됩니다.

ArbitraryBuilder 생성시 onManipulated를 manual로 입력할 수 있습니다.
e.g. fixture.giveMeBuilder(Class<?> clazz, Consumer<BuilderManipulator> onManipulated)
onManipulated는 생성할 때만 입력받고, 변경이 불가능해야 예측 가능할 것 같습니다.

사용 예제

특정 필드에 연산을 적용할 경우 후속 처리를 추가할 때 사용할 수 있습니다.
e.g. DeliveryMethodType이 Delivery일 때 필드 설정 등..
e.g. 결제 수단에 따라 달라지는 필드 값들 설정
#31 의 대안이 될 수 있지 않을까 싶습니다.

@seongahjo seongahjo added the enhancement New feature or request label Oct 13, 2021
@seongahjo seongahjo self-assigned this Oct 13, 2021
@seongahjo
Copy link
Contributor Author

seongahjo commented Oct 27, 2021

e.g. DeliveryMethodType이 Delivery일 때 필드 설정 등..
e.g. 결제 수단에 따라 달라지는 필드 값들 설정

다음과 같은 예시를 처리하려면 자기 참조가 필요하다.
현재 생성자를 통해 콜백을 입력받으므로 자기 자신을 참조할 수 없다.
자기 자신을 참조로 줄 경우에는 예상치 못한 동작이 발생할 수 있다.
e.g. 연산을 설정하는 것이 아니라 sample, build 를 하는 경우

@seongahjo
Copy link
Contributor Author

순환참조 문제 해결 고민 필요

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant