[TEST] Use a reproducible source of randomness in shuffle

This commit is contained in:
polyfractal 2016-05-17 12:55:07 -04:00
parent ee6d29b342
commit c755a77022
1 changed files with 2 additions and 1 deletions

View File

@ -30,6 +30,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Random;
import java.util.stream.Collectors;
import static org.hamcrest.Matchers.containsString;
@ -66,7 +67,7 @@ public class SortProcessorTests extends ESTestCase {
Integer[] expectedResult = new Integer[]{1,2,3,4,5,10,20,21,22,50,100};
List<Integer> fieldValue = new ArrayList<>(expectedResult.length);
fieldValue.addAll(Arrays.asList(expectedResult).subList(0, expectedResult.length));
Collections.shuffle(fieldValue);
Collections.shuffle(fieldValue, random());
String fieldName = RandomDocumentPicks.addRandomField(random(), ingestDocument, fieldValue);
Processor processor = new SortProcessor(randomAsciiOfLength(10), fieldName, SortOrder.ASCENDING);