[TEST] use single line ternary over more verbose ifs

This commit is contained in:
javanna 2016-09-01 20:15:56 +02:00 committed by Luca Cavanna
parent 6873454f33
commit c0a0100308
2 changed files with 2 additions and 12 deletions

View File

@ -30,12 +30,7 @@ public class OsInfoTests extends ESTestCase {
public void testSerialization() throws IOException {
int availableProcessors = randomIntBetween(1, 64);
int allocatedProcessors = randomIntBetween(1, availableProcessors);
long refreshInterval;
if (randomBoolean()) {
refreshInterval = -1;
} else {
refreshInterval = randomPositiveLong();
}
long refreshInterval = randomBoolean() ? -1 : randomPositiveLong();
String name = randomAsciiOfLengthBetween(3, 10);
String arch = randomAsciiOfLengthBetween(3, 10);
String version = randomAsciiOfLengthBetween(3, 10);

View File

@ -36,12 +36,7 @@ public class OsProbeTests extends ESTestCase {
public void testOsInfo() {
int allocatedProcessors = randomIntBetween(1, Runtime.getRuntime().availableProcessors());
long refreshInterval;
if (randomBoolean()) {
refreshInterval = -1;
} else {
refreshInterval = randomPositiveLong();
}
long refreshInterval = randomBoolean() ? -1 : randomPositiveLong();
OsInfo info = probe.osInfo(refreshInterval, allocatedProcessors);
assertNotNull(info);
assertEquals(refreshInterval, info.getRefreshInterval());