[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 {
|
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
|
ByteSizeValue byteSizeValue = new ByteSizeValue(randomPositiveLong(), randomFrom(ByteSizeUnit.values()));
|
||||||
long l = Long.MIN_VALUE;
|
|
||||||
while (l == Long.MIN_VALUE) {
|
|
||||||
l = randomLong();
|
|
||||||
}
|
|
||||||
ByteSizeValue byteSizeValue = new ByteSizeValue(Math.abs(l), randomFrom(ByteSizeUnit.values()));
|
|
||||||
try (BytesStreamOutput out = new BytesStreamOutput()) {
|
try (BytesStreamOutput out = new BytesStreamOutput()) {
|
||||||
byteSizeValue.writeTo(out);
|
byteSizeValue.writeTo(out);
|
||||||
try (StreamInput in = out.bytes().streamInput()) {
|
try (StreamInput in = out.bytes().streamInput()) {
|
||||||
|
|
|
@ -34,11 +34,7 @@ public class OsInfoTests extends ESTestCase {
|
||||||
if (randomBoolean()) {
|
if (randomBoolean()) {
|
||||||
refreshInterval = -1;
|
refreshInterval = -1;
|
||||||
} else {
|
} else {
|
||||||
refreshInterval = randomLong();
|
refreshInterval = randomPositiveLong();
|
||||||
while (refreshInterval == Long.MIN_VALUE) {
|
|
||||||
refreshInterval = randomLong();
|
|
||||||
}
|
|
||||||
refreshInterval = Math.abs(refreshInterval);
|
|
||||||
}
|
}
|
||||||
String name = randomAsciiOfLengthBetween(3, 10);
|
String name = randomAsciiOfLengthBetween(3, 10);
|
||||||
String arch = randomAsciiOfLengthBetween(3, 10);
|
String arch = randomAsciiOfLengthBetween(3, 10);
|
||||||
|
|
Loading…
Reference in New Issue