Skip to content

Commit

Permalink
Refactor ArbitraryResolver depending on ArbitraryBuilderContext (#783)
Browse files Browse the repository at this point in the history
  • Loading branch information
seongahjo authored Oct 15, 2023
1 parent a828839 commit befd2a1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,11 @@ public ArbitraryResolver(

public CombinableArbitrary<?> resolve(
RootProperty rootProperty,
List<ArbitraryManipulator> manipulators,
List<ContainerInfoManipulator> containerInfoManipulators
ArbitraryBuilderContext builderContext
) {
List<ArbitraryManipulator> manipulators = builderContext.getManipulators();
List<ContainerInfoManipulator> containerInfoManipulators = builderContext.getContainerInfoManipulators();

List<MatcherOperator<List<ContainerInfoManipulator>>> registeredContainerInfoManipulators =
registeredArbitraryBuilders.stream()
.map(it -> new MatcherOperator<>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,16 +453,11 @@ public ArbitraryBuilderContext getContext() {

@SuppressWarnings("unchecked")
private CombinableArbitrary<?> resolveArbitrary(ArbitraryBuilderContext context) {
List<ArbitraryManipulator> manipulators = new ArrayList<>(context.getManipulators());
List<ContainerInfoManipulator> containerInfoManipulators =
new ArrayList<>(context.getContainerInfoManipulators());

if (context.isFixed()) {
if (context.getFixedCombinableArbitrary() == null || context.fixedExpired()) {
Object fixed = resolver.resolve(
rootProperty,
manipulators,
containerInfoManipulators
context
)
.filter(VALIDATION_ANNOTATION_FILTERING_COUNT, validateFilter(context.isValidOnly()))
.combined();
Expand All @@ -474,8 +469,7 @@ private CombinableArbitrary<?> resolveArbitrary(ArbitraryBuilderContext context)

return resolver.resolve(
rootProperty,
manipulators,
containerInfoManipulators
context
)
.filter(VALIDATION_ANNOTATION_FILTERING_COUNT, validateFilter(context.isValidOnly()));
}
Expand Down

0 comments on commit befd2a1

Please sign in to comment.