@@ -150,7 +150,7 @@ public void testGettingInvalidByte() throws Exception {
150
150
double doubleNotByte = randomDoubleBetween (Byte .MAX_VALUE + 1 , Double .MAX_VALUE , true );
151
151
float floatNotByte = randomFloatBetween (Byte .MAX_VALUE + 1 , Float .MAX_VALUE );
152
152
String randomString = randomUnicodeOfCodepointLengthBetween (128 , 256 );
153
- long randomDate = randomLong ();
153
+ long randomDate = randomNonNegativeLong ();
154
154
155
155
String doubleErrorMessage = (doubleNotByte > Long .MAX_VALUE || doubleNotByte < Long .MIN_VALUE ) ?
156
156
Double .toString (doubleNotByte ) : Long .toString (Math .round (doubleNotByte ));
@@ -279,7 +279,7 @@ public void testGettingInvalidShort() throws Exception {
279
279
double doubleNotShort = randomDoubleBetween (Short .MAX_VALUE + 1 , Double .MAX_VALUE , true );
280
280
float floatNotShort = randomFloatBetween (Short .MAX_VALUE + 1 , Float .MAX_VALUE );
281
281
String randomString = randomUnicodeOfCodepointLengthBetween (128 , 256 );
282
- long randomDate = randomLong ();
282
+ long randomDate = randomNonNegativeLong ();
283
283
284
284
String doubleErrorMessage = (doubleNotShort > Long .MAX_VALUE || doubleNotShort < Long .MIN_VALUE ) ?
285
285
Double .toString (doubleNotShort ) : Long .toString (Math .round (doubleNotShort ));
@@ -400,7 +400,7 @@ public void testGettingInvalidInteger() throws Exception {
400
400
double doubleNotInt = randomDoubleBetween (getMaxIntPlusOne ().doubleValue (), Double .MAX_VALUE , true );
401
401
float floatNotInt = randomFloatBetween (getMaxIntPlusOne ().floatValue (), Float .MAX_VALUE );
402
402
String randomString = randomUnicodeOfCodepointLengthBetween (128 , 256 );
403
- long randomDate = randomLong ();
403
+ long randomDate = randomNonNegativeLong ();
404
404
405
405
String doubleErrorMessage = (doubleNotInt > Long .MAX_VALUE || doubleNotInt < Long .MIN_VALUE ) ?
406
406
Double .toString (doubleNotInt ) : Long .toString (Math .round (doubleNotInt ));
@@ -511,7 +511,7 @@ public void testGettingInvalidLong() throws Exception {
511
511
double doubleNotLong = randomDoubleBetween (getMaxLongPlusOne ().doubleValue (), Double .MAX_VALUE , true );
512
512
float floatNotLong = randomFloatBetween (getMaxLongPlusOne ().floatValue (), Float .MAX_VALUE );
513
513
String randomString = randomUnicodeOfCodepointLengthBetween (128 , 256 );
514
- long randomDate = randomLong ();
514
+ long randomDate = randomNonNegativeLong ();
515
515
516
516
index ("test" , "1" , builder -> {
517
517
builder .field ("test_double" , doubleNotLong );
@@ -606,7 +606,7 @@ public void testGettingInvalidDouble() throws Exception {
606
606
});
607
607
608
608
String randomString = randomUnicodeOfCodepointLengthBetween (128 , 256 );
609
- long randomDate = randomLong ();
609
+ long randomDate = randomNonNegativeLong ();
610
610
611
611
index ("test" , "1" , builder -> {
612
612
builder .field ("test_keyword" , randomString );
@@ -689,7 +689,7 @@ public void testGettingInvalidFloat() throws Exception {
689
689
});
690
690
691
691
String randomString = randomUnicodeOfCodepointLengthBetween (128 , 256 );
692
- long randomDate = randomLong ();
692
+ long randomDate = randomNonNegativeLong ();
693
693
694
694
index ("test" , "1" , builder -> {
695
695
builder .field ("test_keyword" , randomString );
@@ -722,8 +722,8 @@ public void testGettingBooleanValues() throws Exception {
722
722
builder .startObject ("test_boolean" ).field ("type" , "boolean" ).endObject ();
723
723
builder .startObject ("test_date" ).field ("type" , "date" ).endObject ();
724
724
});
725
- long randomDate1 = randomLong ();
726
- long randomDate2 = randomLong ();
725
+ long randomDate1 = randomNonNegativeLong ();
726
+ long randomDate2 = randomNonNegativeLong ();
727
727
728
728
// true values
729
729
indexSimpleDocumentWithTrueValues (randomDate1 );
@@ -805,7 +805,7 @@ public void testGettingDateWithoutCalendar() throws Exception {
805
805
builder .startObject ("test_boolean" ).field ("type" , "boolean" ).endObject ();
806
806
builder .startObject ("test_date" ).field ("type" , "date" ).endObject ();
807
807
});
808
- Long randomLongDate = randomLong ();
808
+ Long randomLongDate = randomNonNegativeLong ();
809
809
indexSimpleDocumentWithTrueValues (randomLongDate );
810
810
811
811
String timeZoneId = randomKnownTimeZone ();
@@ -838,7 +838,7 @@ public void testGettingDateWithCalendar() throws Exception {
838
838
builder .startObject ("test_boolean" ).field ("type" , "boolean" ).endObject ();
839
839
builder .startObject ("test_date" ).field ("type" , "date" ).endObject ();
840
840
});
841
- Long randomLongDate = randomLong ();
841
+ Long randomLongDate = randomNonNegativeLong ();
842
842
indexSimpleDocumentWithTrueValues (randomLongDate );
843
843
index ("test" , "2" , builder -> {
844
844
builder .timeField ("test_date" , null );
@@ -874,7 +874,7 @@ public void testGettingTimeWithoutCalendar() throws Exception {
874
874
builder .startObject ("test_boolean" ).field ("type" , "boolean" ).endObject ();
875
875
builder .startObject ("test_date" ).field ("type" , "date" ).endObject ();
876
876
});
877
- Long randomLongDate = randomLong ();
877
+ Long randomLongDate = randomNonNegativeLong ();
878
878
indexSimpleDocumentWithTrueValues (randomLongDate );
879
879
880
880
String timeZoneId = randomKnownTimeZone ();
@@ -906,7 +906,7 @@ public void testGettingTimeWithCalendar() throws Exception {
906
906
builder .startObject ("test_boolean" ).field ("type" , "boolean" ).endObject ();
907
907
builder .startObject ("test_date" ).field ("type" , "date" ).endObject ();
908
908
});
909
- Long randomLongDate = randomLong ();
909
+ Long randomLongDate = randomNonNegativeLong ();
910
910
indexSimpleDocumentWithTrueValues (randomLongDate );
911
911
index ("test" , "2" , builder -> {
912
912
builder .timeField ("test_date" , null );
@@ -940,7 +940,7 @@ public void testGettingTimestampWithoutCalendar() throws Exception {
940
940
builder .startObject ("release_date" ).field ("type" , "date" ).endObject ();
941
941
builder .startObject ("republish_date" ).field ("type" , "date" ).endObject ();
942
942
});
943
- long randomMillis = randomLong ();
943
+ long randomMillis = randomNonNegativeLong ();
944
944
945
945
index ("library" , "1" , builder -> {
946
946
builder .field ("name" , "Don Quixote" );
@@ -951,7 +951,7 @@ public void testGettingTimestampWithoutCalendar() throws Exception {
951
951
index ("library" , "2" , builder -> {
952
952
builder .field ("name" , "1984" );
953
953
builder .field ("page_count" , 328 );
954
- builder .field ("release_date" , - 649036800000L );
954
+ builder .field ("release_date" , 649036800000L );
955
955
builder .field ("republish_date" , 599616000000L );
956
956
});
957
957
@@ -970,7 +970,7 @@ public void testGettingTimestampWithoutCalendar() throws Exception {
970
970
971
971
assertTrue (results .next ());
972
972
assertEquals (599616000000L , results .getTimestamp ("republish_date" ).getTime ());
973
- assertEquals (- 649036800000L , ((Timestamp ) results .getObject (2 )).getTime ());
973
+ assertEquals (649036800000L , ((Timestamp ) results .getObject (2 )).getTime ());
974
974
975
975
assertFalse (results .next ());
976
976
});
@@ -983,7 +983,7 @@ public void testGettingTimestampWithCalendar() throws Exception {
983
983
builder .startObject ("test_boolean" ).field ("type" , "boolean" ).endObject ();
984
984
builder .startObject ("test_date" ).field ("type" , "date" ).endObject ();
985
985
});
986
- Long randomLongDate = randomLong ();
986
+ Long randomLongDate = randomNonNegativeLong ();
987
987
indexSimpleDocumentWithTrueValues (randomLongDate );
988
988
index ("test" , "2" , builder -> {
989
989
builder .timeField ("test_date" , null );
@@ -1022,7 +1022,7 @@ public void testValidGetObjectCalls() throws Exception {
1022
1022
double d = randomDouble ();
1023
1023
float f = randomFloat ();
1024
1024
boolean randomBool = randomBoolean ();
1025
- Long randomLongDate = randomLong ();
1025
+ Long randomLongDate = randomNonNegativeLong ();
1026
1026
String randomString = randomUnicodeOfCodepointLengthBetween (128 , 256 );
1027
1027
1028
1028
index ("test" , "1" , builder -> {
0 commit comments