@@ -93,7 +93,7 @@ public static Iterable<Object[]> parameters() {
9393 }
9494
9595 private static void booleans (List <TestCaseSupplier > suppliers , int items ) {
96- suppliers .add (new TestCaseSupplier ("boolean" , makeTypes (DataType .BOOLEAN , DataType .BOOLEAN , items ), () -> {
96+ suppliers .add (new TestCaseSupplier ("boolean" , typesList (DataType .BOOLEAN , DataType .BOOLEAN , items ), () -> {
9797 List <Boolean > inlist = randomList (items , items , () -> randomBoolean ());
9898 boolean field = randomBoolean ();
9999 List <TestCaseSupplier .TypedData > args = new ArrayList <>(inlist .size () + 1 );
@@ -111,7 +111,7 @@ private static void booleans(List<TestCaseSupplier> suppliers, int items) {
111111 }
112112
113113 private static void numerics (List <TestCaseSupplier > suppliers , int items ) {
114- suppliers .add (new TestCaseSupplier ("integer" , makeTypes (DataType .INTEGER , DataType .INTEGER , items ), () -> {
114+ suppliers .add (new TestCaseSupplier ("integer" , typesList (DataType .INTEGER , DataType .INTEGER , items ), () -> {
115115 List <Integer > inlist = randomList (items , items , () -> randomInt ());
116116 int field = inlist .get (inlist .size () - 1 );
117117 List <TestCaseSupplier .TypedData > args = new ArrayList <>(inlist .size () + 1 );
@@ -127,7 +127,7 @@ private static void numerics(List<TestCaseSupplier> suppliers, int items) {
127127 );
128128 }));
129129
130- suppliers .add (new TestCaseSupplier ("long" , makeTypes (DataType .LONG , DataType .LONG , items ), () -> {
130+ suppliers .add (new TestCaseSupplier ("long" , typesList (DataType .LONG , DataType .LONG , items ), () -> {
131131 List <Long > inlist = randomList (items , items , () -> randomLong ());
132132 long field = randomLong ();
133133 List <TestCaseSupplier .TypedData > args = new ArrayList <>(inlist .size () + 1 );
@@ -143,7 +143,7 @@ private static void numerics(List<TestCaseSupplier> suppliers, int items) {
143143 );
144144 }));
145145
146- suppliers .add (new TestCaseSupplier ("double" , makeTypes (DataType .DOUBLE , DataType .DOUBLE , items ), () -> {
146+ suppliers .add (new TestCaseSupplier ("double" , typesList (DataType .DOUBLE , DataType .DOUBLE , items ), () -> {
147147 List <Double > inlist = randomList (items , items , () -> randomDouble ());
148148 double field = inlist .get (0 );
149149 List <TestCaseSupplier .TypedData > args = new ArrayList <>(inlist .size () + 1 );
@@ -164,7 +164,7 @@ private static void bytesRefs(List<TestCaseSupplier> suppliers, int items) {
164164 for (DataType type1 : DataType .stringTypes ()) {
165165 for (DataType type2 : DataType .stringTypes ()) {
166166 String name = type1 == type2 ? type1 .toString () : type1 + " " + type2 ;
167- suppliers .add (new TestCaseSupplier (name .toLowerCase (Locale .ROOT ), makeTypes (type1 , type2 , items ), () -> {
167+ suppliers .add (new TestCaseSupplier (name .toLowerCase (Locale .ROOT ), typesList (type1 , type2 , items ), () -> {
168168 List <Object > inlist = randomList (items , items , () -> randomLiteral (type1 ).value ());
169169 Object field = randomLiteral (type2 ).value ();
170170 List <TestCaseSupplier .TypedData > args = new ArrayList <>(inlist .size () + 1 );
@@ -181,7 +181,7 @@ private static void bytesRefs(List<TestCaseSupplier> suppliers, int items) {
181181 }));
182182 }
183183 }
184- suppliers .add (new TestCaseSupplier ("ip" , makeTypes (DataType .IP , DataType .IP , items ), () -> {
184+ suppliers .add (new TestCaseSupplier ("ip" , typesList (DataType .IP , DataType .IP , items ), () -> {
185185 List <Object > inlist = randomList (items , items , () -> randomLiteral (DataType .IP ).value ());
186186 Object field = randomLiteral (DataType .IP ).value ();
187187 List <TestCaseSupplier .TypedData > args = new ArrayList <>(inlist .size () + 1 );
@@ -197,7 +197,7 @@ private static void bytesRefs(List<TestCaseSupplier> suppliers, int items) {
197197 );
198198 }));
199199
200- suppliers .add (new TestCaseSupplier ("version" , makeTypes (DataType .VERSION , DataType .VERSION , items ), () -> {
200+ suppliers .add (new TestCaseSupplier ("version" , typesList (DataType .VERSION , DataType .VERSION , items ), () -> {
201201 List <Object > inlist = randomList (items , items , () -> randomLiteral (DataType .VERSION ).value ());
202202 Object field = randomLiteral (DataType .VERSION ).value ();
203203 List <TestCaseSupplier .TypedData > args = new ArrayList <>(inlist .size () + 1 );
@@ -213,7 +213,7 @@ private static void bytesRefs(List<TestCaseSupplier> suppliers, int items) {
213213 );
214214 }));
215215
216- suppliers .add (new TestCaseSupplier ("geo_point" , makeTypes (GEO_POINT , GEO_POINT , items ), () -> {
216+ suppliers .add (new TestCaseSupplier ("geo_point" , typesList (GEO_POINT , GEO_POINT , items ), () -> {
217217 List <Object > inlist = randomList (items , items , () -> new BytesRef (GEO .asWkt (GeometryTestUtils .randomPoint ())));
218218 Object field = inlist .get (0 );
219219 List <TestCaseSupplier .TypedData > args = new ArrayList <>(inlist .size () + 1 );
@@ -229,7 +229,7 @@ private static void bytesRefs(List<TestCaseSupplier> suppliers, int items) {
229229 );
230230 }));
231231
232- suppliers .add (new TestCaseSupplier ("geo_shape" , makeTypes (GEO_SHAPE , GEO_SHAPE , items ), () -> {
232+ suppliers .add (new TestCaseSupplier ("geo_shape" , typesList (GEO_SHAPE , GEO_SHAPE , items ), () -> {
233233 List <Object > inlist = randomList (
234234 items ,
235235 items ,
@@ -249,7 +249,7 @@ private static void bytesRefs(List<TestCaseSupplier> suppliers, int items) {
249249 );
250250 }));
251251
252- suppliers .add (new TestCaseSupplier ("cartesian_point" , makeTypes (CARTESIAN_POINT , CARTESIAN_POINT , items ), () -> {
252+ suppliers .add (new TestCaseSupplier ("cartesian_point" , typesList (CARTESIAN_POINT , CARTESIAN_POINT , items ), () -> {
253253 List <Object > inlist = randomList (items , items , () -> new BytesRef (CARTESIAN .asWkt (ShapeTestUtils .randomPoint ())));
254254 Object field = new BytesRef (CARTESIAN .asWkt (ShapeTestUtils .randomPoint ()));
255255 List <TestCaseSupplier .TypedData > args = new ArrayList <>(inlist .size () + 1 );
@@ -265,7 +265,7 @@ private static void bytesRefs(List<TestCaseSupplier> suppliers, int items) {
265265 );
266266 }));
267267
268- suppliers .add (new TestCaseSupplier ("cartesian_shape" , makeTypes (CARTESIAN_SHAPE , CARTESIAN_SHAPE , items ), () -> {
268+ suppliers .add (new TestCaseSupplier ("cartesian_shape" , typesList (CARTESIAN_SHAPE , CARTESIAN_SHAPE , items ), () -> {
269269 List <Object > inlist = randomList (
270270 items ,
271271 items ,
@@ -289,10 +289,10 @@ private static void bytesRefs(List<TestCaseSupplier> suppliers, int items) {
289289 /**
290290 * Returns a list with N dataType1, followed by 1 dataType2.
291291 */
292- private static List <DataType > makeTypes (DataType dataType1 , DataType dataType2 , int n ) {
292+ private static List <DataType > typesList (DataType inListType , DataType fieldType , int n ) {
293293 List <DataType > types = new ArrayList <>(n + 1 );
294- IntStream .range (0 , n ).forEach (i -> types .add (dataType1 ));
295- types .add (dataType2 );
294+ IntStream .range (0 , n ).forEach (i -> types .add (inListType ));
295+ types .add (fieldType );
296296 return types ;
297297 }
298298
0 commit comments