18
18
19
19
package com .navercorp .fixturemonkey .customizer ;
20
20
21
+ import static java .util .stream .Collectors .toList ;
22
+
21
23
import java .util .ArrayList ;
22
24
import java .util .Collections ;
23
25
import java .util .Comparator ;
@@ -202,21 +204,8 @@ private DefaultArbitraryBuilder<?> findRegisteredArbitraryBuilder(
202
204
.sorted (Comparator .comparingInt (PriorityMatcherOperator ::getPriority ))
203
205
.collect (Collectors .toList ());
204
206
205
- return getHighestPriorityOperator (priorityOperators );
206
- }
207
-
208
- private DefaultArbitraryBuilder <?> getHighestPriorityOperator (
209
- List <PriorityMatcherOperator <? extends ArbitraryBuilder <?>>> priorityOperators
210
- ) {
211
- if (priorityOperators .isEmpty ()) {
212
- return null ;
213
- }
214
-
215
- int highestPriority = priorityOperators .get (0 ).getPriority ();
216
- List <PriorityMatcherOperator <? extends ArbitraryBuilder <?>>> highestPriorityOperators = priorityOperators
217
- .stream ()
218
- .filter (it -> it .getPriority () == highestPriority )
219
- .collect (Collectors .toList ());
207
+ List <PriorityMatcherOperator <? extends ArbitraryBuilder <?>>> highestPriorityOperators
208
+ = getHighestPriorityOperators (priorityOperators );
220
209
221
210
if (highestPriorityOperators .size () > 1 ) {
222
211
Collections .shuffle (highestPriorityOperators , Randoms .current ());
@@ -229,6 +218,20 @@ private DefaultArbitraryBuilder<?> getHighestPriorityOperator(
229
218
.orElse (null );
230
219
}
231
220
221
+ private List <PriorityMatcherOperator <? extends ArbitraryBuilder <?>>> getHighestPriorityOperators (
222
+ List <PriorityMatcherOperator <? extends ArbitraryBuilder <?>>> priorityOperators
223
+ ) {
224
+ if (priorityOperators .isEmpty ()) {
225
+ return priorityOperators ;
226
+ }
227
+
228
+ int highestPriority = priorityOperators .get (0 ).getPriority ();
229
+
230
+ return priorityOperators .stream ()
231
+ .filter (it -> it .getPriority () == highestPriority )
232
+ .collect (toList ());
233
+ }
234
+
232
235
public ManipulatorSet newManipulatorSet (ManipulatorHolderSet manipulatorHolderSet ) {
233
236
int baseSequence = sequence .getAndIncrement ();
234
237
0 commit comments