Skip to content
Permalink
Browse files

[SMALLFIX] Use static imports for standard test utilities

pr-link: #9013
change-id: cid-22606797ac98bc22e33bce70b563355fb4bc606e
  • Loading branch information...
15996236828 authored and alluxio-bot committed May 14, 2019
1 parent 7e7c2c1 commit 35c07fb856cd801566412794440108a024ddf3a1
Showing with 10 additions and 8 deletions.
  1. +10 −8 core/base/src/test/java/alluxio/collections/IndexedSetConcurrencyTest.java
@@ -11,10 +11,12 @@

package alluxio.collections;

import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertEquals;

import alluxio.util.SleepUtils;

import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

@@ -119,11 +121,11 @@ public long runSingleTask() {
for (int i = ThreadLocalRandom.current().nextInt(1, MAX_REPEAT_TIMES + 1); i > 0; i--) {
TestInfo instance = new TestInfo(ThreadLocalRandom.current().nextLong(), size);
result += (mIndexedSet.add(instance) ? 1 : 0);
Assert.assertTrue(mIndexedSet.contains(mIdIndex, instance.getId()));
Assert.assertEquals(1, mIndexedSet.getByField(mIdIndex, instance.getId()).size());
assertTrue(mIndexedSet.contains(mIdIndex, instance.getId()));
assertEquals(1, mIndexedSet.getByField(mIdIndex, instance.getId()).size());
}

Assert.assertTrue(result <= mIndexedSet.getByField(mSizeIndex, size).size());
assertTrue(result <= mIndexedSet.getByField(mSizeIndex, size).size());

return result;
}
@@ -278,23 +280,23 @@ private void verifySet() {
sizes.add(info.getSize());
expectedCount++;
}
Assert.assertEquals(expectedCount, mIndexedSet.size());
assertEquals(expectedCount, mIndexedSet.size());

// Verify the size according to the id index.
int count = 0;
for (Long id : ids) {
Set<TestInfo> elements = mIndexedSet.getByField(mIdIndex, id);
count += elements.size();
}
Assert.assertEquals(expectedCount, count);
assertEquals(expectedCount, count);

// Verify the size according to the size index.
count = 0;
for (Integer size : sizes) {
Set<TestInfo> elements = mIndexedSet.getByField(mSizeIndex, size);
count += elements.size();
}
Assert.assertEquals(expectedCount, count);
assertEquals(expectedCount, count);
}

@Test
@@ -353,7 +355,7 @@ public void basicConcurrentUpdate() throws Exception {
removed += task.getCount();
}

Assert.assertEquals(mIndexedSet.size(), added - removed);
assertEquals(mIndexedSet.size(), added - removed);
verifySet();
}

0 comments on commit 35c07fb

Please sign in to comment.
You can’t perform that action at this time.