Clarify three possible outcomes in CacheTests#testCachePollution

This commit is contained in:
Jason Tedor 2015-11-22 19:58:04 -05:00
parent 14a635fe4b
commit 5e2eb7d0de
1 changed files with 3 additions and 3 deletions

View File

@ -632,7 +632,7 @@ public class CacheTests extends ESTestCase {
first = random.nextBoolean(); first = random.nextBoolean();
second = random.nextBoolean(); second = random.nextBoolean();
} while (first && second); } while (first && second);
if (first && !second) { if (first) {
try { try {
cache.computeIfAbsent(key, k -> { cache.computeIfAbsent(key, k -> {
if (random.nextBoolean()) { if (random.nextBoolean()) {
@ -646,9 +646,9 @@ public class CacheTests extends ESTestCase {
assertThat(e.getCause(), instanceOf(Exception.class)); assertThat(e.getCause(), instanceOf(Exception.class));
assertEquals(e.getCause().getMessage(), "testCachePollution"); assertEquals(e.getCause().getMessage(), "testCachePollution");
} }
} else if (!first && second) { } else if (second) {
cache.invalidate(key); cache.invalidate(key);
} else if (!first && !second) { } else {
cache.get(key); cache.get(key);
} }
} }