[TEST] use randomPositiveLong where possible
This commit is contained in:
parent
774244a61f
commit
68eb58f9e3
|
@ -171,12 +171,7 @@ public class ByteSizeValueTests extends ESTestCase {
|
|||
}
|
||||
|
||||
public void testSerialization() throws IOException {
|
||||
//negative values cannot be serialized at the moment, we do abs but that is not enough with Long.MIN_VALUE
|
||||
long l = Long.MIN_VALUE;
|
||||
while (l == Long.MIN_VALUE) {
|
||||
l = randomLong();
|
||||
}
|
||||
ByteSizeValue byteSizeValue = new ByteSizeValue(Math.abs(l), randomFrom(ByteSizeUnit.values()));
|
||||
ByteSizeValue byteSizeValue = new ByteSizeValue(randomPositiveLong(), randomFrom(ByteSizeUnit.values()));
|
||||
try (BytesStreamOutput out = new BytesStreamOutput()) {
|
||||
byteSizeValue.writeTo(out);
|
||||
try (StreamInput in = out.bytes().streamInput()) {
|
||||
|
|
|
@ -34,11 +34,7 @@ public class OsInfoTests extends ESTestCase {
|
|||
if (randomBoolean()) {
|
||||
refreshInterval = -1;
|
||||
} else {
|
||||
refreshInterval = randomLong();
|
||||
while (refreshInterval == Long.MIN_VALUE) {
|
||||
refreshInterval = randomLong();
|
||||
}
|
||||
refreshInterval = Math.abs(refreshInterval);
|
||||
refreshInterval = randomPositiveLong();
|
||||
}
|
||||
String name = randomAsciiOfLengthBetween(3, 10);
|
||||
String arch = randomAsciiOfLengthBetween(3, 10);
|
||||
|
|
Loading…
Reference in New Issue